Remove unused code
This commit is contained in:
parent
b4a60683d9
commit
ed3188b37a
|
|
@ -116,66 +116,6 @@ public class Claim
|
|||
this.modifiedDate = Calendar.getInstance().getTime();
|
||||
}
|
||||
|
||||
//players may only siege someone when he's not in an admin claim
|
||||
//and when he has some level of permission in the claim
|
||||
public boolean canSiege(Player defender)
|
||||
{
|
||||
if (this.isAdminClaim()) return false;
|
||||
|
||||
if (this.checkPermission(defender, ClaimPermission.Access, null) != null) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//removes any lava above sea level in a claim
|
||||
//exclusionClaim is another claim indicating an sub-area to be excluded from this operation
|
||||
//it may be null
|
||||
public void removeSurfaceFluids(Claim exclusionClaim)
|
||||
{
|
||||
//don't do this for administrative claims
|
||||
if (this.isAdminClaim()) return;
|
||||
|
||||
//don't do it for very large claims
|
||||
if (this.getArea() > 10000) return;
|
||||
|
||||
}
|
||||
|
||||
//determines whether or not a claim has surface lava
|
||||
//used to warn players when they abandon their claims about automatic fluid cleanup
|
||||
boolean hasSurfaceFluids()
|
||||
{
|
||||
Location lesser = this.getLesserBoundaryCorner();
|
||||
Location greater = this.getGreaterBoundaryCorner();
|
||||
|
||||
//don't bother for very large claims, too expensive
|
||||
if (this.getArea() > 10000) return false;
|
||||
|
||||
int seaLevel = 0; //clean up all fluids in the end
|
||||
|
||||
//respect sea level in normal worlds
|
||||
if (lesser.getWorld().getEnvironment() == Environment.NORMAL)
|
||||
seaLevel = GriefPrevention.instance.getSeaLevel(lesser.getWorld());
|
||||
|
||||
for (int x = lesser.getBlockX(); x <= greater.getBlockX(); x++)
|
||||
{
|
||||
for (int z = lesser.getBlockZ(); z <= greater.getBlockZ(); z++)
|
||||
{
|
||||
for (int y = seaLevel - 1; y <= lesser.getWorld().getMaxHeight(); y++)
|
||||
{
|
||||
//dodge the exclusion claim
|
||||
Block block = lesser.getWorld().getBlockAt(x, y, z);
|
||||
|
||||
if (block.getType() == Material.WATER || block.getType() == Material.LAVA)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//main constructor. note that only creating a claim instance does nothing - a claim must be added to the data store to be effective
|
||||
Claim(Location lesserBoundaryCorner, Location greaterBoundaryCorner, UUID ownerID, List<String> builderIDs, List<String> containerIDs, List<String> accessorIDs, List<String> managerIDs, boolean inheritNothing, Long id)
|
||||
{
|
||||
|
|
@ -753,79 +693,6 @@ public class Claim
|
|||
return new BoundingBox(this).intersects(new BoundingBox(otherClaim));
|
||||
}
|
||||
|
||||
//whether more entities may be added to a claim
|
||||
public String allowMoreEntities(boolean remove)
|
||||
{
|
||||
if (this.parent != null) return this.parent.allowMoreEntities(remove);
|
||||
|
||||
//this rule only applies to creative mode worlds
|
||||
if (!GriefPrevention.instance.creativeRulesApply(this.getLesserBoundaryCorner())) return null;
|
||||
|
||||
//admin claims aren't restricted
|
||||
if (this.isAdminClaim()) return null;
|
||||
|
||||
//don't apply this rule to very large claims
|
||||
if (this.getArea() > 10000) return null;
|
||||
|
||||
//determine maximum allowable entity count, based on claim size
|
||||
int maxEntities = this.getArea() / 50;
|
||||
if (maxEntities == 0) return GriefPrevention.instance.dataStore.getMessage(Messages.ClaimTooSmallForEntities);
|
||||
|
||||
//count current entities (ignoring players)
|
||||
int totalEntities = 0;
|
||||
ArrayList<Chunk> chunks = this.getChunks();
|
||||
for (Chunk chunk : chunks)
|
||||
{
|
||||
Entity[] entities = chunk.getEntities();
|
||||
for (Entity entity : entities)
|
||||
{
|
||||
if (!(entity instanceof Player) && this.contains(entity.getLocation(), false, false))
|
||||
{
|
||||
totalEntities++;
|
||||
if (remove && totalEntities > maxEntities) entity.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (totalEntities >= maxEntities)
|
||||
return GriefPrevention.instance.dataStore.getMessage(Messages.TooManyEntitiesInClaim);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public String allowMoreActiveBlocks()
|
||||
{
|
||||
if (this.parent != null) return this.parent.allowMoreActiveBlocks();
|
||||
|
||||
//determine maximum allowable entity count, based on claim size
|
||||
int maxActives = this.getArea() / 100;
|
||||
if (maxActives == 0)
|
||||
return GriefPrevention.instance.dataStore.getMessage(Messages.ClaimTooSmallForActiveBlocks);
|
||||
|
||||
//count current actives
|
||||
int totalActives = 0;
|
||||
ArrayList<Chunk> chunks = this.getChunks();
|
||||
for (Chunk chunk : chunks)
|
||||
{
|
||||
BlockState[] actives = chunk.getTileEntities();
|
||||
for (BlockState active : actives)
|
||||
{
|
||||
if (BlockEventHandler.isActiveBlock(active))
|
||||
{
|
||||
if (this.contains(active.getLocation(), false, false))
|
||||
{
|
||||
totalActives++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (totalActives >= maxActives)
|
||||
return GriefPrevention.instance.dataStore.getMessage(Messages.TooManyActiveBlocksInClaim);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
//implements a strict ordering of claims, used to keep the claims collection sorted for faster searching
|
||||
boolean greaterThan(Claim otherClaim)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -69,7 +69,6 @@ class CleanupUnusedClaimTask implements Runnable
|
|||
{
|
||||
if (expireEventCanceled())
|
||||
return;
|
||||
claim.removeSurfaceFluids(null);
|
||||
GriefPrevention.instance.dataStore.deleteClaim(claim, true, true);
|
||||
|
||||
GriefPrevention.AddLogEntry(" " + claim.getOwnerName() + "'s new player claim expired.", CustomLogEntryTypes.AdminActivity);
|
||||
|
|
|
|||
|
|
@ -1134,8 +1134,6 @@ public abstract class DataStore
|
|||
//delete them one by one
|
||||
for (Claim claim : claimsToDelete)
|
||||
{
|
||||
claim.removeSurfaceFluids(null);
|
||||
|
||||
this.deleteClaim(claim, releasePets);
|
||||
}
|
||||
}
|
||||
|
|
@ -1228,8 +1226,6 @@ public abstract class DataStore
|
|||
{
|
||||
smaller = true;
|
||||
|
||||
//remove surface fluids about to be unclaimed
|
||||
oldClaim.removeSurfaceFluids(newClaim);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -273,13 +273,6 @@ public class EntityEventHandler implements Listener
|
|||
return;
|
||||
}
|
||||
|
||||
// No modification in the wilderness in creative mode.
|
||||
if (instance.creativeRulesApply(block.getLocation()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
// Unclaimed area is fair game.
|
||||
return;
|
||||
}
|
||||
|
|
@ -479,17 +472,6 @@ public class EntityEventHandler implements Listener
|
|||
}
|
||||
}
|
||||
|
||||
//when an experience bottle explodes...
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onExpBottle(ExpBottleEvent event)
|
||||
{
|
||||
//if in a creative world, cancel the event (don't drop exp on the ground)
|
||||
if (GriefPrevention.instance.creativeRulesApply(event.getEntity().getLocation()))
|
||||
{
|
||||
event.setExperience(0);
|
||||
}
|
||||
}
|
||||
|
||||
//when an entity dies...
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onEntityDeath(EntityDeathEvent event)
|
||||
|
|
|
|||
|
|
@ -1893,7 +1893,6 @@ public class GriefPrevention extends JavaPlugin
|
|||
}
|
||||
else
|
||||
{
|
||||
claim.removeSurfaceFluids(null);
|
||||
this.dataStore.deleteClaim(claim, true, true);
|
||||
|
||||
GriefPrevention.sendMessage(player, TextMode.Success, Messages.DeleteSuccess);
|
||||
|
|
@ -2733,7 +2732,6 @@ public class GriefPrevention extends JavaPlugin
|
|||
else
|
||||
{
|
||||
//delete it
|
||||
claim.removeSurfaceFluids(null);
|
||||
this.dataStore.deleteClaim(claim, true, false);
|
||||
|
||||
//adjust claim blocks when abandoning a top level claim
|
||||
|
|
|
|||
|
|
@ -1363,8 +1363,7 @@ class PlayerEventHandler implements Listener
|
|||
materialInHand == Material.FURNACE_MINECART ||
|
||||
materialInHand == Material.CHEST_MINECART ||
|
||||
materialInHand == Material.TNT_MINECART ||
|
||||
materialInHand == Material.HOPPER_MINECART) &&
|
||||
!instance.creativeRulesApply(clickedBlock.getLocation()))
|
||||
materialInHand == Material.HOPPER_MINECART))
|
||||
{
|
||||
if (playerData == null) playerData = this.dataStore.getPlayerData(player.getUniqueId());
|
||||
Claim claim = this.dataStore.getClaimAt(clickedBlock.getLocation(), false, playerData.lastClaim);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user