5.5
This commit is contained in:
parent
9b277f5801
commit
50f572fc2b
|
|
@ -1,7 +1,7 @@
|
||||||
name: GriefPrevention
|
name: GriefPrevention
|
||||||
main: me.ryanhamshire.GriefPrevention.GriefPrevention
|
main: me.ryanhamshire.GriefPrevention.GriefPrevention
|
||||||
softdepend: [Vault, Multiverse-Core, My Worlds]
|
softdepend: [Vault, Multiverse-Core, My Worlds]
|
||||||
version: 5.4
|
version: 5.5
|
||||||
commands:
|
commands:
|
||||||
abandonclaim:
|
abandonclaim:
|
||||||
description: Deletes a claim.
|
description: Deletes a claim.
|
||||||
|
|
|
||||||
|
|
@ -993,6 +993,7 @@ public abstract class DataStore
|
||||||
this.addDefault(defaults, Messages.UntrustOwnerOnly, "Only {0} can revoke permissions here.", "0: claim owner's name");
|
this.addDefault(defaults, Messages.UntrustOwnerOnly, "Only {0} can revoke permissions here.", "0: claim owner's name");
|
||||||
this.addDefault(defaults, Messages.HowToClaimRegex, "(^|.*\\W)how\\W.*\\W(claim|protect)(\\W.*|$)", "This is a Java Regular Expression. Look it up before editing! It's used to tell players about the demo video when they ask how to claim land.");
|
this.addDefault(defaults, Messages.HowToClaimRegex, "(^|.*\\W)how\\W.*\\W(claim|protect)(\\W.*|$)", "This is a Java Regular Expression. Look it up before editing! It's used to tell players about the demo video when they ask how to claim land.");
|
||||||
this.addDefault(defaults, Messages.NoBuildOutsideClaims, "You can't build here unless you claim some land first.", null);
|
this.addDefault(defaults, Messages.NoBuildOutsideClaims, "You can't build here unless you claim some land first.", null);
|
||||||
|
this.addDefault(defaults, Messages.PlayerOfflineTime, " Last login: {0} days ago.", "0: number of full days since last login");
|
||||||
|
|
||||||
//load the config file
|
//load the config file
|
||||||
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(messagesFilePath));
|
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(messagesFilePath));
|
||||||
|
|
|
||||||
|
|
@ -95,27 +95,39 @@ class EntityEventHandler implements Listener
|
||||||
|
|
||||||
if(GriefPrevention.instance.config_blockSurfaceExplosions && location.getWorld().getEnvironment() == Environment.NORMAL)
|
if(GriefPrevention.instance.config_blockSurfaceExplosions && location.getWorld().getEnvironment() == Environment.NORMAL)
|
||||||
{
|
{
|
||||||
if(location.getBlockY() >location.getWorld().getSeaLevel() - 7)
|
for(int i = 0; i < blocks.size(); i++)
|
||||||
{
|
{
|
||||||
blocks.clear(); //explosion still happens, can damage creatures/players, but no blocks will be destroyed
|
Block block = blocks.get(i);
|
||||||
return;
|
if(GriefPrevention.instance.config_mods_explodableIds.contains(block.getTypeId())) continue;
|
||||||
}
|
|
||||||
|
if(block.getLocation().getBlockY() > location.getWorld().getSeaLevel() - 7)
|
||||||
|
{
|
||||||
|
blocks.remove(i--);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//special rule for creative worlds: explosions don't destroy anything
|
//special rule for creative worlds: explosions don't destroy anything
|
||||||
if(GriefPrevention.instance.creativeRulesApply(explodeEvent.getLocation()))
|
if(GriefPrevention.instance.creativeRulesApply(explodeEvent.getLocation()))
|
||||||
{
|
{
|
||||||
blocks.clear();
|
for(int i = 0; i < blocks.size(); i++)
|
||||||
|
{
|
||||||
|
Block block = blocks.get(i);
|
||||||
|
if(GriefPrevention.instance.config_mods_explodableIds.contains(block.getTypeId())) continue;
|
||||||
|
|
||||||
|
blocks.remove(i--);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//FEATURE: creating an explosion near a claim doesn't damage any of the claimed blocks
|
//FEATURE: explosions don't damage claimed blocks
|
||||||
|
|
||||||
Claim claim = null;
|
Claim claim = null;
|
||||||
for(int i = 0; i < blocks.size(); i++) //for each destroyed block
|
for(int i = 0; i < blocks.size(); i++) //for each destroyed block
|
||||||
{
|
{
|
||||||
Block block = blocks.get(i);
|
Block block = blocks.get(i);
|
||||||
if(block.getType() == Material.AIR) continue; //if it's air, we don't care
|
if(block.getType() == Material.AIR) continue; //if it's air, we don't care
|
||||||
|
|
||||||
|
if(GriefPrevention.instance.config_mods_explodableIds.contains(block.getTypeId())) continue;
|
||||||
|
|
||||||
claim = this.dataStore.getClaimAt(block.getLocation(), false, claim);
|
claim = this.dataStore.getClaimAt(block.getLocation(), false, claim);
|
||||||
//if the block is claimed, remove it from the list of destroyed blocks
|
//if the block is claimed, remove it from the list of destroyed blocks
|
||||||
if(claim != null)
|
if(claim != null)
|
||||||
|
|
|
||||||
|
|
@ -127,6 +127,7 @@ public class GriefPrevention extends JavaPlugin
|
||||||
public List<Integer> config_mods_accessTrustIds; //list of block IDs which should require /accesstrust for player interaction
|
public List<Integer> config_mods_accessTrustIds; //list of block IDs which should require /accesstrust for player interaction
|
||||||
public List<Integer> config_mods_containerTrustIds; //list of block IDs which should require /containertrust for player interaction
|
public List<Integer> config_mods_containerTrustIds; //list of block IDs which should require /containertrust for player interaction
|
||||||
public List<String> config_mods_ignoreClaimsAccounts; //list of player names which ALWAYS ignore claims
|
public List<String> config_mods_ignoreClaimsAccounts; //list of player names which ALWAYS ignore claims
|
||||||
|
public List<Integer> config_mods_explodableIds; //list of block IDs which can be destroyed by explosions, even in claimed areas
|
||||||
|
|
||||||
//reference to the economy plugin, if economy integration is enabled
|
//reference to the economy plugin, if economy integration is enabled
|
||||||
public static Economy economy = null;
|
public static Economy economy = null;
|
||||||
|
|
@ -281,6 +282,9 @@ public class GriefPrevention extends JavaPlugin
|
||||||
this.config_mods_ignoreClaimsAccounts = config.getStringList("GriefPrevention.Mods.PlayersIgnoringAllClaims");
|
this.config_mods_ignoreClaimsAccounts = config.getStringList("GriefPrevention.Mods.PlayersIgnoringAllClaims");
|
||||||
if(this.config_mods_ignoreClaimsAccounts == null) this.config_mods_ignoreClaimsAccounts = new ArrayList<String>();
|
if(this.config_mods_ignoreClaimsAccounts == null) this.config_mods_ignoreClaimsAccounts = new ArrayList<String>();
|
||||||
|
|
||||||
|
this.config_mods_explodableIds = config.getIntegerList("GriefPrevention.Mods.BlockIdsExplodable");
|
||||||
|
if(this.config_mods_explodableIds == null) this.config_mods_explodableIds = new ArrayList<Integer>();
|
||||||
|
|
||||||
//default for claim investigation tool
|
//default for claim investigation tool
|
||||||
String investigationToolMaterialName = Material.STICK.name();
|
String investigationToolMaterialName = Material.STICK.name();
|
||||||
|
|
||||||
|
|
@ -450,6 +454,7 @@ public class GriefPrevention extends JavaPlugin
|
||||||
|
|
||||||
config.set("GriefPrevention.Mods.BlockIdsRequiringAccessTrust", this.config_mods_accessTrustIds);
|
config.set("GriefPrevention.Mods.BlockIdsRequiringAccessTrust", this.config_mods_accessTrustIds);
|
||||||
config.set("GriefPrevention.Mods.BlockIdsRequiringContainerTrust", this.config_mods_containerTrustIds);
|
config.set("GriefPrevention.Mods.BlockIdsRequiringContainerTrust", this.config_mods_containerTrustIds);
|
||||||
|
config.set("GriefPrevention.Mods.BlockIdsExplodable", this.config_mods_explodableIds);
|
||||||
config.set("GriefPrevention.Mods.PlayersIgnoringAllClaims", this.config_mods_ignoreClaimsAccounts);
|
config.set("GriefPrevention.Mods.PlayersIgnoringAllClaims", this.config_mods_ignoreClaimsAccounts);
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|
@ -1269,15 +1274,19 @@ public class GriefPrevention extends JavaPlugin
|
||||||
|
|
||||||
//load the player's data
|
//load the player's data
|
||||||
PlayerData playerData = this.dataStore.getPlayerData(otherPlayer.getName());
|
PlayerData playerData = this.dataStore.getPlayerData(otherPlayer.getName());
|
||||||
player.sendMessage(playerData.accruedClaimBlocks + "(+" + playerData.bonusClaimBlocks + ")=" + playerData.accruedClaimBlocks + playerData.bonusClaimBlocks);
|
GriefPrevention.sendMessage(player, TextMode.Instr, " " + playerData.accruedClaimBlocks + "(+" + playerData.bonusClaimBlocks + ")=" + (playerData.accruedClaimBlocks + playerData.bonusClaimBlocks));
|
||||||
for(int i = 0; i < playerData.claims.size(); i++)
|
for(int i = 0; i < playerData.claims.size(); i++)
|
||||||
{
|
{
|
||||||
Claim claim = playerData.claims.get(i);
|
Claim claim = playerData.claims.get(i);
|
||||||
player.sendMessage("(-" + claim.getArea() + ") " + getfriendlyLocationString(claim.getLesserBoundaryCorner()));
|
GriefPrevention.sendMessage(player, TextMode.Instr, " (-" + claim.getArea() + ") " + getfriendlyLocationString(claim.getLesserBoundaryCorner()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(playerData.claims.size() > 0)
|
if(playerData.claims.size() > 0)
|
||||||
player.sendMessage("=" + playerData.getRemainingClaimBlocks());
|
GriefPrevention.sendMessage(player, TextMode.Instr, " =" + playerData.getRemainingClaimBlocks());
|
||||||
|
|
||||||
|
//drop the data we just loaded, if the player isn't online
|
||||||
|
if(!otherPlayer.isOnline())
|
||||||
|
this.dataStore.clearCachedPlayerData(otherPlayer.getName());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,5 @@ package me.ryanhamshire.GriefPrevention;
|
||||||
|
|
||||||
public enum Messages
|
public enum Messages
|
||||||
{
|
{
|
||||||
RespectingClaims, IgnoringClaims, SuccessfulAbandon, RestoreNatureActivate, RestoreNatureAggressiveActivate, FillModeActive, TransferClaimPermission, TransferClaimMissing, TransferClaimAdminOnly, PlayerNotFound, TransferTopLevel, TransferSuccess, TrustListNoClaim, ClearPermsOwnerOnly, UntrustIndividualAllClaims, UntrustEveryoneAllClaims, NoPermissionTrust, ClearPermissionsOneClaim, UntrustIndividualSingleClaim, OnlySellBlocks, BlockPurchaseCost, ClaimBlockLimit, InsufficientFunds, PurchaseConfirmation, OnlyPurchaseBlocks, BlockSaleValue, NotEnoughBlocksForSale, BlockSaleConfirmation, AdminClaimsMode, BasicClaimsMode, SubdivisionMode, SubdivisionDemo, DeleteClaimMissing, DeletionSubdivisionWarning, DeleteSuccess, CantDeleteAdminClaim, DeleteAllSuccess, NoDeletePermission, AllAdminDeleted, AdjustBlocksSuccess, NotTrappedHere, TrappedOnCooldown, RescuePending, NonSiegeWorld, AlreadySieging, NotSiegableThere, SiegeTooFarAway, NoSiegeDefenseless, AlreadyUnderSiegePlayer, AlreadyUnderSiegeArea, NoSiegeAdminClaim, SiegeOnCooldown, SiegeAlert, SiegeConfirmed, AbandonClaimMissing, NotYourClaim, DeleteTopLevelClaim, AbandonSuccess, CantGrantThatPermission, GrantPermissionNoClaim, GrantPermissionConfirmation, ManageUniversalPermissionsInstruction, ManageOneClaimPermissionsInstruction, CollectivePublic, BuildPermission, ContainersPermission, AccessPermission, PermissionsPermission, LocationCurrentClaim, LocationAllClaims, PvPImmunityStart, SiegeNoDrop, DonateItemsInstruction, ChestFull, DonationSuccess, PlayerTooCloseForFire, TooDeepToClaim, ChestClaimConfirmation, AutomaticClaimNotification, TrustCommandAdvertisement, GoldenShovelAdvertisement, UnprotectedChestWarning, ThatPlayerPvPImmune, CantFightWhileImmune, NoDamageClaimedEntity, ShovelBasicClaimMode, RemainingBlocks, CreativeBasicsDemoAdvertisement, SurvivalBasicsDemoAdvertisement, TrappedChatKeyword, TrappedInstructions, PvPNoDrop, SiegeNoTeleport, BesiegedNoTeleport, SiegeNoContainers, PvPNoContainers, PvPImmunityEnd, NoBedPermission, NoWildernessBuckets, NoLavaNearOtherPlayer, TooFarAway, BlockNotClaimed, BlockClaimed, SiegeNoShovel, RestoreNaturePlayerInChunk, NoCreateClaimPermission, ResizeClaimTooSmall, ResizeNeedMoreBlocks, NoCreativeUnClaim, ClaimResizeSuccess, ResizeFailOverlap, ResizeStart, ResizeFailOverlapSubdivision, SubdivisionStart, CreateSubdivisionOverlap, SubdivisionSuccess, CreateClaimFailOverlap, CreateClaimFailOverlapOtherPlayer, ClaimsDisabledWorld, ClaimStart, NewClaimTooSmall, CreateClaimInsufficientBlocks, AbandonClaimAdvertisement, CreateClaimFailOverlapShort, CreateClaimSuccess, SiegeWinDoorsOpen, RescueAbortedMoved, SiegeDoorsLockedEjection, NoModifyDuringSiege, OnlyOwnersModifyClaims, NoBuildUnderSiege, NoBuildPvP, NoBuildPermission, NonSiegeMaterial, NoOwnerBuildUnderSiege, NoAccessPermission, NoContainersSiege, NoContainersPermission, OwnerNameForAdminClaims, ClaimTooSmallForEntities, TooManyEntitiesInClaim, YouHaveNoClaims, ConfirmFluidRemoval, AutoBanNotify, AdjustGroupBlocksSuccess, InvalidPermissionID, UntrustOwnerOnly, HowToClaimRegex, NoBuildOutsideClaims
|
RespectingClaims, IgnoringClaims, SuccessfulAbandon, RestoreNatureActivate, RestoreNatureAggressiveActivate, FillModeActive, TransferClaimPermission, TransferClaimMissing, TransferClaimAdminOnly, PlayerNotFound, TransferTopLevel, TransferSuccess, TrustListNoClaim, ClearPermsOwnerOnly, UntrustIndividualAllClaims, UntrustEveryoneAllClaims, NoPermissionTrust, ClearPermissionsOneClaim, UntrustIndividualSingleClaim, OnlySellBlocks, BlockPurchaseCost, ClaimBlockLimit, InsufficientFunds, PurchaseConfirmation, OnlyPurchaseBlocks, BlockSaleValue, NotEnoughBlocksForSale, BlockSaleConfirmation, AdminClaimsMode, BasicClaimsMode, SubdivisionMode, SubdivisionDemo, DeleteClaimMissing, DeletionSubdivisionWarning, DeleteSuccess, CantDeleteAdminClaim, DeleteAllSuccess, NoDeletePermission, AllAdminDeleted, AdjustBlocksSuccess, NotTrappedHere, TrappedOnCooldown, RescuePending, NonSiegeWorld, AlreadySieging, NotSiegableThere, SiegeTooFarAway, NoSiegeDefenseless, AlreadyUnderSiegePlayer, AlreadyUnderSiegeArea, NoSiegeAdminClaim, SiegeOnCooldown, SiegeAlert, SiegeConfirmed, AbandonClaimMissing, NotYourClaim, DeleteTopLevelClaim, AbandonSuccess, CantGrantThatPermission, GrantPermissionNoClaim, GrantPermissionConfirmation, ManageUniversalPermissionsInstruction, ManageOneClaimPermissionsInstruction, CollectivePublic, BuildPermission, ContainersPermission, AccessPermission, PermissionsPermission, LocationCurrentClaim, LocationAllClaims, PvPImmunityStart, SiegeNoDrop, DonateItemsInstruction, ChestFull, DonationSuccess, PlayerTooCloseForFire, TooDeepToClaim, ChestClaimConfirmation, AutomaticClaimNotification, TrustCommandAdvertisement, GoldenShovelAdvertisement, UnprotectedChestWarning, ThatPlayerPvPImmune, CantFightWhileImmune, NoDamageClaimedEntity, ShovelBasicClaimMode, RemainingBlocks, CreativeBasicsDemoAdvertisement, SurvivalBasicsDemoAdvertisement, TrappedChatKeyword, TrappedInstructions, PvPNoDrop, SiegeNoTeleport, BesiegedNoTeleport, SiegeNoContainers, PvPNoContainers, PvPImmunityEnd, NoBedPermission, NoWildernessBuckets, NoLavaNearOtherPlayer, TooFarAway, BlockNotClaimed, BlockClaimed, SiegeNoShovel, RestoreNaturePlayerInChunk, NoCreateClaimPermission, ResizeClaimTooSmall, ResizeNeedMoreBlocks, NoCreativeUnClaim, ClaimResizeSuccess, ResizeFailOverlap, ResizeStart, ResizeFailOverlapSubdivision, SubdivisionStart, CreateSubdivisionOverlap, SubdivisionSuccess, CreateClaimFailOverlap, CreateClaimFailOverlapOtherPlayer, ClaimsDisabledWorld, ClaimStart, NewClaimTooSmall, CreateClaimInsufficientBlocks, AbandonClaimAdvertisement, CreateClaimFailOverlapShort, CreateClaimSuccess, SiegeWinDoorsOpen, RescueAbortedMoved, SiegeDoorsLockedEjection, NoModifyDuringSiege, OnlyOwnersModifyClaims, NoBuildUnderSiege, NoBuildPvP, NoBuildPermission, NonSiegeMaterial, NoOwnerBuildUnderSiege, NoAccessPermission, NoContainersSiege, NoContainersPermission, OwnerNameForAdminClaims, ClaimTooSmallForEntities, TooManyEntitiesInClaim, YouHaveNoClaims, ConfirmFluidRemoval, AutoBanNotify, AdjustGroupBlocksSuccess, InvalidPermissionID, UntrustOwnerOnly, HowToClaimRegex, NoBuildOutsideClaims, PlayerOfflineTime
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -859,7 +859,7 @@ class PlayerEventHandler implements Listener
|
||||||
transparentMaterials.add(Byte.valueOf((byte)Material.AIR.getId()));
|
transparentMaterials.add(Byte.valueOf((byte)Material.AIR.getId()));
|
||||||
transparentMaterials.add(Byte.valueOf((byte)Material.SNOW.getId()));
|
transparentMaterials.add(Byte.valueOf((byte)Material.SNOW.getId()));
|
||||||
transparentMaterials.add(Byte.valueOf((byte)Material.LONG_GRASS.getId()));
|
transparentMaterials.add(Byte.valueOf((byte)Material.LONG_GRASS.getId()));
|
||||||
clickedBlock = player.getTargetBlock(null, 250);
|
clickedBlock = player.getTargetBlock(transparentMaterials, 250);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exception e) //an exception intermittently comes from getTargetBlock(). when it does, just ignore the event
|
catch(Exception e) //an exception intermittently comes from getTargetBlock(). when it does, just ignore the event
|
||||||
|
|
@ -1058,6 +1058,27 @@ class PlayerEventHandler implements Listener
|
||||||
//visualize boundary
|
//visualize boundary
|
||||||
Visualization visualization = Visualization.FromClaim(claim, clickedBlock.getY(), VisualizationType.Claim, player.getLocation());
|
Visualization visualization = Visualization.FromClaim(claim, clickedBlock.getY(), VisualizationType.Claim, player.getLocation());
|
||||||
Visualization.Apply(player, visualization);
|
Visualization.Apply(player, visualization);
|
||||||
|
|
||||||
|
//if can resize this claim, tell about the boundaries
|
||||||
|
if(claim.allowEdit(player) == null)
|
||||||
|
{
|
||||||
|
GriefPrevention.sendMessage(player, TextMode.Info, " " + claim.getWidth() + "x" + claim.getHeight() + "=" + claim.getArea());
|
||||||
|
}
|
||||||
|
|
||||||
|
//if deleteclaims permission, tell about the player's offline time
|
||||||
|
if(!claim.isAdminClaim() && player.hasPermission("griefprevention.deleteclaims"))
|
||||||
|
{
|
||||||
|
PlayerData otherPlayerData = this.dataStore.getPlayerData(claim.getOwnerName());
|
||||||
|
Date lastLogin = otherPlayerData.lastLogin;
|
||||||
|
Date now = new Date();
|
||||||
|
long daysElapsed = (now.getTime() - lastLogin.getTime()) / (1000 * 60 * 60 * 24);
|
||||||
|
|
||||||
|
GriefPrevention.sendMessage(player, TextMode.Info, Messages.PlayerOfflineTime, String.valueOf(daysElapsed));
|
||||||
|
|
||||||
|
//drop the data we just loaded, if the player isn't online
|
||||||
|
if(GriefPrevention.instance.getServer().getPlayerExact(claim.getOwnerName()) == null)
|
||||||
|
this.dataStore.clearCachedPlayerData(claim.getOwnerName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
@ -1181,12 +1202,6 @@ class PlayerEventHandler implements Listener
|
||||||
|
|
||||||
Block centerBlock = clickedBlock;
|
Block centerBlock = clickedBlock;
|
||||||
|
|
||||||
//sink through a snow layer
|
|
||||||
if(centerBlock.getType() == Material.SNOW)
|
|
||||||
{
|
|
||||||
centerBlock = centerBlock.getRelative(BlockFace.DOWN);
|
|
||||||
}
|
|
||||||
|
|
||||||
int maxHeight = centerBlock.getY();
|
int maxHeight = centerBlock.getY();
|
||||||
int minx = centerBlock.getX() - playerData.fillRadius;
|
int minx = centerBlock.getX() - playerData.fillRadius;
|
||||||
int maxx = centerBlock.getX() + playerData.fillRadius;
|
int maxx = centerBlock.getX() + playerData.fillRadius;
|
||||||
|
|
@ -1217,8 +1232,8 @@ class PlayerEventHandler implements Listener
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//only replace air, spilling water, snow
|
//only replace air, spilling water, snow, long grass
|
||||||
if(block.getType() == Material.AIR || block.getType() == Material.SNOW || (block.getType() == Material.STATIONARY_WATER && block.getData() != 0))
|
if(block.getType() == Material.AIR || block.getType() == Material.SNOW || (block.getType() == Material.STATIONARY_WATER && block.getData() != 0) || block.getType() == Material.LONG_GRASS)
|
||||||
{
|
{
|
||||||
//look to neighbors for an appropriate fill block
|
//look to neighbors for an appropriate fill block
|
||||||
Block eastBlock = block.getRelative(BlockFace.EAST);
|
Block eastBlock = block.getRelative(BlockFace.EAST);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user