5.0
This commit is contained in:
parent
beec9c4e50
commit
6cb8df52c7
|
|
@ -1,7 +1,7 @@
|
||||||
name: GriefPrevention
|
name: GriefPrevention
|
||||||
main: me.ryanhamshire.GriefPrevention.GriefPrevention
|
main: me.ryanhamshire.GriefPrevention.GriefPrevention
|
||||||
softdepend: [Vault, Multiverse-Core]
|
softdepend: [Vault, Multiverse-Core]
|
||||||
version: 4.9
|
version: 5.0
|
||||||
commands:
|
commands:
|
||||||
abandonclaim:
|
abandonclaim:
|
||||||
description: Deletes a claim.
|
description: Deletes a claim.
|
||||||
|
|
|
||||||
|
|
@ -554,8 +554,8 @@ public class BlockEventHandler implements Listener
|
||||||
//if it's growing into a claim
|
//if it's growing into a claim
|
||||||
if(blockClaim != null)
|
if(blockClaim != null)
|
||||||
{
|
{
|
||||||
//if there's no owner for the new tree, or the owner doesn't have permission to build in the claim, don't grow this block
|
//if there's no owner for the new tree, or the owner for the new tree is different from the owner of the claim
|
||||||
if(fromOwner == null || fromOwner.getPlayer() == null || blockClaim.allowBuild(fromOwner.getPlayer()) != null)
|
if(fromOwner == null || !fromOwner.getName().equals(blockClaim.ownerName))
|
||||||
{
|
{
|
||||||
growEvent.getBlocks().remove(i--);
|
growEvent.getBlocks().remove(i--);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1499,7 +1499,7 @@ public class DataStore
|
||||||
this.addDefault(defaults, Messages.AdjustGroupBlocksSuccess, "Adjusted bonus claim blocks for players with the {0} permission by {1}. New total: {2}.", "0: permission; 1: adjustment amount; 2: new total bonus");
|
this.addDefault(defaults, Messages.AdjustGroupBlocksSuccess, "Adjusted bonus claim blocks for players with the {0} permission by {1}. New total: {2}.", "0: permission; 1: adjustment amount; 2: new total bonus");
|
||||||
this.addDefault(defaults, Messages.InvalidPermissionID, "Please specify a player name, or a permission in [brackets].", null);
|
this.addDefault(defaults, Messages.InvalidPermissionID, "Please specify a player name, or a permission in [brackets].", null);
|
||||||
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.");
|
||||||
|
|
||||||
//load the config file
|
//load the config file
|
||||||
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(messagesFilePath));
|
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(messagesFilePath));
|
||||||
|
|
|
||||||
|
|
@ -335,15 +335,12 @@ class EntityEventHandler implements Listener
|
||||||
//if the attacker is a player and defender is a player (pvp combat)
|
//if the attacker is a player and defender is a player (pvp combat)
|
||||||
if(attacker != null && event.getEntity() instanceof Player)
|
if(attacker != null && event.getEntity() instanceof Player)
|
||||||
{
|
{
|
||||||
//if pvp is disabled, cancel the event
|
|
||||||
if(!event.getEntity().getWorld().getPVP())
|
|
||||||
{
|
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//FEATURE: prevent pvp in the first minute after spawn, and prevent pvp when one or both players have no inventory
|
//FEATURE: prevent pvp in the first minute after spawn, and prevent pvp when one or both players have no inventory
|
||||||
|
|
||||||
|
//doesn't apply when the attacker has the no pvp immunity permission
|
||||||
|
//this rule is here to allow server owners to have a world with no spawn camp protection by assigning permissions based on the player's world
|
||||||
|
if(attacker.hasPermission("griefprevention.nopvpimmunity")) return;
|
||||||
|
|
||||||
Player defender = (Player)(event.getEntity());
|
Player defender = (Player)(event.getEntity());
|
||||||
|
|
||||||
PlayerData defenderData = this.dataStore.getPlayerData(((Player)event.getEntity()).getName());
|
PlayerData defenderData = this.dataStore.getPlayerData(((Player)event.getEntity()).getName());
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ public class GriefPrevention extends JavaPlugin
|
||||||
public boolean config_claims_preventTheft; //whether containers and crafting blocks are protectable
|
public boolean config_claims_preventTheft; //whether containers and crafting blocks are protectable
|
||||||
public boolean config_claims_protectCreatures; //whether claimed animals may be injured by players without permission
|
public boolean config_claims_protectCreatures; //whether claimed animals may be injured by players without permission
|
||||||
public boolean config_claims_preventButtonsSwitches; //whether buttons and switches are protectable
|
public boolean config_claims_preventButtonsSwitches; //whether buttons and switches are protectable
|
||||||
|
public boolean config_claims_lockAllDoors; //whether wooden doors, trap doors, fence gates, etc require permission to use
|
||||||
|
|
||||||
public int config_claims_initialBlocks; //the number of claim blocks a new player starts with
|
public int config_claims_initialBlocks; //the number of claim blocks a new player starts with
|
||||||
public int config_claims_blocksAccruedPerHour; //how many additional blocks players get each hour of play (can be zero)
|
public int config_claims_blocksAccruedPerHour; //how many additional blocks players get each hour of play (can be zero)
|
||||||
|
|
@ -214,7 +215,8 @@ public class GriefPrevention extends JavaPlugin
|
||||||
|
|
||||||
this.config_claims_preventTheft = config.getBoolean("GriefPrevention.Claims.PreventTheft", true);
|
this.config_claims_preventTheft = config.getBoolean("GriefPrevention.Claims.PreventTheft", true);
|
||||||
this.config_claims_protectCreatures = config.getBoolean("GriefPrevention.Claims.ProtectCreatures", true);
|
this.config_claims_protectCreatures = config.getBoolean("GriefPrevention.Claims.ProtectCreatures", true);
|
||||||
this.config_claims_preventButtonsSwitches = config.getBoolean("GriefPrevention.Claims.PreventButtonsSwitches", true);
|
this.config_claims_preventButtonsSwitches = config.getBoolean("GriefPrevention.Claims.PreventButtonsSwitches", true);
|
||||||
|
this.config_claims_lockAllDoors = config.getBoolean("GriefPrevention.Claims.LockAllDoors", false);
|
||||||
this.config_claims_initialBlocks = config.getInt("GriefPrevention.Claims.InitialBlocks", 100);
|
this.config_claims_initialBlocks = config.getInt("GriefPrevention.Claims.InitialBlocks", 100);
|
||||||
this.config_claims_blocksAccruedPerHour = config.getInt("GriefPrevention.Claims.BlocksAccruedPerHour", 100);
|
this.config_claims_blocksAccruedPerHour = config.getInt("GriefPrevention.Claims.BlocksAccruedPerHour", 100);
|
||||||
this.config_claims_maxAccruedBlocks = config.getInt("GriefPrevention.Claims.MaxAccruedBlocks", 80000);
|
this.config_claims_maxAccruedBlocks = config.getInt("GriefPrevention.Claims.MaxAccruedBlocks", 80000);
|
||||||
|
|
@ -351,6 +353,7 @@ public class GriefPrevention extends JavaPlugin
|
||||||
config.set("GriefPrevention.Claims.PreventTheft", this.config_claims_preventTheft);
|
config.set("GriefPrevention.Claims.PreventTheft", this.config_claims_preventTheft);
|
||||||
config.set("GriefPrevention.Claims.ProtectCreatures", this.config_claims_protectCreatures);
|
config.set("GriefPrevention.Claims.ProtectCreatures", this.config_claims_protectCreatures);
|
||||||
config.set("GriefPrevention.Claims.PreventButtonsSwitches", this.config_claims_preventButtonsSwitches);
|
config.set("GriefPrevention.Claims.PreventButtonsSwitches", this.config_claims_preventButtonsSwitches);
|
||||||
|
config.set("GriefPrevention.Claims.LockAllDoors", this.config_claims_lockAllDoors);
|
||||||
config.set("GriefPrevention.Claims.InitialBlocks", this.config_claims_initialBlocks);
|
config.set("GriefPrevention.Claims.InitialBlocks", this.config_claims_initialBlocks);
|
||||||
config.set("GriefPrevention.Claims.BlocksAccruedPerHour", this.config_claims_blocksAccruedPerHour);
|
config.set("GriefPrevention.Claims.BlocksAccruedPerHour", this.config_claims_blocksAccruedPerHour);
|
||||||
config.set("GriefPrevention.Claims.MaxAccruedBlocks", this.config_claims_maxAccruedBlocks);
|
config.set("GriefPrevention.Claims.MaxAccruedBlocks", this.config_claims_maxAccruedBlocks);
|
||||||
|
|
@ -948,6 +951,11 @@ public class GriefPrevention extends JavaPlugin
|
||||||
return false; //causes usage to be displayed
|
return false; //causes usage to be displayed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(blockCount <= 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//correct block count to max allowed
|
//correct block count to max allowed
|
||||||
if(blockCount > maxPurchasable)
|
if(blockCount > maxPurchasable)
|
||||||
{
|
{
|
||||||
|
|
@ -1015,6 +1023,11 @@ public class GriefPrevention extends JavaPlugin
|
||||||
return false; //causes usage to be displayed
|
return false; //causes usage to be displayed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(blockCount <= 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//if he doesn't have enough blocks, tell him so
|
//if he doesn't have enough blocks, tell him so
|
||||||
if(blockCount > availableBlocks)
|
if(blockCount > availableBlocks)
|
||||||
{
|
{
|
||||||
|
|
@ -1687,6 +1700,9 @@ public class GriefPrevention extends JavaPlugin
|
||||||
//if anti spawn camping feature is not enabled, do nothing
|
//if anti spawn camping feature is not enabled, do nothing
|
||||||
if(!this.config_pvp_protectFreshSpawns) return;
|
if(!this.config_pvp_protectFreshSpawns) return;
|
||||||
|
|
||||||
|
//if the player has the damage any player permission enabled, do nothing
|
||||||
|
if(player.hasPermission("griefprevention.nopvpimmunity")) return;
|
||||||
|
|
||||||
//check inventory for well, anything
|
//check inventory for well, anything
|
||||||
PlayerInventory inventory = player.getInventory();
|
PlayerInventory inventory = player.getInventory();
|
||||||
ItemStack [] armorStacks = inventory.getArmorContents();
|
ItemStack [] armorStacks = inventory.getArmorContents();
|
||||||
|
|
|
||||||
|
|
@ -126,19 +126,11 @@ class PlayerEventHandler implements Listener
|
||||||
boolean spam = false;
|
boolean spam = false;
|
||||||
boolean muted = false;
|
boolean muted = false;
|
||||||
|
|
||||||
//single-character messages will not be sent
|
|
||||||
if(message.length() == 1)
|
|
||||||
{
|
|
||||||
playerData.spamCount++;
|
|
||||||
spam = true;
|
|
||||||
muted = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//check message content and timing
|
//check message content and timing
|
||||||
long millisecondsSinceLastMessage = (new Date()).getTime() - playerData.lastMessageTimestamp.getTime();
|
long millisecondsSinceLastMessage = (new Date()).getTime() - playerData.lastMessageTimestamp.getTime();
|
||||||
|
|
||||||
//if the message came too close to the last one
|
//if the message came too close to the last one
|
||||||
if(millisecondsSinceLastMessage < 3000)
|
if(millisecondsSinceLastMessage < 2000)
|
||||||
{
|
{
|
||||||
//increment the spam counter
|
//increment the spam counter
|
||||||
playerData.spamCount++;
|
playerData.spamCount++;
|
||||||
|
|
@ -209,7 +201,7 @@ class PlayerEventHandler implements Listener
|
||||||
if(!player.hasPermission("griefprevention.spam") && spam)
|
if(!player.hasPermission("griefprevention.spam") && spam)
|
||||||
{
|
{
|
||||||
//anything above level 4 for a player which has received a warning... kick or if enabled, ban
|
//anything above level 4 for a player which has received a warning... kick or if enabled, ban
|
||||||
if(playerData.spamCount > 4 && playerData.spamWarned)
|
if(playerData.spamCount > 8 && playerData.spamWarned)
|
||||||
{
|
{
|
||||||
if(GriefPrevention.instance.config_spam_banOffenders)
|
if(GriefPrevention.instance.config_spam_banOffenders)
|
||||||
{
|
{
|
||||||
|
|
@ -913,6 +905,22 @@ class PlayerEventHandler implements Listener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//otherwise apply rules for doors, if configured that way
|
||||||
|
else if(GriefPrevention.instance.config_claims_lockAllDoors && (clickedBlockType == Material.WOOD_DOOR || clickedBlockType == Material.WOODEN_DOOR || clickedBlockType == Material.TRAP_DOOR || clickedBlockType == Material.FENCE_GATE))
|
||||||
|
{
|
||||||
|
Claim claim = this.dataStore.getClaimAt(clickedBlock.getLocation(), false, null);
|
||||||
|
if(claim != null)
|
||||||
|
{
|
||||||
|
String noAccessReason = claim.allowAccess(player);
|
||||||
|
if(noAccessReason != null)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
GriefPrevention.sendMessage(player, TextMode.Err, noAccessReason);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//otherwise apply rules for buttons and switches
|
//otherwise apply rules for buttons and switches
|
||||||
else if(GriefPrevention.instance.config_claims_preventButtonsSwitches && (clickedBlockType == null || clickedBlockType == Material.STONE_BUTTON || clickedBlockType == Material.LEVER))
|
else if(GriefPrevention.instance.config_claims_preventButtonsSwitches && (clickedBlockType == null || clickedBlockType == Material.STONE_BUTTON || clickedBlockType == Material.LEVER))
|
||||||
{
|
{
|
||||||
|
|
@ -937,8 +945,8 @@ class PlayerEventHandler implements Listener
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//apply rule for note blocks
|
//apply rule for note blocks and repeaters
|
||||||
else if(clickedBlockType == Material.NOTE_BLOCK)
|
else if(clickedBlockType == Material.NOTE_BLOCK || clickedBlockType == Material.DIODE_BLOCK_ON || clickedBlockType == Material.DIODE_BLOCK_OFF)
|
||||||
{
|
{
|
||||||
Claim claim = this.dataStore.getClaimAt(clickedBlock.getLocation(), false, null);
|
Claim claim = this.dataStore.getClaimAt(clickedBlock.getLocation(), false, null);
|
||||||
if(claim != null)
|
if(claim != null)
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ public class Visualization
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cornerMaterial = Material.LAVA;
|
cornerMaterial = Material.GLOWING_REDSTONE_ORE;
|
||||||
accentMaterial = Material.NETHERRACK;
|
accentMaterial = Material.NETHERRACK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user