mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-23 08:59:28 +00:00
res wg 兼容
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
package net.momirealms.customcrops.Integrations;
|
||||
|
||||
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
|
||||
import com.bekvon.bukkit.residence.protection.FlagPermissions;
|
||||
import com.bekvon.bukkit.residence.protection.ResidencePermissions;
|
||||
import dev.lone.itemsadder.api.Events.CustomBlockInteractEvent;
|
||||
import org.bukkit.Location;
|
||||
|
||||
public class ResidenceIntegrations {
|
||||
public static boolean checkResBuild(Location location, CustomBlockInteractEvent event){
|
||||
FlagPermissions.addFlag("build");
|
||||
ClaimedResidence res = com.bekvon.bukkit.residence.Residence.getInstance().getResidenceManager().getByLoc(location);
|
||||
if(res!=null){
|
||||
ResidencePermissions perms = res.getPermissions();
|
||||
String playerName = event.getPlayer().getName();
|
||||
boolean hasPermission = perms.playerHas(playerName, "build", true);
|
||||
if(!hasPermission){
|
||||
event.setCancelled(true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static boolean checkResHarvest(Location location, CustomBlockInteractEvent event){
|
||||
FlagPermissions.addFlag("harvest");
|
||||
ClaimedResidence res = com.bekvon.bukkit.residence.Residence.getInstance().getResidenceManager().getByLoc(location);
|
||||
if(res!=null){
|
||||
ResidencePermissions perms = res.getPermissions();
|
||||
String playerName = event.getPlayer().getName();
|
||||
boolean hasPermission = perms.playerHas(playerName, "harvest", true);
|
||||
if(!hasPermission){
|
||||
event.setCancelled(true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user