these changes are sometimes not getting exported or something

This commit is contained in:
RoboMWM 2020-06-08 23:15:52 -07:00
parent 0153fa6896
commit 732fa2e015
22 changed files with 314 additions and 157 deletions

View File

@ -90,7 +90,7 @@ ij_java_doc_keep_invalid_tags = true
ij_java_doc_param_description_on_new_line = false ij_java_doc_param_description_on_new_line = false
ij_java_doc_preserve_line_breaks = false ij_java_doc_preserve_line_breaks = false
ij_java_doc_use_throws_not_exception_tag = false ij_java_doc_use_throws_not_exception_tag = false
ij_java_else_on_new_line = false ij_java_else_on_new_line = true
ij_java_enum_constants_wrap = off ij_java_enum_constants_wrap = off
ij_java_extends_keyword_wrap = off ij_java_extends_keyword_wrap = off
ij_java_extends_list_wrap = off ij_java_extends_list_wrap = off

View File

@ -195,7 +195,8 @@ public class BlockEventHandler implements Listener
if (GriefPrevention.instance.pvpRulesApply(world)) if (GriefPrevention.instance.pvpRulesApply(world))
{ {
return GriefPrevention.instance.config_pvp_allowFireNearPlayers; return GriefPrevention.instance.config_pvp_allowFireNearPlayers;
} else }
else
{ {
return GriefPrevention.instance.config_pvp_allowFireNearPlayers_NonPvp; return GriefPrevention.instance.config_pvp_allowFireNearPlayers_NonPvp;
} }

View File

@ -469,10 +469,12 @@ public class Claim
if (!breakable) if (!breakable)
{ {
return GriefPrevention.instance.dataStore.getMessage(Messages.NonSiegeMaterial); return GriefPrevention.instance.dataStore.getMessage(Messages.NonSiegeMaterial);
} else if (player.getUniqueId().equals(this.ownerID)) }
else if (player.getUniqueId().equals(this.ownerID))
{ {
return GriefPrevention.instance.dataStore.getMessage(Messages.NoOwnerBuildUnderSiege); return GriefPrevention.instance.dataStore.getMessage(Messages.NoOwnerBuildUnderSiege);
} else }
else
{ {
return null; return null;
} }
@ -664,10 +666,12 @@ public class Claim
if (entry.getValue() == ClaimPermission.Build) if (entry.getValue() == ClaimPermission.Build)
{ {
builders.add(entry.getKey()); builders.add(entry.getKey());
} else if (entry.getValue() == ClaimPermission.Inventory) }
else if (entry.getValue() == ClaimPermission.Inventory)
{ {
containers.add(entry.getKey()); containers.add(entry.getKey());
} else }
else
{ {
accessors.add(entry.getKey()); accessors.add(entry.getKey());
} }
@ -918,7 +922,8 @@ public class Claim
if (block.getType() == Material.CHEST && !creativeMode) if (block.getType() == Material.CHEST && !creativeMode)
{ {
score += 10; score += 10;
} else }
else
{ {
score += .5; score += .5;
} }
@ -933,10 +938,12 @@ public class Claim
if (block.getType() == Material.CHEST && !creativeMode) if (block.getType() == Material.CHEST && !creativeMode)
{ {
score += 10; score += 10;
} else if (creativeMode && (block.getType() == Material.LAVA)) }
else if (creativeMode && (block.getType() == Material.LAVA))
{ {
score -= 10; score -= 10;
} else }
else
{ {
score += 1; score += 1;
} }

View File

@ -105,7 +105,8 @@ class CleanupUnusedClaimTask implements Runnable
} }
} }
} }
} else if (GriefPrevention.instance.config_claims_unusedClaimExpirationDays > 0 && GriefPrevention.instance.creativeRulesApply(claim.getLesserBoundaryCorner())) }
else if (GriefPrevention.instance.config_claims_unusedClaimExpirationDays > 0 && GriefPrevention.instance.creativeRulesApply(claim.getLesserBoundaryCorner()))
{ {
//avoid scanning large claims and administrative claims //avoid scanning large claims and administrative claims
if (claim.isAdminClaim() || claim.getWidth() > 25 || claim.getHeight() > 25) return; if (claim.isAdminClaim() || claim.getWidth() > 25 || claim.getHeight() > 25) return;

View File

@ -117,7 +117,8 @@ public abstract class DataStore
if (this.currentSchemaVersion >= 0) if (this.currentSchemaVersion >= 0)
{ {
return this.currentSchemaVersion; return this.currentSchemaVersion;
} else }
else
{ {
this.currentSchemaVersion = this.getSchemaVersionFromStorage(); this.currentSchemaVersion = this.getSchemaVersionFromStorage();
return this.currentSchemaVersion; return this.currentSchemaVersion;
@ -776,7 +777,8 @@ public abstract class DataStore
if (chunkClaims != null) if (chunkClaims != null)
{ {
return Collections.unmodifiableCollection(chunkClaims); return Collections.unmodifiableCollection(chunkClaims);
} else }
else
{ {
return Collections.unmodifiableCollection(new ArrayList<Claim>()); return Collections.unmodifiableCollection(new ArrayList<Claim>());
} }
@ -827,7 +829,8 @@ public abstract class DataStore
{ {
smallx = x1; smallx = x1;
bigx = x2; bigx = x2;
} else }
else
{ {
smallx = x2; smallx = x2;
bigx = x1; bigx = x1;
@ -837,7 +840,8 @@ public abstract class DataStore
{ {
smally = y1; smally = y1;
bigy = y2; bigy = y2;
} else }
else
{ {
smally = y2; smally = y2;
bigy = y1; bigy = y1;
@ -847,7 +851,8 @@ public abstract class DataStore
{ {
smallz = z1; smallz = z1;
bigz = z2; bigz = z2;
} else }
else
{ {
smallz = z2; smallz = z2;
bigz = z1; bigz = z1;
@ -889,7 +894,8 @@ public abstract class DataStore
if (newClaim.parent != null) if (newClaim.parent != null)
{ {
claimsToCheck = newClaim.parent.children; claimsToCheck = newClaim.parent.children;
} else }
else
{ {
claimsToCheck = this.claims; claimsToCheck = this.claims;
} }
@ -1058,16 +1064,19 @@ public abstract class DataStore
if (siegeData.attacker.getName().equals(loserName)) if (siegeData.attacker.getName().equals(loserName))
{ {
winnerName = siegeData.defender.getName(); winnerName = siegeData.defender.getName();
} else }
else
{ {
winnerName = siegeData.attacker.getName(); winnerName = siegeData.attacker.getName();
} }
} else if (winnerName != null && loserName == null) }
else if (winnerName != null && loserName == null)
{ {
if (siegeData.attacker.getName().equals(winnerName)) if (siegeData.attacker.getName().equals(winnerName))
{ {
loserName = siegeData.defender.getName(); loserName = siegeData.defender.getName();
} else }
else
{ {
loserName = siegeData.attacker.getName(); loserName = siegeData.attacker.getName();
} }
@ -1370,7 +1379,8 @@ public abstract class DataStore
if (ownerID == player.getUniqueId()) if (ownerID == player.getUniqueId())
{ {
claimBlocksRemaining = playerData.getRemainingClaimBlocks(); claimBlocksRemaining = playerData.getRemainingClaimBlocks();
} else }
else
{ {
PlayerData ownerData = this.getPlayerData(ownerID); PlayerData ownerData = this.getPlayerData(ownerID);
claimBlocksRemaining = ownerData.getRemainingClaimBlocks(); claimBlocksRemaining = ownerData.getRemainingClaimBlocks();
@ -1411,7 +1421,8 @@ public abstract class DataStore
//clean up //clean up
playerData.claimResizing = null; playerData.claimResizing = null;
playerData.lastShovelLocation = null; playerData.lastShovelLocation = null;
} else }
else
{ {
if (result.claim != null) if (result.claim != null)
{ {
@ -1421,7 +1432,8 @@ public abstract class DataStore
//show the player the conflicting claim //show the player the conflicting claim
Visualization visualization = Visualization.FromClaim(result.claim, player.getEyeLocation().getBlockY(), VisualizationType.ErrorClaim, player.getLocation()); Visualization visualization = Visualization.FromClaim(result.claim, player.getEyeLocation().getBlockY(), VisualizationType.ErrorClaim, player.getLocation());
Visualization.Apply(player, visualization); Visualization.Apply(player, visualization);
} else }
else
{ {
GriefPrevention.sendMessage(player, TextMode.Err, Messages.ResizeFailOverlapRegion); GriefPrevention.sendMessage(player, TextMode.Err, Messages.ResizeFailOverlapRegion);
} }
@ -1434,10 +1446,12 @@ public abstract class DataStore
if (player.hasPermission("griefprevention.adminclaims") && player.hasPermission("griefprevention.adjustclaimblocks")) if (player.hasPermission("griefprevention.adminclaims") && player.hasPermission("griefprevention.adjustclaimblocks"))
{ {
GriefPrevention.sendMessage(player, TextMode.Info, Messages.AdvertiseACandACB); GriefPrevention.sendMessage(player, TextMode.Info, Messages.AdvertiseACandACB);
} else if (player.hasPermission("griefprevention.adminclaims")) }
else if (player.hasPermission("griefprevention.adminclaims"))
{ {
GriefPrevention.sendMessage(player, TextMode.Info, Messages.AdvertiseAdminClaims); GriefPrevention.sendMessage(player, TextMode.Info, Messages.AdvertiseAdminClaims);
} else if (player.hasPermission("griefprevention.adjustclaimblocks")) }
else if (player.hasPermission("griefprevention.adjustclaimblocks"))
{ {
GriefPrevention.sendMessage(player, TextMode.Info, Messages.AdvertiseACB); GriefPrevention.sendMessage(player, TextMode.Info, Messages.AdvertiseACB);
} }

View File

@ -303,7 +303,8 @@ public class DatabaseDataStore extends DataStore
{ {
GriefPrevention.AddLogEntry("Failed to load a claim (ID:" + claimID.toString() + ") because its world isn't loaded (yet?). Please delete the claim or contact the GriefPrevention developer with information about which plugin(s) you're using to load or create worlds. " + lesserCornerString); GriefPrevention.AddLogEntry("Failed to load a claim (ID:" + claimID.toString() + ") because its world isn't loaded (yet?). Please delete the claim or contact the GriefPrevention developer with information about which plugin(s) you're using to load or create worlds. " + lesserCornerString);
continue; continue;
} else }
else
{ {
throw e; throw e;
} }
@ -314,7 +315,8 @@ public class DatabaseDataStore extends DataStore
if (ownerName.isEmpty() || ownerName.startsWith("--")) if (ownerName.isEmpty() || ownerName.startsWith("--"))
{ {
ownerID = null; //administrative land claim or subdivision ownerID = null; //administrative land claim or subdivision
} else if (this.getSchemaVersion() < 1) }
else if (this.getSchemaVersion() < 1)
{ {
try try
{ {
@ -325,7 +327,8 @@ public class DatabaseDataStore extends DataStore
GriefPrevention.AddLogEntry("This owner name did not convert to a UUID: " + ownerName + "."); GriefPrevention.AddLogEntry("This owner name did not convert to a UUID: " + ownerName + ".");
GriefPrevention.AddLogEntry(" Converted land claim to administrative @ " + lesserBoundaryCorner.toString()); GriefPrevention.AddLogEntry(" Converted land claim to administrative @ " + lesserBoundaryCorner.toString());
} }
} else }
else
{ {
try try
{ {
@ -358,11 +361,13 @@ public class DatabaseDataStore extends DataStore
if (removeClaim) if (removeClaim)
{ {
claimsToRemove.add(claim); claimsToRemove.add(claim);
} else if (parentId == -1) }
else if (parentId == -1)
{ {
//top level claim //top level claim
this.addClaim(claim, false); this.addClaim(claim, false);
} else }
else
{ {
//subdivision //subdivision
subdivisionsToLoad.add(claim); subdivisionsToLoad.add(claim);

View File

@ -73,7 +73,8 @@ class EntityCleanupTask implements Runnable
{ {
Boat boat = (Boat) entity; Boat boat = (Boat) entity;
if (boat.isEmpty()) remove = true; if (boat.isEmpty()) remove = true;
} else if (entity instanceof Vehicle) }
else if (entity instanceof Vehicle)
{ {
Vehicle vehicle = (Vehicle) entity; Vehicle vehicle = (Vehicle) entity;
@ -104,7 +105,8 @@ class EntityCleanupTask implements Runnable
if (claim != null) if (claim != null)
{ {
cachedClaim = claim; cachedClaim = claim;
} else }
else
{ {
remove = true; remove = true;
} }

View File

@ -137,13 +137,16 @@ public class EntityEventHandler implements Listener
if (!GriefPrevention.instance.config_endermenMoveBlocks && event.getEntityType() == EntityType.ENDERMAN) if (!GriefPrevention.instance.config_endermenMoveBlocks && event.getEntityType() == EntityType.ENDERMAN)
{ {
event.setCancelled(true); event.setCancelled(true);
} else if (!GriefPrevention.instance.config_silverfishBreakBlocks && event.getEntityType() == EntityType.SILVERFISH) }
else if (!GriefPrevention.instance.config_silverfishBreakBlocks && event.getEntityType() == EntityType.SILVERFISH)
{ {
event.setCancelled(true); event.setCancelled(true);
} else if (!GriefPrevention.instance.config_rabbitsEatCrops && event.getEntityType() == EntityType.RABBIT) }
else if (!GriefPrevention.instance.config_rabbitsEatCrops && event.getEntityType() == EntityType.RABBIT)
{ {
event.setCancelled(true); event.setCancelled(true);
} else if (GriefPrevention.instance.config_claims_worldModes.get(event.getBlock().getWorld()) != ClaimsMode.Disabled) }
else if (GriefPrevention.instance.config_claims_worldModes.get(event.getBlock().getWorld()) != ClaimsMode.Disabled)
{ {
if (event.getEntityType() == EntityType.WITHER) if (event.getEntityType() == EntityType.WITHER)
{ {
@ -152,7 +155,8 @@ public class EntityEventHandler implements Listener
{ {
event.setCancelled(true); event.setCancelled(true);
} }
} else if (!GriefPrevention.instance.config_claims_ravagersBreakBlocks && event.getEntityType() == EntityType.RAVAGER) }
else if (!GriefPrevention.instance.config_claims_ravagersBreakBlocks && event.getEntityType() == EntityType.RAVAGER)
{ {
event.setCancelled(true); event.setCancelled(true);
} }
@ -163,7 +167,8 @@ public class EntityEventHandler implements Listener
if (event.getEntityType() != EntityType.PLAYER) if (event.getEntityType() != EntityType.PLAYER)
{ {
event.setCancelled(true); event.setCancelled(true);
} else }
else
{ {
Player player = (Player) event.getEntity(); Player player = (Player) event.getEntity();
Block block = event.getBlock(); Block block = event.getBlock();
@ -276,7 +281,8 @@ public class EntityEventHandler implements Listener
if (!GriefPrevention.instance.config_creaturesTrampleCrops) if (!GriefPrevention.instance.config_creaturesTrampleCrops)
{ {
event.setCancelled(true); event.setCancelled(true);
} else }
else
{ {
Entity rider = event.getEntity().getPassenger(); Entity rider = event.getEntity().getPassenger();
if (rider != null && rider.getType() == EntityType.PLAYER) if (rider != null && rider.getType() == EntityType.PLAYER)
@ -745,14 +751,16 @@ public class EntityEventHandler implements Listener
if (damageSource.getType() == EntityType.PLAYER) if (damageSource.getType() == EntityType.PLAYER)
{ {
attacker = (Player) damageSource; attacker = (Player) damageSource;
} else if (damageSource instanceof Projectile) }
else if (damageSource instanceof Projectile)
{ {
arrow = (Projectile) damageSource; arrow = (Projectile) damageSource;
if (arrow.getShooter() instanceof Player) if (arrow.getShooter() instanceof Player)
{ {
attacker = (Player) arrow.getShooter(); attacker = (Player) arrow.getShooter();
} }
} else if (subEvent.getDamager() instanceof Firework) }
else if (subEvent.getDamager() instanceof Firework)
{ {
damageSource = subEvent.getDamager(); damageSource = subEvent.getDamager();
if (damageSource.hasMetadata("GP_FIREWORK")) if (damageSource.hasMetadata("GP_FIREWORK"))
@ -1182,14 +1190,16 @@ public class EntityEventHandler implements Listener
if (damageSource.getType() == EntityType.PLAYER) if (damageSource.getType() == EntityType.PLAYER)
{ {
attacker = (Player) damageSource; attacker = (Player) damageSource;
} else if (damageSource instanceof Projectile) }
else if (damageSource instanceof Projectile)
{ {
arrow = (Projectile) damageSource; arrow = (Projectile) damageSource;
if (arrow.getShooter() instanceof Player) if (arrow.getShooter() instanceof Player)
{ {
attacker = (Player) arrow.getShooter(); attacker = (Player) arrow.getShooter();
} }
} else if (damageSource instanceof Firework) }
else if (damageSource instanceof Firework)
{ {
if (damageSource.hasMetadata("GP_FIREWORK")) if (damageSource.hasMetadata("GP_FIREWORK"))
{ {
@ -1244,14 +1254,16 @@ public class EntityEventHandler implements Listener
if (damageSource.getType() == EntityType.PLAYER) if (damageSource.getType() == EntityType.PLAYER)
{ {
attacker = (Player) damageSource; attacker = (Player) damageSource;
} else if (damageSource instanceof Projectile) }
else if (damageSource instanceof Projectile)
{ {
Projectile arrow = (Projectile) damageSource; Projectile arrow = (Projectile) damageSource;
if (arrow.getShooter() instanceof Player) if (arrow.getShooter() instanceof Player)
{ {
attacker = (Player) arrow.getShooter(); attacker = (Player) arrow.getShooter();
} }
} else if (damageSource instanceof Firework) }
else if (damageSource instanceof Firework)
{ {
if (damageSource.hasMetadata("GP_FIREWORK")) if (damageSource.hasMetadata("GP_FIREWORK"))
{ {

View File

@ -62,7 +62,8 @@ class EquipShovelProcessingTask implements Runnable
if (GriefPrevention.instance.creativeRulesApply(player.getLocation())) if (GriefPrevention.instance.creativeRulesApply(player.getLocation()))
{ {
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.CreativeBasicsVideo2, DataStore.CREATIVE_VIDEO_URL); GriefPrevention.sendMessage(player, TextMode.Instr, Messages.CreativeBasicsVideo2, DataStore.CREATIVE_VIDEO_URL);
} else if (GriefPrevention.instance.claimsEnabledForWorld(player.getLocation().getWorld())) }
else if (GriefPrevention.instance.claimsEnabledForWorld(player.getLocation().getWorld()))
{ {
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.SurvivalBasicsVideo2, DataStore.SURVIVAL_VIDEO_URL); GriefPrevention.sendMessage(player, TextMode.Instr, Messages.SurvivalBasicsVideo2, DataStore.SURVIVAL_VIDEO_URL);
} }

View File

@ -206,7 +206,8 @@ public class FlatFileDataStore extends DataStore
if (this.getSchemaVersion() <= 1) if (this.getSchemaVersion() <= 1)
{ {
this.loadClaimData_Legacy(files); this.loadClaimData_Legacy(files);
} else }
else
{ {
this.loadClaimData(files); this.loadClaimData(files);
} }
@ -283,7 +284,8 @@ public class FlatFileDataStore extends DataStore
if (ownerName.isEmpty() || ownerName.startsWith("--")) if (ownerName.isEmpty() || ownerName.startsWith("--"))
{ {
ownerID = null; //administrative land claim or subdivision ownerID = null; //administrative land claim or subdivision
} else if (this.getSchemaVersion() == 0) }
else if (this.getSchemaVersion() == 0)
{ {
try try
{ {
@ -294,7 +296,8 @@ public class FlatFileDataStore extends DataStore
GriefPrevention.AddLogEntry("Couldn't resolve this name to a UUID: " + ownerName + "."); GriefPrevention.AddLogEntry("Couldn't resolve this name to a UUID: " + ownerName + ".");
GriefPrevention.AddLogEntry(" Converted land claim to administrative @ " + lesserBoundaryCorner.toString()); GriefPrevention.AddLogEntry(" Converted land claim to administrative @ " + lesserBoundaryCorner.toString());
} }
} else }
else
{ {
try try
{ {
@ -370,7 +373,8 @@ public class FlatFileDataStore extends DataStore
GriefPrevention.AddLogEntry("Failed to load a claim " + files[i].getName() + " because its world isn't loaded (yet?). Please delete the claim file or contact the GriefPrevention developer with information about which plugin(s) you're using to load or create worlds. " + lesserCornerString); GriefPrevention.AddLogEntry("Failed to load a claim " + files[i].getName() + " because its world isn't loaded (yet?). Please delete the claim file or contact the GriefPrevention developer with information about which plugin(s) you're using to load or create worlds. " + lesserCornerString);
inStream.close(); inStream.close();
} else }
else
{ {
StringWriter errors = new StringWriter(); StringWriter errors = new StringWriter();
e.printStackTrace(new PrintWriter(errors)); e.printStackTrace(new PrintWriter(errors));
@ -431,7 +435,8 @@ public class FlatFileDataStore extends DataStore
if (out_parentID.size() == 0 || out_parentID.get(0) == -1) if (out_parentID.size() == 0 || out_parentID.get(0) == -1)
{ {
this.addClaim(claim, false); this.addClaim(claim, false);
} else }
else
{ {
orphans.put(claim, out_parentID.get(0)); orphans.put(claim, out_parentID.get(0));
} }
@ -443,7 +448,8 @@ public class FlatFileDataStore extends DataStore
if (e.getMessage() != null && e.getMessage().contains("World not found")) if (e.getMessage() != null && e.getMessage().contains("World not found"))
{ {
files[i].delete(); files[i].delete();
} else }
else
{ {
StringWriter errors = new StringWriter(); StringWriter errors = new StringWriter();
e.printStackTrace(new PrintWriter(errors)); e.printStackTrace(new PrintWriter(errors));
@ -897,7 +903,8 @@ public class FlatFileDataStore extends DataStore
catch (IOException exception) {} catch (IOException exception) {}
return schemaVersion; return schemaVersion;
} else }
else
{ {
this.updateSchemaVersionInStorage(0); this.updateSchemaVersionInStorage(0);
return 0; return 0;

View File

@ -475,7 +475,8 @@ public class GriefPrevention extends JavaPlugin
this.config_claims_worldModes.put(world, claimsMode); this.config_claims_worldModes.put(world, claimsMode);
if (claimsMode == ClaimsMode.Creative) this.config_creativeWorldsExist = true; if (claimsMode == ClaimsMode.Creative) this.config_creativeWorldsExist = true;
continue; continue;
} else }
else
{ {
GriefPrevention.AddLogEntry("Error: Invalid claim mode \"" + configSetting + "\". Options are Survival, Creative, and Disabled."); GriefPrevention.AddLogEntry("Error: Invalid claim mode \"" + configSetting + "\". Options are Survival, Creative, and Disabled.");
this.config_claims_worldModes.put(world, ClaimsMode.Creative); this.config_claims_worldModes.put(world, ClaimsMode.Creative);
@ -488,7 +489,8 @@ public class GriefPrevention extends JavaPlugin
{ {
this.config_claims_worldModes.put(world, ClaimsMode.Creative); this.config_claims_worldModes.put(world, ClaimsMode.Creative);
this.config_creativeWorldsExist = true; this.config_creativeWorldsExist = true;
} else if (deprecated_claimsEnabledWorldNames.contains(world.getName())) }
else if (deprecated_claimsEnabledWorldNames.contains(world.getName()))
{ {
this.config_claims_worldModes.put(world, ClaimsMode.Survival); this.config_claims_worldModes.put(world, ClaimsMode.Survival);
} }
@ -497,7 +499,8 @@ public class GriefPrevention extends JavaPlugin
else if (world.getName().toLowerCase().contains("survival")) else if (world.getName().toLowerCase().contains("survival"))
{ {
this.config_claims_worldModes.put(world, ClaimsMode.Survival); this.config_claims_worldModes.put(world, ClaimsMode.Survival);
} else if (world.getName().toLowerCase().contains("creative")) }
else if (world.getName().toLowerCase().contains("creative"))
{ {
this.config_claims_worldModes.put(world, ClaimsMode.Creative); this.config_claims_worldModes.put(world, ClaimsMode.Creative);
this.config_creativeWorldsExist = true; this.config_creativeWorldsExist = true;
@ -508,10 +511,12 @@ public class GriefPrevention extends JavaPlugin
{ {
this.config_claims_worldModes.put(world, ClaimsMode.Creative); this.config_claims_worldModes.put(world, ClaimsMode.Creative);
this.config_creativeWorldsExist = true; this.config_creativeWorldsExist = true;
} else if (world.getEnvironment() == Environment.NORMAL) }
else if (world.getEnvironment() == Environment.NORMAL)
{ {
this.config_claims_worldModes.put(world, ClaimsMode.Survival); this.config_claims_worldModes.put(world, ClaimsMode.Survival);
} else }
else
{ {
this.config_claims_worldModes.put(world, ClaimsMode.Disabled); this.config_claims_worldModes.put(world, ClaimsMode.Disabled);
} }
@ -688,7 +693,8 @@ public class GriefPrevention extends JavaPlugin
if (world == null) if (world == null)
{ {
AddLogEntry("Error: Siege Configuration: There's no world named \"" + worldName + "\". Please update your config.yml."); AddLogEntry("Error: Siege Configuration: There's no world named \"" + worldName + "\". Please update your config.yml.");
} else }
else
{ {
this.config_siege_enabledWorlds.add(world); this.config_siege_enabledWorlds.add(world);
} }
@ -755,7 +761,8 @@ public class GriefPrevention extends JavaPlugin
if (material == null) if (material == null)
{ {
GriefPrevention.AddLogEntry("Siege Configuration: Material not found: " + blockName + "."); GriefPrevention.AddLogEntry("Siege Configuration: Material not found: " + blockName + ".");
} else }
else
{ {
this.config_siege_blocks.add(material); this.config_siege_blocks.add(material);
} }
@ -975,16 +982,20 @@ public class GriefPrevention extends JavaPlugin
if (configSetting.equalsIgnoreCase("Survival")) if (configSetting.equalsIgnoreCase("Survival"))
{ {
return ClaimsMode.Survival; return ClaimsMode.Survival;
} else if (configSetting.equalsIgnoreCase("Creative")) }
else if (configSetting.equalsIgnoreCase("Creative"))
{ {
return ClaimsMode.Creative; return ClaimsMode.Creative;
} else if (configSetting.equalsIgnoreCase("Disabled")) }
else if (configSetting.equalsIgnoreCase("Disabled"))
{ {
return ClaimsMode.Disabled; return ClaimsMode.Disabled;
} else if (configSetting.equalsIgnoreCase("SurvivalRequiringClaims")) }
else if (configSetting.equalsIgnoreCase("SurvivalRequiringClaims"))
{ {
return ClaimsMode.SurvivalRequiringClaims; return ClaimsMode.SurvivalRequiringClaims;
} else }
else
{ {
return null; return null;
} }
@ -1061,7 +1072,8 @@ public class GriefPrevention extends JavaPlugin
{ {
GriefPrevention.sendMessage(player, TextMode.Err, Messages.MinimumRadius, String.valueOf(radius)); GriefPrevention.sendMessage(player, TextMode.Err, Messages.MinimumRadius, String.valueOf(radius));
return true; return true;
} else }
else
{ {
radius = specifiedRadius; radius = specifiedRadius;
} }
@ -1096,11 +1108,13 @@ public class GriefPrevention extends JavaPlugin
Visualization visualization = Visualization.FromClaim(result.claim, player.getEyeLocation().getBlockY(), VisualizationType.ErrorClaim, player.getLocation()); Visualization visualization = Visualization.FromClaim(result.claim, player.getEyeLocation().getBlockY(), VisualizationType.ErrorClaim, player.getLocation());
Visualization.Apply(player, visualization); Visualization.Apply(player, visualization);
} else }
else
{ {
GriefPrevention.sendMessage(player, TextMode.Err, Messages.CreateClaimFailOverlapRegion); GriefPrevention.sendMessage(player, TextMode.Err, Messages.CreateClaimFailOverlapRegion);
} }
} else }
else
{ {
GriefPrevention.sendMessage(player, TextMode.Success, Messages.CreateClaimSuccess); GriefPrevention.sendMessage(player, TextMode.Success, Messages.CreateClaimSuccess);
@ -1108,7 +1122,8 @@ public class GriefPrevention extends JavaPlugin
if (GriefPrevention.instance.creativeRulesApply(player.getLocation())) if (GriefPrevention.instance.creativeRulesApply(player.getLocation()))
{ {
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.CreativeBasicsVideo2, DataStore.CREATIVE_VIDEO_URL); GriefPrevention.sendMessage(player, TextMode.Instr, Messages.CreativeBasicsVideo2, DataStore.CREATIVE_VIDEO_URL);
} else if (GriefPrevention.instance.claimsEnabledForWorld(player.getLocation().getWorld())) }
else if (GriefPrevention.instance.claimsEnabledForWorld(player.getLocation().getWorld()))
{ {
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.SurvivalBasicsVideo2, DataStore.SURVIVAL_VIDEO_URL); GriefPrevention.sendMessage(player, TextMode.Instr, Messages.SurvivalBasicsVideo2, DataStore.SURVIVAL_VIDEO_URL);
} }
@ -1132,7 +1147,8 @@ public class GriefPrevention extends JavaPlugin
if (GriefPrevention.instance.creativeRulesApply(player.getLocation())) if (GriefPrevention.instance.creativeRulesApply(player.getLocation()))
{ {
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.CreativeBasicsVideo2, DataStore.CREATIVE_VIDEO_URL); GriefPrevention.sendMessage(player, TextMode.Instr, Messages.CreativeBasicsVideo2, DataStore.CREATIVE_VIDEO_URL);
} else if (GriefPrevention.instance.claimsEnabledForWorld(player.getLocation().getWorld())) }
else if (GriefPrevention.instance.claimsEnabledForWorld(player.getLocation().getWorld()))
{ {
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.SurvivalBasicsVideo2, DataStore.SURVIVAL_VIDEO_URL); GriefPrevention.sendMessage(player, TextMode.Instr, Messages.SurvivalBasicsVideo2, DataStore.SURVIVAL_VIDEO_URL);
} }
@ -1150,7 +1166,8 @@ public class GriefPrevention extends JavaPlugin
if (GriefPrevention.instance.creativeRulesApply(player.getLocation())) if (GriefPrevention.instance.creativeRulesApply(player.getLocation()))
{ {
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.CreativeBasicsVideo2, DataStore.CREATIVE_VIDEO_URL); GriefPrevention.sendMessage(player, TextMode.Instr, Messages.CreativeBasicsVideo2, DataStore.CREATIVE_VIDEO_URL);
} else if (GriefPrevention.instance.claimsEnabledForWorld(player.getLocation().getWorld())) }
else if (GriefPrevention.instance.claimsEnabledForWorld(player.getLocation().getWorld()))
{ {
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.SurvivalBasicsVideo2, DataStore.SURVIVAL_VIDEO_URL); GriefPrevention.sendMessage(player, TextMode.Instr, Messages.SurvivalBasicsVideo2, DataStore.SURVIVAL_VIDEO_URL);
} }
@ -1210,7 +1227,8 @@ public class GriefPrevention extends JavaPlugin
if (direction.getZ() > 0) if (direction.getZ() > 0)
{ {
newz2 += amount; //north newz2 += amount; //north
} else }
else
{ {
newz1 -= amount; //south newz1 -= amount; //south
} }
@ -1222,7 +1240,8 @@ public class GriefPrevention extends JavaPlugin
if (direction.getX() > 0) if (direction.getX() > 0)
{ {
newx2 += amount; //east newx2 += amount; //east
} else }
else
{ {
newx1 -= amount; //west newx1 -= amount; //west
} }
@ -1234,7 +1253,8 @@ public class GriefPrevention extends JavaPlugin
if (direction.getX() > 0) if (direction.getX() > 0)
{ {
newx2 += amount; newx2 += amount;
} else }
else
{ {
newx1 -= amount; newx1 -= amount;
} }
@ -1242,7 +1262,8 @@ public class GriefPrevention extends JavaPlugin
if (direction.getZ() > 0) if (direction.getZ() > 0)
{ {
newz2 += amount; newz2 += amount;
} else }
else
{ {
newz1 -= amount; newz1 -= amount;
} }
@ -1279,7 +1300,8 @@ public class GriefPrevention extends JavaPlugin
if (!playerData.ignoreClaims) if (!playerData.ignoreClaims)
{ {
GriefPrevention.sendMessage(player, TextMode.Success, Messages.RespectingClaims); GriefPrevention.sendMessage(player, TextMode.Success, Messages.RespectingClaims);
} else }
else
{ {
GriefPrevention.sendMessage(player, TextMode.Success, Messages.IgnoringClaims); GriefPrevention.sendMessage(player, TextMode.Success, Messages.IgnoringClaims);
} }
@ -1541,12 +1563,14 @@ public class GriefPrevention extends JavaPlugin
if (claim == null || claim.allowEdit(player) == null) if (claim == null || claim.allowEdit(player) == null)
{ {
clearPermissions = true; clearPermissions = true;
} else }
else
{ {
GriefPrevention.sendMessage(player, TextMode.Err, Messages.ClearPermsOwnerOnly); GriefPrevention.sendMessage(player, TextMode.Err, Messages.ClearPermsOwnerOnly);
return true; return true;
} }
} else }
else
{ {
//validate player argument or group argument //validate player argument or group argument
if (!args[0].startsWith("[") || !args[0].endsWith("]")) if (!args[0].startsWith("[") || !args[0].endsWith("]"))
@ -1616,7 +1640,8 @@ public class GriefPrevention extends JavaPlugin
if (!clearPermissions) if (!clearPermissions)
{ {
GriefPrevention.sendMessage(player, TextMode.Success, Messages.UntrustIndividualAllClaims, args[0]); GriefPrevention.sendMessage(player, TextMode.Success, Messages.UntrustIndividualAllClaims, args[0]);
} else }
else
{ {
GriefPrevention.sendMessage(player, TextMode.Success, Messages.UntrustEveryoneAllClaims); GriefPrevention.sendMessage(player, TextMode.Success, Messages.UntrustEveryoneAllClaims);
} }
@ -1627,7 +1652,8 @@ public class GriefPrevention extends JavaPlugin
{ {
GriefPrevention.sendMessage(player, TextMode.Err, Messages.NoPermissionTrust, claim.getOwnerName()); GriefPrevention.sendMessage(player, TextMode.Err, Messages.NoPermissionTrust, claim.getOwnerName());
return true; return true;
} else }
else
{ {
//if clearing all //if clearing all
if (clearPermissions) if (clearPermissions)
@ -1665,7 +1691,8 @@ public class GriefPrevention extends JavaPlugin
{ {
GriefPrevention.sendMessage(player, TextMode.Err, Messages.ManagersDontUntrustManagers, claim.getOwnerName()); GriefPrevention.sendMessage(player, TextMode.Err, Messages.ManagersDontUntrustManagers, claim.getOwnerName());
return true; return true;
} else }
else
{ {
//calling the event //calling the event
TrustChangedEvent event = new TrustChangedEvent(player, claim, null, false, idToDrop); TrustChangedEvent event = new TrustChangedEvent(player, claim, null, false, idToDrop);
@ -1753,7 +1780,8 @@ public class GriefPrevention extends JavaPlugin
{ {
claim.setSubclaimRestrictions(false); claim.setSubclaimRestrictions(false);
GriefPrevention.sendMessage(player, TextMode.Success, Messages.SubclaimUnrestricted); GriefPrevention.sendMessage(player, TextMode.Success, Messages.SubclaimUnrestricted);
} else }
else
{ {
claim.setSubclaimRestrictions(true); claim.setSubclaimRestrictions(true);
GriefPrevention.sendMessage(player, TextMode.Success, Messages.SubclaimRestricted); GriefPrevention.sendMessage(player, TextMode.Success, Messages.SubclaimRestricted);
@ -1790,7 +1818,8 @@ public class GriefPrevention extends JavaPlugin
{ {
GriefPrevention.sendMessage(player, TextMode.Info, Messages.BlockPurchaseCost, String.valueOf(GriefPrevention.instance.config_economy_claimBlocksPurchaseCost), String.valueOf(GriefPrevention.economy.getBalance(player.getName()))); GriefPrevention.sendMessage(player, TextMode.Info, Messages.BlockPurchaseCost, String.valueOf(GriefPrevention.instance.config_economy_claimBlocksPurchaseCost), String.valueOf(GriefPrevention.economy.getBalance(player.getName())));
return false; return false;
} else }
else
{ {
PlayerData playerData = this.dataStore.getPlayerData(player.getUniqueId()); PlayerData playerData = this.dataStore.getPlayerData(player.getUniqueId());
@ -1962,7 +1991,8 @@ public class GriefPrevention extends JavaPlugin
if (claim == null) if (claim == null)
{ {
GriefPrevention.sendMessage(player, TextMode.Err, Messages.DeleteClaimMissing); GriefPrevention.sendMessage(player, TextMode.Err, Messages.DeleteClaimMissing);
} else }
else
{ {
//deleting an admin claim additionally requires the adminclaims permission //deleting an admin claim additionally requires the adminclaims permission
if (!claim.isAdminClaim() || player.hasPermission("griefprevention.adminclaims")) if (!claim.isAdminClaim() || player.hasPermission("griefprevention.adminclaims"))
@ -1972,7 +2002,8 @@ public class GriefPrevention extends JavaPlugin
{ {
GriefPrevention.sendMessage(player, TextMode.Warn, Messages.DeletionSubdivisionWarning); GriefPrevention.sendMessage(player, TextMode.Warn, Messages.DeletionSubdivisionWarning);
playerData.warnedAboutMajorDeletion = true; playerData.warnedAboutMajorDeletion = true;
} else }
else
{ {
claim.removeSurfaceFluids(null); claim.removeSurfaceFluids(null);
this.dataStore.deleteClaim(claim, true, true); this.dataStore.deleteClaim(claim, true, true);
@ -1991,14 +2022,16 @@ public class GriefPrevention extends JavaPlugin
playerData.warnedAboutMajorDeletion = false; playerData.warnedAboutMajorDeletion = false;
} }
} else }
else
{ {
GriefPrevention.sendMessage(player, TextMode.Err, Messages.CantDeleteAdminClaim); GriefPrevention.sendMessage(player, TextMode.Err, Messages.CantDeleteAdminClaim);
} }
} }
return true; return true;
} else if (cmd.getName().equalsIgnoreCase("claimexplosions") && player != null) }
else if (cmd.getName().equalsIgnoreCase("claimexplosions") && player != null)
{ {
//determine which claim the player is standing in //determine which claim the player is standing in
Claim claim = this.dataStore.getClaimAt(player.getLocation(), true /*ignore height*/, null); Claim claim = this.dataStore.getClaimAt(player.getLocation(), true /*ignore height*/, null);
@ -2006,7 +2039,8 @@ public class GriefPrevention extends JavaPlugin
if (claim == null) if (claim == null)
{ {
GriefPrevention.sendMessage(player, TextMode.Err, Messages.DeleteClaimMissing); GriefPrevention.sendMessage(player, TextMode.Err, Messages.DeleteClaimMissing);
} else }
else
{ {
String noBuildReason = claim.allowBuild(player, Material.STONE); String noBuildReason = claim.allowBuild(player, Material.STONE);
if (noBuildReason != null) if (noBuildReason != null)
@ -2019,7 +2053,8 @@ public class GriefPrevention extends JavaPlugin
{ {
claim.areExplosivesAllowed = false; claim.areExplosivesAllowed = false;
GriefPrevention.sendMessage(player, TextMode.Success, Messages.ExplosivesDisabled); GriefPrevention.sendMessage(player, TextMode.Success, Messages.ExplosivesDisabled);
} else }
else
{ {
claim.areExplosivesAllowed = true; claim.areExplosivesAllowed = true;
GriefPrevention.sendMessage(player, TextMode.Success, Messages.ExplosivesEnabled); GriefPrevention.sendMessage(player, TextMode.Success, Messages.ExplosivesEnabled);
@ -2056,7 +2091,8 @@ public class GriefPrevention extends JavaPlugin
} }
return true; return true;
} else if (cmd.getName().equalsIgnoreCase("deleteclaimsinworld")) }
else if (cmd.getName().equalsIgnoreCase("deleteclaimsinworld"))
{ {
//must be executed at the console //must be executed at the console
if (player != null) if (player != null)
@ -2080,7 +2116,8 @@ public class GriefPrevention extends JavaPlugin
this.dataStore.deleteClaimsInWorld(world, true); this.dataStore.deleteClaimsInWorld(world, true);
GriefPrevention.AddLogEntry("Deleted all claims in world: " + world.getName() + ".", CustomLogEntryTypes.AdminActivity); GriefPrevention.AddLogEntry("Deleted all claims in world: " + world.getName() + ".", CustomLogEntryTypes.AdminActivity);
return true; return true;
} else if (cmd.getName().equalsIgnoreCase("deleteuserclaimsinworld")) }
else if (cmd.getName().equalsIgnoreCase("deleteuserclaimsinworld"))
{ {
//must be executed at the console //must be executed at the console
if (player != null) if (player != null)
@ -2118,7 +2155,8 @@ public class GriefPrevention extends JavaPlugin
{ {
GriefPrevention.sendMessage(player, TextMode.Err, Messages.PlayerNotFound2); GriefPrevention.sendMessage(player, TextMode.Err, Messages.PlayerNotFound2);
return true; return true;
} else }
else
{ {
WelcomeTask task = new WelcomeTask(otherPlayer); WelcomeTask task = new WelcomeTask(otherPlayer);
task.run(); task.run();
@ -2229,7 +2267,8 @@ public class GriefPrevention extends JavaPlugin
playerData = this.dataStore.getPlayerData(otherPlayer.getUniqueId()); playerData = this.dataStore.getPlayerData(otherPlayer.getUniqueId());
GriefPrevention.sendMessage(player, TextMode.Success, Messages.DropUnlockOthersConfirmation, otherPlayer.getName()); GriefPrevention.sendMessage(player, TextMode.Success, Messages.DropUnlockOthersConfirmation, otherPlayer.getName());
} else }
else
{ {
playerData = this.dataStore.getPlayerData(player.getUniqueId()); playerData = this.dataStore.getPlayerData(player.getUniqueId());
GriefPrevention.sendMessage(player, TextMode.Success, Messages.DropUnlockConfirmation); GriefPrevention.sendMessage(player, TextMode.Success, Messages.DropUnlockConfirmation);
@ -2498,7 +2537,8 @@ public class GriefPrevention extends JavaPlugin
{ {
return false; return false;
} }
} else }
else
{ {
return false; return false;
} }
@ -2578,7 +2618,8 @@ public class GriefPrevention extends JavaPlugin
GriefPrevention.sendMessage(player, TextMode.Success, Messages.SiegeConfirmed, defender.getName()); GriefPrevention.sendMessage(player, TextMode.Success, Messages.SiegeConfirmed, defender.getName());
return true; return true;
} else if (cmd.getName().equalsIgnoreCase("softmute")) }
else if (cmd.getName().equalsIgnoreCase("softmute"))
{ {
//requires one parameter //requires one parameter
if (args.length != 1) return false; if (args.length != 1) return false;
@ -2603,19 +2644,22 @@ public class GriefPrevention extends JavaPlugin
} }
GriefPrevention.AddLogEntry(executorName + " muted " + targetPlayer.getName() + ".", CustomLogEntryTypes.AdminActivity, true); GriefPrevention.AddLogEntry(executorName + " muted " + targetPlayer.getName() + ".", CustomLogEntryTypes.AdminActivity, true);
} else }
else
{ {
GriefPrevention.sendMessage(player, TextMode.Success, Messages.UnSoftMuted, targetPlayer.getName()); GriefPrevention.sendMessage(player, TextMode.Success, Messages.UnSoftMuted, targetPlayer.getName());
} }
return true; return true;
} else if (cmd.getName().equalsIgnoreCase("gpreload")) }
else if (cmd.getName().equalsIgnoreCase("gpreload"))
{ {
this.loadConfig(); this.loadConfig();
if (player != null) if (player != null)
{ {
GriefPrevention.sendMessage(player, TextMode.Success, "Configuration updated. If you have updated your Grief Prevention JAR, you still need to /reload or reboot your server."); GriefPrevention.sendMessage(player, TextMode.Success, "Configuration updated. If you have updated your Grief Prevention JAR, you still need to /reload or reboot your server.");
} else }
else
{ {
GriefPrevention.AddLogEntry("Configuration updated. If you have updated your Grief Prevention JAR, you still need to /reload or reboot your server."); GriefPrevention.AddLogEntry("Configuration updated. If you have updated your Grief Prevention JAR, you still need to /reload or reboot your server.");
} }
@ -2740,7 +2784,8 @@ public class GriefPrevention extends JavaPlugin
if (list.isEmpty()) if (list.isEmpty())
{ {
GriefPrevention.sendMessage(player, TextMode.Info, Messages.NotIgnoringAnyone); GriefPrevention.sendMessage(player, TextMode.Info, Messages.NotIgnoringAnyone);
} else }
else
{ {
GriefPrevention.sendMessage(player, TextMode.Info, list); GriefPrevention.sendMessage(player, TextMode.Info, list);
} }
@ -2813,7 +2858,8 @@ public class GriefPrevention extends JavaPlugin
if (mode == IgnoreMode.None) if (mode == IgnoreMode.None)
{ {
playerData.ignoredPlayers.remove(ignoree.getUniqueId()); playerData.ignoredPlayers.remove(ignoree.getUniqueId());
} else }
else
{ {
playerData.ignoredPlayers.put(ignoree.getUniqueId(), mode == IgnoreMode.StandardIgnore ? false : true); playerData.ignoredPlayers.put(ignoree.getUniqueId(), mode == IgnoreMode.StandardIgnore ? false : true);
} }
@ -2834,7 +2880,8 @@ public class GriefPrevention extends JavaPlugin
if (entry.startsWith("[") || entry.equals("public")) if (entry.startsWith("[") || entry.equals("public"))
{ {
return entry; return entry;
} else }
else
{ {
return GriefPrevention.lookupPlayerName(entry); return GriefPrevention.lookupPlayerName(entry);
} }
@ -2867,7 +2914,8 @@ public class GriefPrevention extends JavaPlugin
{ {
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.DeleteTopLevelClaim); GriefPrevention.sendMessage(player, TextMode.Instr, Messages.DeleteTopLevelClaim);
return true; return true;
} else }
else
{ {
//delete it //delete it
claim.removeSurfaceFluids(null); claim.removeSurfaceFluids(null);
@ -2919,10 +2967,12 @@ public class GriefPrevention extends JavaPlugin
GriefPrevention.sendMessage(player, TextMode.Err, Messages.InvalidPermissionID); GriefPrevention.sendMessage(player, TextMode.Err, Messages.InvalidPermissionID);
return; return;
} }
} else if (recipientName.contains(".")) }
else if (recipientName.contains("."))
{ {
permission = recipientName; permission = recipientName;
} else }
else
{ {
otherPlayer = this.resolvePlayerByName(recipientName); otherPlayer = this.resolvePlayerByName(recipientName);
if (otherPlayer == null && !recipientName.equals("public") && !recipientName.equals("all")) if (otherPlayer == null && !recipientName.equals("public") && !recipientName.equals("all"))
@ -2935,7 +2985,8 @@ public class GriefPrevention extends JavaPlugin
{ {
recipientName = otherPlayer.getName(); recipientName = otherPlayer.getName();
recipientID = otherPlayer.getUniqueId(); recipientID = otherPlayer.getUniqueId();
} else }
else
{ {
recipientName = "public"; recipientName = "public";
} }
@ -2950,7 +3001,8 @@ public class GriefPrevention extends JavaPlugin
{ {
targetClaims.add(playerData.getClaims().get(i)); targetClaims.add(playerData.getClaims().get(i));
} }
} else }
else
{ {
//check permission here //check permission here
if (claim.allowGrantPermission(player) != null) if (claim.allowGrantPermission(player) != null)
@ -3009,7 +3061,8 @@ public class GriefPrevention extends JavaPlugin
if (permission != null) if (permission != null)
{ {
identifierToAdd = "[" + permission + "]"; identifierToAdd = "[" + permission + "]";
} else if (recipientID != null) }
else if (recipientID != null)
{ {
identifierToAdd = recipientID.toString(); identifierToAdd = recipientID.toString();
} }
@ -3034,7 +3087,8 @@ public class GriefPrevention extends JavaPlugin
{ {
currentClaim.managers.add(identifierToAdd); currentClaim.managers.add(identifierToAdd);
} }
} else }
else
{ {
currentClaim.setPermission(identifierToAdd, permissionLevel); currentClaim.setPermission(identifierToAdd, permissionLevel);
} }
@ -3047,13 +3101,16 @@ public class GriefPrevention extends JavaPlugin
if (permissionLevel == null) if (permissionLevel == null)
{ {
permissionDescription = this.dataStore.getMessage(Messages.PermissionsPermission); permissionDescription = this.dataStore.getMessage(Messages.PermissionsPermission);
} else if (permissionLevel == ClaimPermission.Build) }
else if (permissionLevel == ClaimPermission.Build)
{ {
permissionDescription = this.dataStore.getMessage(Messages.BuildPermission); permissionDescription = this.dataStore.getMessage(Messages.BuildPermission);
} else if (permissionLevel == ClaimPermission.Access) }
else if (permissionLevel == ClaimPermission.Access)
{ {
permissionDescription = this.dataStore.getMessage(Messages.AccessPermission); permissionDescription = this.dataStore.getMessage(Messages.AccessPermission);
} else //ClaimPermission.Inventory }
else //ClaimPermission.Inventory
{ {
permissionDescription = this.dataStore.getMessage(Messages.ContainersPermission); permissionDescription = this.dataStore.getMessage(Messages.ContainersPermission);
} }
@ -3062,7 +3119,8 @@ public class GriefPrevention extends JavaPlugin
if (claim == null) if (claim == null)
{ {
location = this.dataStore.getMessage(Messages.LocationAllClaims); location = this.dataStore.getMessage(Messages.LocationAllClaims);
} else }
else
{ {
location = this.dataStore.getMessage(Messages.LocationCurrentClaim); location = this.dataStore.getMessage(Messages.LocationCurrentClaim);
} }
@ -3152,7 +3210,8 @@ public class GriefPrevention extends JavaPlugin
if (player.hasPlayedBefore() || player.isOnline()) if (player.hasPlayedBefore() || player.isOnline())
{ {
return player.getName(); return player.getName();
} else }
else
{ {
return "someone(" + playerID.toString() + ")"; return "someone(" + playerID.toString() + ")";
} }
@ -3320,7 +3379,8 @@ public class GriefPrevention extends JavaPlugin
if (player == null) if (player == null)
{ {
GriefPrevention.AddLogEntry(color + message); GriefPrevention.AddLogEntry(color + message);
} else }
else
{ {
player.sendMessage(color + message); player.sendMessage(color + message);
} }
@ -3334,7 +3394,8 @@ public class GriefPrevention extends JavaPlugin
if (delayInTicks > 0) if (delayInTicks > 0)
{ {
GriefPrevention.instance.getServer().getScheduler().runTaskLater(GriefPrevention.instance, task, delayInTicks); GriefPrevention.instance.getServer().getScheduler().runTaskLater(GriefPrevention.instance, task, delayInTicks);
} else }
else
{ {
task.run(); task.run();
} }
@ -3384,7 +3445,8 @@ public class GriefPrevention extends JavaPlugin
reason += " " + this.dataStore.getMessage(Messages.IgnoreClaimsAdvertisement); reason += " " + this.dataStore.getMessage(Messages.IgnoreClaimsAdvertisement);
reason += " " + this.dataStore.getMessage(Messages.CreativeBasicsVideo2, DataStore.CREATIVE_VIDEO_URL); reason += " " + this.dataStore.getMessage(Messages.CreativeBasicsVideo2, DataStore.CREATIVE_VIDEO_URL);
return reason; return reason;
} else }
else
{ {
return null; return null;
} }
@ -3439,7 +3501,8 @@ public class GriefPrevention extends JavaPlugin
{ {
return null; return null;
} }
} else }
else
{ {
//cache the claim for later reference //cache the claim for later reference
playerData.lastClaim = claim; playerData.lastClaim = claim;
@ -3545,7 +3608,8 @@ public class GriefPrevention extends JavaPlugin
if (overrideValue == null || overrideValue == -1) if (overrideValue == null || overrideValue == -1)
{ {
return world.getSeaLevel(); return world.getSeaLevel();
} else }
else
{ {
return overrideValue; return overrideValue;
} }
@ -3633,7 +3697,8 @@ public class GriefPrevention extends JavaPlugin
Bukkit.getServer().dispatchCommand( Bukkit.getServer().dispatchCommand(
Bukkit.getConsoleSender(), Bukkit.getConsoleSender(),
GriefPrevention.instance.config_ban_commandFormat.replace("%name%", player.getName()).replace("%reason%", reason)); GriefPrevention.instance.config_ban_commandFormat.replace("%name%", player.getName()).replace("%reason%", reason));
} else }
else
{ {
BanList bans = Bukkit.getServer().getBanList(Type.NAME); BanList bans = Bukkit.getServer().getBanList(Type.NAME);
bans.addBan(player.getName(), reason, null, source); bans.addBan(player.getName(), reason, null, source);

View File

@ -79,7 +79,8 @@ public class MaterialInfo
{ {
allDataValues = true; allDataValues = true;
data = 0; data = 0;
} else }
else
{ {
allDataValues = false; allDataValues = false;
data = Byte.parseByte(parts[1]); data = Byte.parseByte(parts[1]);

View File

@ -223,7 +223,8 @@ public class PlayerData
this.accruedClaimBlocks = GriefPrevention.instance.config_claims_initialBlocks; this.accruedClaimBlocks = GriefPrevention.instance.config_claims_initialBlocks;
} }
} else }
else
{ {
this.accruedClaimBlocks = GriefPrevention.instance.config_claims_initialBlocks; this.accruedClaimBlocks = GriefPrevention.instance.config_claims_initialBlocks;
} }
@ -234,7 +235,8 @@ public class PlayerData
if (storageData.bonusClaimBlocks != null) if (storageData.bonusClaimBlocks != null)
{ {
this.bonusClaimBlocks = storageData.bonusClaimBlocks; this.bonusClaimBlocks = storageData.bonusClaimBlocks;
} else }
else
{ {
this.bonusClaimBlocks = 0; this.bonusClaimBlocks = 0;
} }

View File

@ -167,7 +167,8 @@ class PlayerEventHandler implements Listener
if (this.dataStore.isSoftMuted(recipient.getUniqueId())) if (this.dataStore.isSoftMuted(recipient.getUniqueId()))
{ {
recipientsToKeep.add(recipient); recipientsToKeep.add(recipient);
} else if (recipient.hasPermission("griefprevention.eavesdrop")) }
else if (recipient.hasPermission("griefprevention.eavesdrop"))
{ {
recipient.sendMessage(ChatColor.GRAY + notificationMessage); recipient.sendMessage(ChatColor.GRAY + notificationMessage);
} }
@ -235,7 +236,8 @@ class PlayerEventHandler implements Listener
if (playerData.ignoredPlayers.containsKey(recipient.getUniqueId())) if (playerData.ignoredPlayers.containsKey(recipient.getUniqueId()))
{ {
recipientsToRemove.add(recipient); recipientsToRemove.add(recipient);
} else }
else
{ {
PlayerData targetPlayerData = this.dataStore.getPlayerData(recipient.getUniqueId()); PlayerData targetPlayerData = this.dataStore.getPlayerData(recipient.getUniqueId());
if (targetPlayerData.ignoredPlayers.containsKey(player.getUniqueId())) if (targetPlayerData.ignoredPlayers.containsKey(player.getUniqueId()))
@ -266,7 +268,8 @@ class PlayerEventHandler implements Listener
if (instance.creativeRulesApply(player.getLocation())) if (instance.creativeRulesApply(player.getLocation()))
{ {
instance.sendMessage(player, TextMode.Info, Messages.CreativeBasicsVideo2, 10L, DataStore.CREATIVE_VIDEO_URL); instance.sendMessage(player, TextMode.Info, Messages.CreativeBasicsVideo2, 10L, DataStore.CREATIVE_VIDEO_URL);
} else }
else
{ {
instance.sendMessage(player, TextMode.Info, Messages.SurvivalBasicsVideo2, 10L, DataStore.SURVIVAL_VIDEO_URL); instance.sendMessage(player, TextMode.Info, Messages.SurvivalBasicsVideo2, 10L, DataStore.SURVIVAL_VIDEO_URL);
} }
@ -323,7 +326,8 @@ class PlayerEventHandler implements Listener
{ {
instance.sendMessage(player, TextMode.Err, Messages.NoChatUntilMove, 10L); instance.sendMessage(player, TextMode.Err, Messages.NoChatUntilMove, 10L);
result.muteReason = "pre-movement chat"; result.muteReason = "pre-movement chat";
} else }
else
{ {
playerData.noChatLocation = null; playerData.noChatLocation = null;
} }
@ -350,7 +354,8 @@ class PlayerEventHandler implements Listener
//kick and ban //kick and ban
PlayerKickBanTask task = new PlayerKickBanTask(player, instance.config_spam_banMessage, "GriefPrevention Anti-Spam", true); PlayerKickBanTask task = new PlayerKickBanTask(player, instance.config_spam_banMessage, "GriefPrevention Anti-Spam", true);
instance.getServer().getScheduler().scheduleSyncDelayedTask(instance, task, 1L); instance.getServer().getScheduler().scheduleSyncDelayedTask(instance, task, 1L);
} else }
else
{ {
//log entry //log entry
instance.AddLogEntry("Kicking " + player.getName() + " for spam.", CustomLogEntryTypes.AdminActivity); instance.AddLogEntry("Kicking " + player.getName() + " for spam.", CustomLogEntryTypes.AdminActivity);
@ -359,7 +364,8 @@ class PlayerEventHandler implements Listener
PlayerKickBanTask task = new PlayerKickBanTask(player, "", "GriefPrevention Anti-Spam", false); PlayerKickBanTask task = new PlayerKickBanTask(player, "", "GriefPrevention Anti-Spam", false);
instance.getServer().getScheduler().scheduleSyncDelayedTask(instance, task, 1L); instance.getServer().getScheduler().scheduleSyncDelayedTask(instance, task, 1L);
} }
} else if (result.shouldWarnChatter) }
else if (result.shouldWarnChatter)
{ {
//warn and log //warn and log
instance.sendMessage(player, TextMode.Warn, instance.config_spam_warningMessage, 10L); instance.sendMessage(player, TextMode.Warn, instance.config_spam_warningMessage, 10L);
@ -581,7 +587,8 @@ class PlayerEventHandler implements Listener
if (instance.config_eavesdrop_whisperCommands.contains("/" + alias)) if (instance.config_eavesdrop_whisperCommands.contains("/" + alias))
{ {
category = CommandCategory.Whisper; category = CommandCategory.Whisper;
} else if (instance.config_spam_monitorSlashCommands.contains("/" + alias)) }
else if (instance.config_spam_monitorSlashCommands.contains("/" + alias))
{ {
category = CommandCategory.Chat; category = CommandCategory.Chat;
} }
@ -919,7 +926,8 @@ class PlayerEventHandler implements Listener
if (playerData.wasKicked) if (playerData.wasKicked)
{ {
isBanned = player.isBanned(); isBanned = player.isBanned();
} else }
else
{ {
isBanned = false; isBanned = false;
} }
@ -999,7 +1007,8 @@ class PlayerEventHandler implements Listener
if (now - notificationTimestamp > ONE_MINUTE) if (now - notificationTimestamp > ONE_MINUTE)
{ {
this.recentLoginLogoutNotifications.remove(i--); this.recentLoginLogoutNotifications.remove(i--);
} else }
else
{ {
break; break;
} }
@ -1184,7 +1193,8 @@ class PlayerEventHandler implements Listener
return; return;
} }
} }
} else //world repair code for a now-fixed GP bug //TODO: necessary anymore? }
else //world repair code for a now-fixed GP bug //TODO: necessary anymore?
{ {
//ensure this entity can be tamed by players //ensure this entity can be tamed by players
tameable.setOwner(null); tameable.setOwner(null);
@ -1513,7 +1523,8 @@ class PlayerEventHandler implements Listener
if (GriefPrevention.instance.pvpRulesApply(world)) if (GriefPrevention.instance.pvpRulesApply(world))
{ {
return GriefPrevention.instance.config_pvp_allowLavaNearPlayers; return GriefPrevention.instance.config_pvp_allowLavaNearPlayers;
} else }
else
{ {
return GriefPrevention.instance.config_pvp_allowLavaNearPlayers_NonPvp; return GriefPrevention.instance.config_pvp_allowLavaNearPlayers_NonPvp;
} }
@ -1564,7 +1575,8 @@ class PlayerEventHandler implements Listener
if (clickedBlock != null) if (clickedBlock != null)
{ {
clickedBlockType = clickedBlock.getType(); clickedBlockType = clickedBlock.getType();
} else }
else
{ {
clickedBlockType = Material.AIR; clickedBlockType = Material.AIR;
} }
@ -1904,7 +1916,8 @@ class PlayerEventHandler implements Listener
} }
return; return;
} else if (clickedBlock != null && ( }
else if (clickedBlock != null && (
materialInHand == Material.OAK_BOAT || materialInHand == Material.OAK_BOAT ||
materialInHand == Material.SPRUCE_BOAT || materialInHand == Material.SPRUCE_BOAT ||
materialInHand == Material.BIRCH_BOAT || materialInHand == Material.BIRCH_BOAT ||
@ -2182,10 +2195,12 @@ class PlayerEventHandler implements Listener
if (environment == Environment.NETHER) if (environment == Environment.NETHER)
{ {
allowedFillBlocks.add(Material.NETHERRACK); allowedFillBlocks.add(Material.NETHERRACK);
} else if (environment == Environment.THE_END) }
else if (environment == Environment.THE_END)
{ {
allowedFillBlocks.add(Material.END_STONE); allowedFillBlocks.add(Material.END_STONE);
} else }
else
{ {
allowedFillBlocks.add(Material.GRASS); allowedFillBlocks.add(Material.GRASS);
allowedFillBlocks.add(Material.DIRT); allowedFillBlocks.add(Material.DIRT);
@ -2271,13 +2286,16 @@ class PlayerEventHandler implements Listener
if (allowedFillBlocks.contains(eastBlock.getType())) if (allowedFillBlocks.contains(eastBlock.getType()))
{ {
block.setType(eastBlock.getType()); block.setType(eastBlock.getType());
} else if (allowedFillBlocks.contains(westBlock.getType())) }
else if (allowedFillBlocks.contains(westBlock.getType()))
{ {
block.setType(westBlock.getType()); block.setType(westBlock.getType());
} else if (allowedFillBlocks.contains(northBlock.getType())) }
else if (allowedFillBlocks.contains(northBlock.getType()))
{ {
block.setType(northBlock.getType()); block.setType(northBlock.getType());
} else if (allowedFillBlocks.contains(southBlock.getType())) }
else if (allowedFillBlocks.contains(southBlock.getType()))
{ {
block.setType(southBlock.getType()); block.setType(southBlock.getType());
} }
@ -2313,7 +2331,8 @@ class PlayerEventHandler implements Listener
if (playerData.lastShovelLocation.getBlockX() == playerData.claimResizing.getLesserBoundaryCorner().getBlockX()) if (playerData.lastShovelLocation.getBlockX() == playerData.claimResizing.getLesserBoundaryCorner().getBlockX())
{ {
newx1 = clickedBlock.getX(); newx1 = clickedBlock.getX();
} else }
else
{ {
newx1 = playerData.claimResizing.getLesserBoundaryCorner().getBlockX(); newx1 = playerData.claimResizing.getLesserBoundaryCorner().getBlockX();
} }
@ -2321,7 +2340,8 @@ class PlayerEventHandler implements Listener
if (playerData.lastShovelLocation.getBlockX() == playerData.claimResizing.getGreaterBoundaryCorner().getBlockX()) if (playerData.lastShovelLocation.getBlockX() == playerData.claimResizing.getGreaterBoundaryCorner().getBlockX())
{ {
newx2 = clickedBlock.getX(); newx2 = clickedBlock.getX();
} else }
else
{ {
newx2 = playerData.claimResizing.getGreaterBoundaryCorner().getBlockX(); newx2 = playerData.claimResizing.getGreaterBoundaryCorner().getBlockX();
} }
@ -2329,7 +2349,8 @@ class PlayerEventHandler implements Listener
if (playerData.lastShovelLocation.getBlockZ() == playerData.claimResizing.getLesserBoundaryCorner().getBlockZ()) if (playerData.lastShovelLocation.getBlockZ() == playerData.claimResizing.getLesserBoundaryCorner().getBlockZ())
{ {
newz1 = clickedBlock.getZ(); newz1 = clickedBlock.getZ();
} else }
else
{ {
newz1 = playerData.claimResizing.getLesserBoundaryCorner().getBlockZ(); newz1 = playerData.claimResizing.getLesserBoundaryCorner().getBlockZ();
} }
@ -2337,7 +2358,8 @@ class PlayerEventHandler implements Listener
if (playerData.lastShovelLocation.getBlockZ() == playerData.claimResizing.getGreaterBoundaryCorner().getBlockZ()) if (playerData.lastShovelLocation.getBlockZ() == playerData.claimResizing.getGreaterBoundaryCorner().getBlockZ())
{ {
newz2 = clickedBlock.getZ(); newz2 = clickedBlock.getZ();
} else }
else
{ {
newz2 = playerData.claimResizing.getGreaterBoundaryCorner().getBlockZ(); newz2 = playerData.claimResizing.getGreaterBoundaryCorner().getBlockZ();
} }
@ -2563,7 +2585,8 @@ class PlayerEventHandler implements Listener
instance.dataStore.tryAdvertiseAdminAlternatives(player); instance.dataStore.tryAdvertiseAdminAlternatives(player);
return; return;
} }
} else }
else
{ {
playerID = null; playerID = null;
} }
@ -2591,7 +2614,8 @@ class PlayerEventHandler implements Listener
Bukkit.getPluginManager().callEvent(new VisualizationEvent(player, result.claim)); Bukkit.getPluginManager().callEvent(new VisualizationEvent(player, result.claim));
Visualization.Apply(player, visualization); Visualization.Apply(player, visualization);
} else }
else
{ {
instance.sendMessage(player, TextMode.Err, Messages.CreateClaimFailOverlapRegion); instance.sendMessage(player, TextMode.Err, Messages.CreateClaimFailOverlapRegion);
} }
@ -2656,7 +2680,8 @@ class PlayerEventHandler implements Listener
{ {
return cachedValue.booleanValue(); return cachedValue.booleanValue();
} else }
else
{ {
boolean isHolder = clickedBlock.getState() instanceof InventoryHolder; boolean isHolder = clickedBlock.getState() instanceof InventoryHolder;
this.inventoryHolderCache.put(cacheKey, isHolder); this.inventoryHolderCache.put(cacheKey, isHolder);

View File

@ -62,7 +62,8 @@ class PlayerKickBanTask implements Runnable
{ {
//ban //ban
GriefPrevention.banPlayer(this.player, this.reason, this.source); GriefPrevention.banPlayer(this.player, this.reason, this.source);
} else if (this.player.isOnline()) }
else if (this.player.isOnline())
{ {
this.player.kickPlayer(this.reason); this.player.kickPlayer(this.reason);
} }

View File

@ -63,7 +63,8 @@ class PlayerRescueTask implements Runnable
if (this.destination == null) if (this.destination == null)
{ {
this.destination = GriefPrevention.instance.ejectPlayer(this.player); this.destination = GriefPrevention.instance.ejectPlayer(this.player);
} else }
else
{ {
player.teleport(this.destination); player.teleport(this.destination);
} }

View File

@ -45,7 +45,8 @@ class PvPImmunityValidationTask implements Runnable
//if found, cancel invulnerability and notify //if found, cancel invulnerability and notify
playerData.pvpImmune = false; playerData.pvpImmune = false;
GriefPrevention.sendMessage(player, TextMode.Warn, Messages.PvPImmunityEnd); GriefPrevention.sendMessage(player, TextMode.Warn, Messages.PvPImmunityEnd);
} else }
else
{ {
//otherwise check again in one minute //otherwise check again in one minute
GriefPrevention.instance.getServer().getScheduler().scheduleSyncDelayedTask(GriefPrevention.instance, this, 1200L); GriefPrevention.instance.getServer().getScheduler().scheduleSyncDelayedTask(GriefPrevention.instance, this, 1200L);

View File

@ -217,7 +217,8 @@ class RestoreNatureProcessingTask implements Runnable
underBlock.typeId == Material.SAND) underBlock.typeId == Material.SAND)
{ {
snapshots[x][y][z].typeId = Material.SAND; snapshots[x][y][z].typeId = Material.SAND;
} else }
else
{ {
snapshots[x][y][z].typeId = Material.AIR; snapshots[x][y][z].typeId = Material.AIR;
} }
@ -441,7 +442,8 @@ class RestoreNatureProcessingTask implements Runnable
if (this.biome == Biome.DESERT || this.biome == Biome.DESERT_HILLS || this.biome == Biome.BEACH) if (this.biome == Biome.DESERT || this.biome == Biome.DESERT_HILLS || this.biome == Biome.BEACH)
{ {
this.snapshots[x][y][z].typeId = Material.SAND; this.snapshots[x][y][z].typeId = Material.SAND;
} else }
else
{ {
this.snapshots[x][y][z].typeId = Material.GRASS_BLOCK; this.snapshots[x][y][z].typeId = Material.GRASS_BLOCK;
} }

View File

@ -57,7 +57,8 @@ class SpamDetector
chatterData.spamLevel += ++this.duplicateMessageCount; chatterData.spamLevel += ++this.duplicateMessageCount;
spam = true; spam = true;
result.muteReason = "repeat message"; result.muteReason = "repeat message";
} else }
else
{ {
this.lastChatMessage = message; this.lastChatMessage = message;
this.lastChatMessageTimestamp = timestamp; this.lastChatMessageTimestamp = timestamp;
@ -135,7 +136,8 @@ class SpamDetector
if (chatterData.spamLevel > 8 && chatterData.spamWarned) if (chatterData.spamLevel > 8 && chatterData.spamWarned)
{ {
result.shouldBanChatter = true; result.shouldBanChatter = true;
} else if (chatterData.spamLevel >= 4) }
else if (chatterData.spamLevel >= 4)
{ {
if (!chatterData.spamWarned) if (!chatterData.spamWarned)
{ {
@ -175,7 +177,8 @@ class SpamDetector
{ {
shorterString = lastMessage; shorterString = lastMessage;
longerString = message; longerString = message;
} else }
else
{ {
shorterString = message; shorterString = message;
longerString = lastMessage; longerString = lastMessage;

View File

@ -136,7 +136,8 @@ class UUIDFetcher
GriefPrevention.AddLogEntry("Mojang says we're sending requests too fast. Will retry every 30 seconds until we succeed..."); GriefPrevention.AddLogEntry("Mojang says we're sending requests too fast. Will retry every 30 seconds until we succeed...");
Thread.sleep(30000); Thread.sleep(30000);
} }
} else }
else
{ {
throw e; throw e;
} }

View File

@ -151,19 +151,23 @@ public class Visualization
{ {
cornerBlockData = Material.GLOWSTONE.createBlockData(); cornerBlockData = Material.GLOWSTONE.createBlockData();
accentBlockData = Material.GOLD_BLOCK.createBlockData(); accentBlockData = Material.GOLD_BLOCK.createBlockData();
} else if (visualizationType == VisualizationType.AdminClaim) }
else if (visualizationType == VisualizationType.AdminClaim)
{ {
cornerBlockData = Material.GLOWSTONE.createBlockData(); cornerBlockData = Material.GLOWSTONE.createBlockData();
accentBlockData = Material.PUMPKIN.createBlockData(); accentBlockData = Material.PUMPKIN.createBlockData();
} else if (visualizationType == VisualizationType.Subdivision) }
else if (visualizationType == VisualizationType.Subdivision)
{ {
cornerBlockData = Material.IRON_BLOCK.createBlockData(); cornerBlockData = Material.IRON_BLOCK.createBlockData();
accentBlockData = Material.WHITE_WOOL.createBlockData(); accentBlockData = Material.WHITE_WOOL.createBlockData();
} else if (visualizationType == VisualizationType.RestoreNature) }
else if (visualizationType == VisualizationType.RestoreNature)
{ {
cornerBlockData = Material.DIAMOND_BLOCK.createBlockData(); cornerBlockData = Material.DIAMOND_BLOCK.createBlockData();
accentBlockData = Material.DIAMOND_BLOCK.createBlockData(); accentBlockData = Material.DIAMOND_BLOCK.createBlockData();
} else }
else
{ {
cornerBlockData = Material.REDSTONE_ORE.createBlockData(); cornerBlockData = Material.REDSTONE_ORE.createBlockData();
((Lightable) cornerBlockData).setLit(true); ((Lightable) cornerBlockData).setLit(true);

View File

@ -1,4 +1,5 @@
/** /**
* @author Ryan
* @author Ryan * @author Ryan
*/ */
/** /**