remove mobspawn config. set mobspawn permission in global to false
This commit is contained in:
parent
c3e341bbbb
commit
8fd8560723
@ -67,8 +67,8 @@ public class PermissionRegistry {
|
||||
public static ClaimPermission DROP = register(new ClaimPermission("DROP", () -> new ItemStack(Items.BOWL), true, "Allow the drop of items"));
|
||||
public static ClaimPermission PICKUP = register(new ClaimPermission("PICKUP", () -> new ItemStack(Items.BRICK), true, "Allow the pickup of items"));
|
||||
public static ClaimPermission FLIGHT = register(new ClaimPermission("FLIGHT", () -> new ItemStack(Items.FEATHER), true, "Allow non creative flight"));
|
||||
|
||||
public static ClaimPermission CANSTAY = register(new ClaimPermission("CANSTAY", () -> new ItemStack(Items.PAPER), true, "Allow player to enter your claim"));
|
||||
|
||||
public static ClaimPermission HURTPLAYER = global(new ClaimPermission("HURTPLAYER", () -> new ItemStack(Items.DIAMOND_SWORD), "Permission to hurt other players"));
|
||||
public static ClaimPermission EXPLOSIONS = global(new ClaimPermission("EXPLOSIONS", () -> new ItemStack(Items.TNT), "Toggle explosions in claim"));
|
||||
public static ClaimPermission WITHER = global(new ClaimPermission("WITHER", () -> new ItemStack(Items.WITHER_SKELETON_SKULL), "Toggle wither breaking blocks in claim"));
|
||||
|
@ -38,7 +38,6 @@ public class Config {
|
||||
|
||||
public String[] blacklistedWorlds = new String[0];
|
||||
public boolean worldWhitelist;
|
||||
public boolean allowMobSpawnToggle;
|
||||
|
||||
public Item claimingItem = Items.GOLDEN_HOE;
|
||||
public Item inspectionItem = Items.STICK;
|
||||
@ -71,6 +70,7 @@ public class Config {
|
||||
private final Map<String, Map<ClaimPermission, Boolean>> globalDefaultPerms = createHashMap(map -> {
|
||||
map.put("*", createHashMap(perms -> {
|
||||
perms.put(PermissionRegistry.FLIGHT, true);
|
||||
perms.put(PermissionRegistry.MOBSPAWN, false);
|
||||
}));
|
||||
});
|
||||
|
||||
@ -109,7 +109,6 @@ public class Config {
|
||||
for (int i = 0; i < arr.size(); i++)
|
||||
this.blacklistedWorlds[i] = arr.get(i).getAsString();
|
||||
this.worldWhitelist = ConfigHandler.fromJson(obj, "worldWhitelist", this.worldWhitelist);
|
||||
this.allowMobSpawnToggle = ConfigHandler.fromJson(obj, "allowMobSpawnToggle", false);
|
||||
if (obj.has("claimingItem"))
|
||||
this.claimingItem = Registry.ITEM.get(new Identifier((obj.get("claimingItem").getAsString())));
|
||||
if (obj.has("inspectionItem"))
|
||||
@ -172,7 +171,6 @@ public class Config {
|
||||
arr.add(blacklistedWorld);
|
||||
obj.add("blacklistedWorlds", arr);
|
||||
obj.addProperty("worldWhitelist", this.worldWhitelist);
|
||||
obj.addProperty("allowMobSpawnToggle", this.allowMobSpawnToggle);
|
||||
obj.addProperty("claimingItem", Registry.ITEM.getId(this.claimingItem).toString());
|
||||
obj.addProperty("inspectionItem", Registry.ITEM.getId(this.inspectionItem).toString());
|
||||
obj.addProperty("claimDisplayTime", this.claimDisplayTime);
|
||||
@ -208,8 +206,6 @@ public class Config {
|
||||
}
|
||||
|
||||
public Boolean getGlobal(ServerWorld world, ClaimPermission perm) {
|
||||
if (perm == PermissionRegistry.MOBSPAWN && !this.allowMobSpawnToggle)
|
||||
return Boolean.FALSE;
|
||||
//Update permission map if not done already
|
||||
Map<ClaimPermission, Boolean> allMap = ConfigHandler.config.globalDefaultPerms.get("*");
|
||||
if (allMap != null) {
|
||||
|
@ -72,8 +72,6 @@ public class WorldEvents {
|
||||
}
|
||||
|
||||
public static boolean preventMobSpawn(ServerWorld world, MobEntity entity) {
|
||||
if (!ConfigHandler.config.allowMobSpawnToggle)
|
||||
return false;
|
||||
IPermissionContainer claim = ClaimStorage.get(world).getForPermissionCheck(entity.getBlockPos());
|
||||
if (entity.getType().getSpawnGroup() == SpawnGroup.MONSTER)
|
||||
return claim.canInteract(null, PermissionRegistry.MOBSPAWN, entity.getBlockPos());
|
||||
|
Loading…
x
Reference in New Issue
Block a user