7.0
This commit is contained in:
parent
e09a6732ba
commit
7f600e7098
12
plugin.yml
12
plugin.yml
|
|
@ -2,7 +2,7 @@ name: GriefPrevention
|
|||
main: me.ryanhamshire.GriefPrevention.GriefPrevention
|
||||
softdepend: [Vault, Multiverse-Core, My Worlds, MystCraft, Transporter]
|
||||
dev-url: http://dev.bukkit.org/server-mods/grief-prevention
|
||||
version: 6.9
|
||||
version: 7.0
|
||||
commands:
|
||||
abandonclaim:
|
||||
description: Deletes a claim.
|
||||
|
|
@ -89,12 +89,12 @@ commands:
|
|||
description: Purchases additional claim blocks with server money. Doesn't work on servers without a Vault-compatible economy plugin.
|
||||
usage: /BuyClaimBlocks <numberOfBlocks>
|
||||
aliases: buyclaim
|
||||
permission: griefprevention.claims
|
||||
permission: griefprevention.buysellclaimblocks
|
||||
sellclaimblocks:
|
||||
description: Sells your claim blocks for server money. Doesn't work on servers without a Vault-compatible economy plugin.
|
||||
usage: /SellClaimBlocks <numberOfBlocks>
|
||||
aliases: sellclaim
|
||||
permission: griefprevention.claims
|
||||
permission: griefprevention.buysellclaimblocks
|
||||
trapped:
|
||||
description: Ejects you to nearby unclaimed land. Has a substantial cooldown period.
|
||||
usage: /Trapped
|
||||
|
|
@ -124,8 +124,7 @@ commands:
|
|||
permission: griefprevention.deathblow
|
||||
claimslist:
|
||||
description: Lists information about a player's claim blocks and claims.
|
||||
usage: /ClaimsList <player>
|
||||
permission: griefprevention.adjustclaimblocks
|
||||
usage: /ClaimsList or /ClaimsList <player>
|
||||
permissions:
|
||||
griefprevention.createclaims:
|
||||
description: Grants permission to create claims.
|
||||
|
|
@ -176,3 +175,6 @@ permissions:
|
|||
griefprevention.claims:
|
||||
description: Grants access to claim-related slash commands.
|
||||
default: true
|
||||
griefprevention.buysellclaimblocks:
|
||||
description: Grants access to claim block buy/sell commands.
|
||||
default: true
|
||||
|
|
@ -150,6 +150,9 @@ public class BlockEventHandler implements Listener
|
|||
return;
|
||||
}
|
||||
|
||||
//if a player is in pvp combat, he can't give away items
|
||||
if(playerData.inPvpCombat()) return;
|
||||
|
||||
//NOTE: to eliminate accidental give-aways, first hit on a chest displays a confirmation message
|
||||
//subsequent hits donate item to the chest
|
||||
|
||||
|
|
@ -266,7 +269,7 @@ public class BlockEventHandler implements Listener
|
|||
//FEATURE: limit fire placement, to prevent PvP-by-fire
|
||||
|
||||
//if placed block is fire and pvp is off, apply rules for proximity to other players
|
||||
if(block.getType() == Material.FIRE && !block.getWorld().getPVP() && !player.hasPermission("griefprevention.lava"))
|
||||
if(block.getType() == Material.FIRE && !GriefPrevention.instance.config_pvp_enabledWorlds.contains(block.getWorld()) && !player.hasPermission("griefprevention.lava"))
|
||||
{
|
||||
List<Player> players = block.getWorld().getPlayers();
|
||||
for(int i = 0; i < players.size(); i++)
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ public class Claim
|
|||
//administrative claims are created and maintained by players with the griefprevention.adminclaims permission.
|
||||
public boolean isAdminClaim()
|
||||
{
|
||||
return this.ownerName.isEmpty();
|
||||
return (this.ownerName == null || this.ownerName.isEmpty());
|
||||
}
|
||||
|
||||
//accessor for ID
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
GriefPrevention Server Plugin for Minecraft
|
||||
Copyright (C) 2011 Ryan Hamshire
|
||||
Copyright (C) 2012 Ryan Hamshire
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -1,3 +1,21 @@
|
|||
/*
|
||||
GriefPrevention Server Plugin for Minecraft
|
||||
Copyright (C) 2012 Ryan Hamshire
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package me.ryanhamshire.GriefPrevention;
|
||||
|
||||
public class CustomizableMessage
|
||||
|
|
|
|||
|
|
@ -884,7 +884,7 @@ public abstract class DataStore
|
|||
this.addDefault(defaults, Messages.AutomaticClaimNotification, "This chest and nearby blocks are protected from breakage and theft. The temporary gold and glowstone blocks mark the protected area. To toggle them on and off, right-click with a stick.", null);
|
||||
this.addDefault(defaults, Messages.TrustCommandAdvertisement, "Use the /trust command to grant other players access.", null);
|
||||
this.addDefault(defaults, Messages.GoldenShovelAdvertisement, "To claim more land, you need a golden shovel. When you equip one, you'll get more information.", null);
|
||||
this.addDefault(defaults, Messages.UnprotectedChestWarning, "This chest is NOT protected. Consider expanding an existing claim or creating a new one.", null);
|
||||
this.addDefault(defaults, Messages.UnprotectedChestWarning, "This chest is NOT protected. Consider using a golden shovel to expand an existing claim or to create a new one.", null);
|
||||
this.addDefault(defaults, Messages.ThatPlayerPvPImmune, "You can't injure defenseless players.", null);
|
||||
this.addDefault(defaults, Messages.CantFightWhileImmune, "You can't fight someone while you're protected from PvP.", null);
|
||||
this.addDefault(defaults, Messages.NoDamageClaimedEntity, "That belongs to {0}.", "0: owner name");
|
||||
|
|
@ -893,7 +893,7 @@ public abstract class DataStore
|
|||
this.addDefault(defaults, Messages.CreativeBasicsDemoAdvertisement, "Land Claim Help: http://tinyurl.com/c7bajb8", null);
|
||||
this.addDefault(defaults, Messages.SurvivalBasicsDemoAdvertisement, "Land Claim Help: http://tinyurl.com/6nkwegj", null);
|
||||
this.addDefault(defaults, Messages.TrappedChatKeyword, "trapped", "When mentioned in chat, players get information about the /trapped command.");
|
||||
this.addDefault(defaults, Messages.TrappedInstructions, "Are you trapped in someone's claim? Consider the /trapped command.", null);
|
||||
this.addDefault(defaults, Messages.TrappedInstructions, "Are you trapped in someone's land claim? Try the /trapped command.", null);
|
||||
this.addDefault(defaults, Messages.PvPNoDrop, "You can't drop items while in PvP combat.", null);
|
||||
this.addDefault(defaults, Messages.SiegeNoTeleport, "You can't teleport out of a besieged area.", null);
|
||||
this.addDefault(defaults, Messages.BesiegedNoTeleport, "You can't teleport into a besieged area.", null);
|
||||
|
|
@ -952,7 +952,7 @@ public abstract class DataStore
|
|||
this.addDefault(defaults, Messages.HowToClaimRegex, "(^|.*\\W)how\\W.*\\W(claim|protect|lock)(\\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.PlayerOfflineTime, " Last login: {0} days ago.", "0: number of full days since last login");
|
||||
this.addDefault(defaults, Messages.BuildingOutsideClaims, "Other players can undo your work here! Consider claiming this area to protect your work.", null);
|
||||
this.addDefault(defaults, Messages.BuildingOutsideClaims, "Other players can undo your work here! Consider using a golden shovel to claim this area so that your work will be protected.", null);
|
||||
this.addDefault(defaults, Messages.TrappedWontWorkHere, "Sorry, unable to find a safe location to teleport you to. Contact an admin, or consider /kill if you don't want to wait.", null);
|
||||
this.addDefault(defaults, Messages.CommandBannedInPvP, "You can't use that command while in PvP combat.", null);
|
||||
this.addDefault(defaults, Messages.UnclaimCleanupWarning, "The land you've unclaimed may be changed by other players or cleaned up by administrators. If you've built something there you want to keep, you should reclaim it.", null);
|
||||
|
|
@ -961,6 +961,8 @@ public abstract class DataStore
|
|||
this.addDefault(defaults, Messages.NoTNTDamageAboveSeaLevel, "Warning: TNT will not destroy blocks above sea level.", null);
|
||||
this.addDefault(defaults, Messages.NoTNTDamageClaims, "Warning: TNT will not destroy claimed blocks.", null);
|
||||
this.addDefault(defaults, Messages.IgnoreClaimsAdvertisement, "To override, use /IgnoreClaims.", null);
|
||||
this.addDefault(defaults, Messages.NoPermissionForCommand, "You don't have permission to do that.", null);
|
||||
this.addDefault(defaults, Messages.ClaimsListNoPermission, "You don't have permission to get information about another player's land claims.", null);
|
||||
|
||||
//load the config file
|
||||
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(messagesFilePath));
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
GriefPrevention Server Plugin for Minecraft
|
||||
Copyright (C) 2011 Ryan Hamshire
|
||||
Copyright (C) 2012 Ryan Hamshire
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
GriefPrevention Server Plugin for Minecraft
|
||||
Copyright (C) 2011 Ryan Hamshire
|
||||
Copyright (C) 2012 Ryan Hamshire
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import org.bukkit.entity.LivingEntity;
|
|||
import org.bukkit.entity.Monster;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.ThrownPotion;
|
||||
import org.bukkit.entity.Villager;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
|
@ -361,7 +362,7 @@ class EntityEventHandler implements Listener
|
|||
}
|
||||
|
||||
//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 && GriefPrevention.instance.config_pvp_enabledWorlds.contains(attacker.getWorld()))
|
||||
{
|
||||
//FEATURE: prevent pvp in the first minute after spawn, and prevent pvp when one or both players have no inventory
|
||||
|
||||
|
|
@ -425,11 +426,22 @@ class EntityEventHandler implements Listener
|
|||
//if it's claimed
|
||||
if(claim != null)
|
||||
{
|
||||
//if damaged by anything other than a player, cancel the event
|
||||
//if damaged by anything other than a player (exception villagers injured by zombies in admin claims), cancel the event
|
||||
//why exception? so admins can set up a village which can't be CHANGED by players, but must be "protected" by players.
|
||||
if(attacker == null)
|
||||
{
|
||||
//exception case
|
||||
if(event.getEntity() instanceof Villager && damageSource instanceof Monster && claim.isAdminClaim())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//all other cases
|
||||
else
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
//otherwise the player damaging the entity must have permission
|
||||
else
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
GriefPrevention Server Plugin for Minecraft
|
||||
Copyright (C) 2011 Ryan Hamshire
|
||||
Copyright (C) 2012 Ryan Hamshire
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ public class GriefPrevention extends JavaPlugin
|
|||
public String config_spam_warningMessage; //message to show a player who is close to spam level
|
||||
public String config_spam_allowedIpAddresses; //IP addresses which will not be censored
|
||||
|
||||
public ArrayList<World> config_pvp_enabledWorlds; //list of worlds where pvp anti-grief rules apply
|
||||
public boolean config_pvp_protectFreshSpawns; //whether to make newly spawned players immune until they pick up an item
|
||||
public boolean config_pvp_punishLogout; //whether to kill players who log out during PvP combat
|
||||
public int config_pvp_combatTimeoutSeconds; //how long combat is considered to continue after the most recent damage
|
||||
|
|
@ -238,6 +239,40 @@ public class GriefPrevention extends JavaPlugin
|
|||
}
|
||||
}
|
||||
|
||||
//default for pvp worlds list
|
||||
ArrayList<String> defaultPvpWorldNames = new ArrayList<String>();
|
||||
for(int i = 0; i < worlds.size(); i++)
|
||||
{
|
||||
World world = worlds.get(i);
|
||||
if(world.getPVP())
|
||||
{
|
||||
defaultPvpWorldNames.add(world.getName());
|
||||
}
|
||||
}
|
||||
|
||||
//get pvp world names from the config file
|
||||
List<String> pvpEnabledWorldNames = config.getStringList("GriefPrevention.PvP.Worlds");
|
||||
if(pvpEnabledWorldNames == null || pvpEnabledWorldNames.size() == 0)
|
||||
{
|
||||
pvpEnabledWorldNames = defaultPvpWorldNames;
|
||||
}
|
||||
|
||||
//validate that list
|
||||
this.config_pvp_enabledWorlds = new ArrayList<World>();
|
||||
for(int i = 0; i < pvpEnabledWorldNames.size(); i++)
|
||||
{
|
||||
String worldName = pvpEnabledWorldNames.get(i);
|
||||
World world = this.getServer().getWorld(worldName);
|
||||
if(world == null)
|
||||
{
|
||||
AddLogEntry("Error: PvP Configuration: There's no world named \"" + worldName + "\". Please update your config.yml.");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.config_pvp_enabledWorlds.add(world);
|
||||
}
|
||||
}
|
||||
|
||||
//sea level
|
||||
this.config_seaLevelOverride = new HashMap<String, Integer>();
|
||||
for(int i = 0; i < worlds.size(); i++)
|
||||
|
|
@ -525,6 +560,7 @@ public class GriefPrevention extends JavaPlugin
|
|||
config.set("GriefPrevention.Spam.BanMessage", this.config_spam_banMessage);
|
||||
config.set("GriefPrevention.Spam.AllowedIpAddresses", this.config_spam_allowedIpAddresses);
|
||||
|
||||
config.set("GriefPrevention.PvP.Worlds", pvpEnabledWorldNames);
|
||||
config.set("GriefPrevention.PvP.ProtectFreshSpawns", this.config_pvp_protectFreshSpawns);
|
||||
config.set("GriefPrevention.PvP.PunishLogout", this.config_pvp_punishLogout);
|
||||
config.set("GriefPrevention.PvP.CombatTimeoutSeconds", this.config_pvp_combatTimeoutSeconds);
|
||||
|
|
@ -1148,6 +1184,12 @@ public class GriefPrevention extends JavaPlugin
|
|||
return true;
|
||||
}
|
||||
|
||||
if(!player.hasPermission("griefprevention.buysellclaimblocks"))
|
||||
{
|
||||
GriefPrevention.sendMessage(player, TextMode.Err, Messages.NoPermissionForCommand);
|
||||
return true;
|
||||
}
|
||||
|
||||
//if purchase disabled, send error message
|
||||
if(GriefPrevention.instance.config_economy_claimBlocksPurchaseCost == 0)
|
||||
{
|
||||
|
|
@ -1233,6 +1275,12 @@ public class GriefPrevention extends JavaPlugin
|
|||
return true;
|
||||
}
|
||||
|
||||
if(!player.hasPermission("griefprevention.buysellclaimblocks"))
|
||||
{
|
||||
GriefPrevention.sendMessage(player, TextMode.Err, Messages.NoPermissionForCommand);
|
||||
return true;
|
||||
}
|
||||
|
||||
//if disabled, error message
|
||||
if(GriefPrevention.instance.config_economy_claimBlocksSellValue == 0)
|
||||
{
|
||||
|
|
@ -1404,21 +1452,40 @@ public class GriefPrevention extends JavaPlugin
|
|||
return true;
|
||||
}
|
||||
|
||||
//claimslist <player>
|
||||
//claimslist or claimslist <player>
|
||||
else if(cmd.getName().equalsIgnoreCase("claimslist"))
|
||||
{
|
||||
//requires exactly one parameter, the other player's name
|
||||
if(args.length != 1) return false;
|
||||
//at most one parameter
|
||||
if(args.length > 1) return false;
|
||||
|
||||
//try to find that player
|
||||
OfflinePlayer otherPlayer = this.resolvePlayer(args[0]);
|
||||
//player whose claims will be listed
|
||||
OfflinePlayer otherPlayer;
|
||||
|
||||
//if another player isn't specified, assume current player
|
||||
if(args.length < 1)
|
||||
{
|
||||
otherPlayer = player;
|
||||
}
|
||||
|
||||
//otherwise if no permission to delve into another player's claims data
|
||||
else if(!player.hasPermission("griefprevention.deleteclaims"))
|
||||
{
|
||||
GriefPrevention.sendMessage(player, TextMode.Err, Messages.ClaimsListNoPermission);
|
||||
return true;
|
||||
}
|
||||
|
||||
//otherwise try to find the specified player
|
||||
else
|
||||
{
|
||||
otherPlayer = this.resolvePlayer(args[0]);
|
||||
if(otherPlayer == null)
|
||||
{
|
||||
GriefPrevention.sendMessage(player, TextMode.Err, Messages.PlayerNotFound);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//load the player's data
|
||||
//load the target player's data
|
||||
PlayerData playerData = this.dataStore.getPlayerData(otherPlayer.getName());
|
||||
GriefPrevention.sendMessage(player, TextMode.Instr, " " + playerData.accruedClaimBlocks + "(+" + playerData.bonusClaimBlocks + ")=" + (playerData.accruedClaimBlocks + playerData.bonusClaimBlocks));
|
||||
for(int i = 0; i < playerData.claims.size(); i++)
|
||||
|
|
@ -1597,6 +1664,13 @@ public class GriefPrevention extends JavaPlugin
|
|||
return true;
|
||||
}
|
||||
|
||||
//if the player is in an administrative claim, he should contact an admin
|
||||
if(claim.isAdminClaim())
|
||||
{
|
||||
GriefPrevention.sendMessage(player, TextMode.Err, Messages.TrappedWontWorkHere);
|
||||
return true;
|
||||
}
|
||||
|
||||
//check cooldown
|
||||
long lastTrappedUsage = playerData.lastTrappedUsage.getTime();
|
||||
long nextTrappedUsage = lastTrappedUsage + 1000 * 60 * 60 * this.config_claims_trappedCooldownHours;
|
||||
|
|
@ -2003,7 +2077,7 @@ public class GriefPrevention extends JavaPlugin
|
|||
public void checkPvpProtectionNeeded(Player player)
|
||||
{
|
||||
//if pvp is disabled, do nothing
|
||||
if(!player.getWorld().getPVP()) return;
|
||||
if(!this.config_pvp_enabledWorlds.contains(player.getWorld())) return;
|
||||
|
||||
//if player is in creative mode, do nothing
|
||||
if(player.getGameMode() == GameMode.CREATIVE) return;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,21 @@
|
|||
/*
|
||||
GriefPrevention Server Plugin for Minecraft
|
||||
Copyright (C) 2012 Ryan Hamshire
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package me.ryanhamshire.GriefPrevention;
|
||||
|
||||
import java.net.InetAddress;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,21 @@
|
|||
/*
|
||||
GriefPrevention Server Plugin for Minecraft
|
||||
Copyright (C) 2012 Ryan Hamshire
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package me.ryanhamshire.GriefPrevention;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,21 @@
|
|||
/*
|
||||
GriefPrevention Server Plugin for Minecraft
|
||||
Copyright (C) 2012 Ryan Hamshire
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package me.ryanhamshire.GriefPrevention;
|
||||
|
||||
//represents a material or collection of materials
|
||||
|
|
|
|||
|
|
@ -1,6 +1,24 @@
|
|||
/*
|
||||
GriefPrevention Server Plugin for Minecraft
|
||||
Copyright (C) 2012 Ryan Hamshire
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package me.ryanhamshire.GriefPrevention;
|
||||
|
||||
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, PlayerOfflineTime, BuildingOutsideClaims, TrappedWontWorkHere, CommandBannedInPvP, UnclaimCleanupWarning, BuySellNotConfigured, NoTeleportPvPCombat, NoTNTDamageAboveSeaLevel, NoTNTDamageClaims, IgnoreClaimsAdvertisement
|
||||
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, BuildingOutsideClaims, TrappedWontWorkHere, CommandBannedInPvP, UnclaimCleanupWarning, BuySellNotConfigured, NoTeleportPvPCombat, NoTNTDamageAboveSeaLevel, NoTNTDamageClaims, IgnoreClaimsAdvertisement, NoPermissionForCommand, ClaimsListNoPermission
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,23 +125,26 @@ class PlayerEventHandler implements Listener
|
|||
//if the player has permission to spam, don't bother even examining the message
|
||||
if(player.hasPermission("griefprevention.spam")) return false;
|
||||
|
||||
//remedy any CAPS SPAM without bothering to fault the player for it
|
||||
boolean spam = false;
|
||||
boolean muted = false;
|
||||
|
||||
PlayerData playerData = this.dataStore.getPlayerData(player.getName());
|
||||
|
||||
//remedy any CAPS SPAM, exception for very short messages which could be emoticons like =D or XD
|
||||
if(message.length() > 4 && this.stringsAreSimilar(message.toUpperCase(), message))
|
||||
{
|
||||
if(event instanceof AsyncPlayerChatEvent)
|
||||
//exception for strings containing forward slash to avoid changing a case-sensitive URL
|
||||
if(event instanceof AsyncPlayerChatEvent && !message.contains("/"))
|
||||
{
|
||||
((AsyncPlayerChatEvent)event).setMessage(message.toLowerCase());
|
||||
playerData.spamCount++;
|
||||
spam = true;
|
||||
}
|
||||
}
|
||||
|
||||
//where other types of spam are concerned, casing isn't significant
|
||||
message = message.toLowerCase();
|
||||
|
||||
PlayerData playerData = this.dataStore.getPlayerData(player.getName());
|
||||
|
||||
boolean spam = false;
|
||||
boolean muted = false;
|
||||
|
||||
//check message content and timing
|
||||
long millisecondsSinceLastMessage = (new Date()).getTime() - playerData.lastMessageTimestamp.getTime();
|
||||
|
||||
|
|
@ -363,7 +366,7 @@ class PlayerEventHandler implements Listener
|
|||
|
||||
//if in pvp, block any pvp-banned slash commands
|
||||
PlayerData playerData = this.dataStore.getPlayerData(event.getPlayer().getName());
|
||||
if(playerData.inPvpCombat() && GriefPrevention.instance.config_pvp_blockedCommands.contains(command))
|
||||
if((playerData.inPvpCombat() || playerData.siegeData != null) && GriefPrevention.instance.config_pvp_blockedCommands.contains(command))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
GriefPrevention.sendMessage(event.getPlayer(), TextMode.Err, Messages.CommandBannedInPvP);
|
||||
|
|
@ -642,17 +645,10 @@ class PlayerEventHandler implements Listener
|
|||
if(event.getCause() == TeleportCause.ENDER_PEARL) return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
PlayerData playerData = this.dataStore.getPlayerData(player.getName());
|
||||
if(playerData.inPvpCombat())
|
||||
{
|
||||
GriefPrevention.sendMessage(player, TextMode.Err, Messages.NoTeleportPvPCombat);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
Location source = event.getFrom();
|
||||
Claim sourceClaim = this.dataStore.getClaimAt(source, false, null);
|
||||
Claim sourceClaim = this.dataStore.getClaimAt(source, false, playerData.lastClaim);
|
||||
if(sourceClaim != null && sourceClaim.siegeData != null)
|
||||
{
|
||||
GriefPrevention.sendMessage(player, TextMode.Err, Messages.SiegeNoTeleport);
|
||||
|
|
@ -875,7 +871,7 @@ class PlayerEventHandler implements Listener
|
|||
}
|
||||
|
||||
//lava buckets can't be dumped near other players unless pvp is on
|
||||
if(!block.getWorld().getPVP() && !player.hasPermission("griefprevention.lava"))
|
||||
if(!GriefPrevention.instance.config_pvp_enabledWorlds.contains(block.getWorld()) && !player.hasPermission("griefprevention.lava"))
|
||||
{
|
||||
if(bucketEvent.getBucket() == Material.LAVA_BUCKET)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
GriefPrevention Server Plugin for Minecraft
|
||||
Copyright (C) 2011 Ryan Hamshire
|
||||
Copyright (C) 2012 Ryan Hamshire
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
GriefPrevention Server Plugin for Minecraft
|
||||
Copyright (C) 2011 Ryan Hamshire
|
||||
Copyright (C) 2012 Ryan Hamshire
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
GriefPrevention Server Plugin for Minecraft
|
||||
Copyright (C) 2011 Ryan Hamshire
|
||||
Copyright (C) 2012 Ryan Hamshire
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
GriefPrevention Server Plugin for Minecraft
|
||||
Copyright (C) 2011 Ryan Hamshire
|
||||
Copyright (C) 2012 Ryan Hamshire
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
GriefPrevention Server Plugin for Minecraft
|
||||
Copyright (C) 2011 Ryan Hamshire
|
||||
Copyright (C) 2012 Ryan Hamshire
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
GriefPrevention Server Plugin for Minecraft
|
||||
Copyright (C) 2011 Ryan Hamshire
|
||||
Copyright (C) 2012 Ryan Hamshire
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
GriefPrevention Server Plugin for Minecraft
|
||||
Copyright (C) 2011 Ryan Hamshire
|
||||
Copyright (C) 2012 Ryan Hamshire
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
GriefPrevention Server Plugin for Minecraft
|
||||
Copyright (C) 2011 Ryan Hamshire
|
||||
Copyright (C) 2012 Ryan Hamshire
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
GriefPrevention Server Plugin for Minecraft
|
||||
Copyright (C) 2011 Ryan Hamshire
|
||||
Copyright (C) 2012 Ryan Hamshire
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
GriefPrevention Server Plugin for Minecraft
|
||||
Copyright (C) 2011 Ryan Hamshire
|
||||
Copyright (C) 2012 Ryan Hamshire
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
GriefPrevention Server Plugin for Minecraft
|
||||
Copyright (C) 2011 Ryan Hamshire
|
||||
Copyright (C) 2012 Ryan Hamshire
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
GriefPrevention Server Plugin for Minecraft
|
||||
Copyright (C) 2011 Ryan Hamshire
|
||||
Copyright (C) 2012 Ryan Hamshire
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
GriefPrevention Server Plugin for Minecraft
|
||||
Copyright (C) 2011 Ryan Hamshire
|
||||
Copyright (C) 2012 Ryan Hamshire
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
GriefPrevention Server Plugin for Minecraft
|
||||
Copyright (C) 2011 Ryan Hamshire
|
||||
Copyright (C) 2012 Ryan Hamshire
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user