Fix for null faction home location, added "factions.adminBypass" permission which will allow players with that permission to bypass the building/destruction and usage limitations inside faction territory.
This commit is contained in:
parent
35e59f3c32
commit
7ffc4962b8
@ -214,6 +214,10 @@ public class Factions extends JavaPlugin {
|
|||||||
return hasPerm(sender, "factions.manageSafeZone", true);
|
return hasPerm(sender, "factions.manageSafeZone", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean hasPermAdminBypass(CommandSender sender) {
|
||||||
|
return hasPerm(sender, "factions.adminBypass", true);
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean hasPerm(CommandSender sender, String permNode, boolean fallbackOnlyOp) {
|
private static boolean hasPerm(CommandSender sender, String permNode, boolean fallbackOnlyOp) {
|
||||||
if (Factions.Permissions == null || ! (sender instanceof Player)) {
|
if (Factions.Permissions == null || ! (sender instanceof Player)) {
|
||||||
return fallbackOnlyOp == false || sender.isOp();
|
return fallbackOnlyOp == false || sender.isOp();
|
||||||
|
@ -25,6 +25,9 @@ public class MyLocationTypeAdapter implements JsonDeserializer<Location>, JsonSe
|
|||||||
public Location deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
public Location deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||||
JsonObject obj = json.getAsJsonObject();
|
JsonObject obj = json.getAsJsonObject();
|
||||||
|
|
||||||
|
if (obj.isJsonNull() || obj.get(WORLD).isJsonNull())
|
||||||
|
return null;
|
||||||
|
|
||||||
World world = Factions.instance.getServer().getWorld(obj.get(WORLD).getAsString());
|
World world = Factions.instance.getServer().getWorld(obj.get(WORLD).getAsString());
|
||||||
double x = obj.get(X).getAsDouble();
|
double x = obj.get(X).getAsDouble();
|
||||||
double y = obj.get(Y).getAsDouble();
|
double y = obj.get(Y).getAsDouble();
|
||||||
|
@ -53,6 +53,11 @@ public class FactionsBlockListener extends BlockListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean playerCanBuildDestroyBlock(Player player, Block block, String action) {
|
public boolean playerCanBuildDestroyBlock(Player player, Block block, String action) {
|
||||||
|
|
||||||
|
if (Factions.hasPermAdminBypass(player)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Faction otherFaction = Board.getFactionAt(new FLocation(block));
|
Faction otherFaction = Board.getFactionAt(new FLocation(block));
|
||||||
|
|
||||||
if (otherFaction.isNone()) {
|
if (otherFaction.isNone()) {
|
||||||
|
@ -159,6 +159,10 @@ public class FactionsPlayerListener extends PlayerListener{
|
|||||||
|
|
||||||
public boolean playerCanUseItemHere(Player player, Block block, Material material) {
|
public boolean playerCanUseItemHere(Player player, Block block, Material material) {
|
||||||
|
|
||||||
|
if (Factions.hasPermAdminBypass(player)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if ( ! Conf.territoryDenyUseageMaterials.contains(material)) {
|
if ( ! Conf.territoryDenyUseageMaterials.contains(material)) {
|
||||||
return true; // Item isn't one we're preventing.
|
return true; // Item isn't one we're preventing.
|
||||||
}
|
}
|
||||||
@ -191,6 +195,11 @@ public class FactionsPlayerListener extends PlayerListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean canPlayerUseRightclickBlock(Player player, Block block) {
|
public boolean canPlayerUseRightclickBlock(Player player, Block block) {
|
||||||
|
|
||||||
|
if (Factions.hasPermAdminBypass(player)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Material material = block.getType();
|
Material material = block.getType();
|
||||||
|
|
||||||
// We only care about some material types.
|
// We only care about some material types.
|
||||||
|
Loading…
Reference in New Issue
Block a user