remove ClaimsMode.Creative

This commit is contained in:
destro174 2022-02-19 20:40:52 +01:00
parent 1d9b5ed1f4
commit 2c8121dd2c
5 changed files with 5 additions and 44 deletions

View File

@ -3,6 +3,5 @@ package me.ryanhamshire.GriefPrevention;
public enum ClaimsMode
{
Survival,
Creative,
Disabled
}

View File

@ -928,12 +928,6 @@ public abstract class DataStore
smally = sanitizeClaimDepth(parent, smally);
}
//creative mode claims always go to bedrock
if (GriefPrevention.instance.config_claims_worldModes.get(world) == ClaimsMode.Creative)
{
smally = world.getMinHeight();
}
//create a new claim instance (but don't save it, yet)
Claim newClaim = new Claim(
new Location(world, smallx, smally, smallz),

View File

@ -48,10 +48,7 @@ class EntityCleanupTask implements Runnable
ArrayList<World> worlds = new ArrayList<>();
for (World world : GriefPrevention.instance.getServer().getWorlds())
{
if (GriefPrevention.instance.config_claims_worldModes.get(world) == ClaimsMode.Creative)
{
worlds.add(world);
}
}
for (World world : worlds)

View File

@ -232,13 +232,6 @@ public class EntityEventHandler implements Listener
//if did not fall straight down
if (originalLocation.getBlockX() != newLocation.getBlockX() || originalLocation.getBlockZ() != newLocation.getBlockZ())
{
//in creative mode worlds, never form the block
if (GriefPrevention.instance.config_claims_worldModes.get(newLocation.getWorld()) == ClaimsMode.Creative)
{
event.setCancelled(true);
entity.remove();
return;
}
//in other worlds, if landing in land claim, only allow if source was also in the land claim
Claim claim = this.dataStore.getClaimAt(newLocation, false, null);

View File

@ -460,24 +460,18 @@ public class GriefPrevention extends JavaPlugin
if (claimsMode != null)
{
this.config_claims_worldModes.put(world, claimsMode);
if (claimsMode == ClaimsMode.Creative) this.config_creativeWorldsExist = true;
continue;
}
else
{
GriefPrevention.AddLogEntry("Error: Invalid claim mode \"" + configSetting + "\". Options are Survival, Creative, and Disabled.");
this.config_claims_worldModes.put(world, ClaimsMode.Creative);
GriefPrevention.AddLogEntry("Error: Invalid claim mode \"" + configSetting + "\". Options are Survival and Disabled.");
this.config_claims_worldModes.put(world, ClaimsMode.Disabled);
this.config_creativeWorldsExist = true;
}
}
//was it specified in a deprecated config node?
if (deprecated_creativeClaimsEnabledWorldNames.contains(world.getName()))
{
this.config_claims_worldModes.put(world, ClaimsMode.Creative);
this.config_creativeWorldsExist = true;
}
else if (deprecated_claimsEnabledWorldNames.contains(world.getName()))
if (deprecated_claimsEnabledWorldNames.contains(world.getName()))
{
this.config_claims_worldModes.put(world, ClaimsMode.Survival);
}
@ -487,18 +481,6 @@ public class GriefPrevention extends JavaPlugin
{
this.config_claims_worldModes.put(world, ClaimsMode.Survival);
}
else if (world.getName().toLowerCase().contains("creative"))
{
this.config_claims_worldModes.put(world, ClaimsMode.Creative);
this.config_creativeWorldsExist = true;
}
//decide a default based on server type and world type
else if (this.getServer().getDefaultGameMode() == GameMode.CREATIVE)
{
this.config_claims_worldModes.put(world, ClaimsMode.Creative);
this.config_creativeWorldsExist = true;
}
else if (world.getEnvironment() == Environment.NORMAL)
{
this.config_claims_worldModes.put(world, ClaimsMode.Survival);
@ -881,10 +863,6 @@ public class GriefPrevention extends JavaPlugin
{
return ClaimsMode.Survival;
}
else if (configSetting.equalsIgnoreCase("Creative"))
{
return ClaimsMode.Creative;
}
else if (configSetting.equalsIgnoreCase("Disabled"))
{
return ClaimsMode.Disabled;
@ -3253,7 +3231,7 @@ public class GriefPrevention extends JavaPlugin
{
if (!this.config_creativeWorldsExist) return false;
return this.config_claims_worldModes.get((location.getWorld())) == ClaimsMode.Creative;
return false;
}
public String allowBuild(Player player, Location location)