7.2
This commit is contained in:
parent
239f069d2b
commit
6fa1b7340c
|
|
@ -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: 7.1.2
|
||||
version: 7.2
|
||||
commands:
|
||||
abandonclaim:
|
||||
description: Deletes a claim.
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ public abstract class DataStore
|
|||
{
|
||||
String groupName = iterator.next();
|
||||
Player player = GriefPrevention.instance.getServer().getPlayer(playerName);
|
||||
if(player.hasPermission(groupName))
|
||||
if(player != null && player.hasPermission(groupName))
|
||||
{
|
||||
bonusBlocks += this.permissionToBonusBlocksMap.get(groupName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ public class GriefPrevention extends JavaPlugin
|
|||
public String config_spam_banMessage; //message to show an automatically banned player
|
||||
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 int config_spam_deathMessageCooldownSeconds; //cooldown period for death messages (per player) in seconds
|
||||
|
||||
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
|
||||
|
|
@ -324,6 +325,7 @@ public class GriefPrevention extends JavaPlugin
|
|||
this.config_spam_banOffenders = config.getBoolean("GriefPrevention.Spam.BanOffenders", true);
|
||||
this.config_spam_banMessage = config.getString("GriefPrevention.Spam.BanMessage", "Banned for spam.");
|
||||
String slashCommandsToMonitor = config.getString("GriefPrevention.Spam.MonitorSlashCommands", "/me;/tell;/global;/local");
|
||||
this.config_spam_deathMessageCooldownSeconds = config.getInt("GriefPrevention.Spam.DeathMessageCooldownSeconds", 60);
|
||||
|
||||
this.config_pvp_protectFreshSpawns = config.getBoolean("GriefPrevention.PvP.ProtectFreshSpawns", true);
|
||||
this.config_pvp_punishLogout = config.getBoolean("GriefPrevention.PvP.PunishLogout", true);
|
||||
|
|
@ -561,6 +563,7 @@ public class GriefPrevention extends JavaPlugin
|
|||
config.set("GriefPrevention.Spam.BanOffenders", this.config_spam_banOffenders);
|
||||
config.set("GriefPrevention.Spam.BanMessage", this.config_spam_banMessage);
|
||||
config.set("GriefPrevention.Spam.AllowedIpAddresses", this.config_spam_allowedIpAddresses);
|
||||
config.set("GriefPrevention.Spam.DeathMessageCooldownSeconds", this.config_spam_deathMessageCooldownSeconds);
|
||||
|
||||
config.set("GriefPrevention.PvP.Worlds", pvpEnabledWorldNames);
|
||||
config.set("GriefPrevention.PvP.ProtectFreshSpawns", this.config_pvp_protectFreshSpawns);
|
||||
|
|
@ -903,11 +906,6 @@ public class GriefPrevention extends JavaPlugin
|
|||
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.TransferClaimMissing);
|
||||
return true;
|
||||
}
|
||||
else if(!claim.isAdminClaim())
|
||||
{
|
||||
GriefPrevention.sendMessage(player, TextMode.Err, Messages.TransferClaimAdminOnly);
|
||||
return true;
|
||||
}
|
||||
|
||||
OfflinePlayer targetPlayer = this.resolvePlayer(args[0]);
|
||||
if(targetPlayer == null)
|
||||
|
|
@ -1493,7 +1491,7 @@ public class GriefPrevention extends JavaPlugin
|
|||
|
||||
//load the target player's data
|
||||
PlayerData playerData = this.dataStore.getPlayerData(otherPlayer.getName());
|
||||
GriefPrevention.sendMessage(player, TextMode.Instr, " " + playerData.accruedClaimBlocks + "(+" + playerData.bonusClaimBlocks + this.dataStore.getGroupBonusBlocks(otherPlayer.getName()) + ")=" + (playerData.accruedClaimBlocks + playerData.bonusClaimBlocks + this.dataStore.getGroupBonusBlocks(otherPlayer.getName())));
|
||||
GriefPrevention.sendMessage(player, TextMode.Instr, " " + playerData.accruedClaimBlocks + "(+" + (playerData.bonusClaimBlocks + this.dataStore.getGroupBonusBlocks(otherPlayer.getName())) + ")=" + (playerData.accruedClaimBlocks + playerData.bonusClaimBlocks + this.dataStore.getGroupBonusBlocks(otherPlayer.getName())));
|
||||
for(int i = 0; i < playerData.claims.size(); i++)
|
||||
{
|
||||
Claim claim = playerData.claims.get(i);
|
||||
|
|
@ -2392,7 +2390,7 @@ public class GriefPrevention extends JavaPlugin
|
|||
SendPlayerMessageTask task = new SendPlayerMessageTask(player, color, message);
|
||||
if(delayInTicks > 0)
|
||||
{
|
||||
GriefPrevention.instance.getServer().getScheduler().scheduleAsyncDelayedTask(GriefPrevention.instance, task, delayInTicks);
|
||||
GriefPrevention.instance.getServer().getScheduler().runTaskLater(GriefPrevention.instance, task, delayInTicks);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -2537,7 +2535,7 @@ public class GriefPrevention extends JavaPlugin
|
|||
//create task
|
||||
//when done processing, this task will create a main thread task to actually update the world with processing results
|
||||
RestoreNatureProcessingTask task = new RestoreNatureProcessingTask(snapshots, miny, chunk.getWorld().getEnvironment(), lesserBoundaryCorner.getBlock().getBiome(), lesserBoundaryCorner, greaterBoundaryCorner, this.getSeaLevel(chunk.getWorld()), aggressiveMode, GriefPrevention.instance.creativeRulesApply(lesserBoundaryCorner), playerReceivingVisualization);
|
||||
GriefPrevention.instance.getServer().getScheduler().scheduleAsyncDelayedTask(GriefPrevention.instance, task, delayInTicks);
|
||||
GriefPrevention.instance.getServer().getScheduler().runTaskLaterAsynchronously(GriefPrevention.instance, task, delayInTicks);
|
||||
}
|
||||
|
||||
private void parseMaterialListFromConfig(List<String> stringsToParse, MaterialCollection materialCollection)
|
||||
|
|
|
|||
|
|
@ -70,6 +70,9 @@ public class PlayerData
|
|||
//number of blocks placed outside claims before next warning
|
||||
int unclaimedBlockPlacementsUntilWarning = 1;
|
||||
|
||||
//timestamp of last death, for use in preventing death message spam
|
||||
long lastDeathTimeStamp = 0;
|
||||
|
||||
//spam
|
||||
public Date lastLogin; //when the player last logged into the server
|
||||
public String lastMessage = ""; //the player's last chat message, or slash command complete with parameters
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ import org.bukkit.event.EventHandler;
|
|||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.event.player.PlayerLoginEvent.Result;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
|
|
@ -75,7 +76,7 @@ class PlayerEventHandler implements Listener
|
|||
|
||||
//when a player chats, monitor for spam
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||
void onPlayerChat (AsyncPlayerChatEvent event)
|
||||
synchronized void onPlayerChat (AsyncPlayerChatEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
if(!player.isOnline())
|
||||
|
|
@ -113,7 +114,7 @@ class PlayerEventHandler implements Listener
|
|||
|
||||
//FEATURE: automatically educate players about the /trapped command
|
||||
//check for "trapped" or "stuck" to educate players about the /trapped command
|
||||
if(message.contains("trapped") || message.contains("stuck") || message.contains(this.dataStore.getMessage(Messages.TrappedChatKeyword)))
|
||||
if(!message.contains("/trapped") && (message.contains("trapped") || message.contains("stuck") || message.contains(this.dataStore.getMessage(Messages.TrappedChatKeyword))))
|
||||
{
|
||||
GriefPrevention.sendMessage(player, TextMode.Info, Messages.TrappedInstructions, 10L);
|
||||
}
|
||||
|
|
@ -333,7 +334,7 @@ class PlayerEventHandler implements Listener
|
|||
|
||||
//when a player uses a slash command...
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||
void onPlayerCommandPreprocess (PlayerCommandPreprocessEvent event)
|
||||
synchronized void onPlayerCommandPreprocess (PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
String [] args = event.getMessage().split(" ");
|
||||
|
||||
|
|
@ -525,6 +526,21 @@ class PlayerEventHandler implements Listener
|
|||
}
|
||||
}
|
||||
|
||||
//when a player dies...
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
void onPlayerDeath(PlayerDeathEvent event)
|
||||
{
|
||||
//FEATURE: prevent death message spam by implementing a "cooldown period" for death messages
|
||||
PlayerData playerData = this.dataStore.getPlayerData(event.getEntity().getName());
|
||||
long now = Calendar.getInstance().getTimeInMillis();
|
||||
if(now - playerData.lastDeathTimeStamp < GriefPrevention.instance.config_spam_deathMessageCooldownSeconds * 1000)
|
||||
{
|
||||
event.setDeathMessage("");
|
||||
}
|
||||
|
||||
playerData.lastDeathTimeStamp = now;
|
||||
}
|
||||
|
||||
//when a player quits...
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
void onPlayerQuit(PlayerQuitEvent event)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import org.bukkit.ChatColor;
|
|||
//just a few constants for chat color codes
|
||||
class TextMode
|
||||
{
|
||||
final static ChatColor Info = ChatColor.BLUE;
|
||||
final static ChatColor Info = ChatColor.AQUA;
|
||||
final static ChatColor Instr = ChatColor.YELLOW;
|
||||
final static ChatColor Warn = ChatColor.GOLD;
|
||||
final static ChatColor Err = ChatColor.RED;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user