Better sign notifications and logging.

This commit is contained in:
ryanhamshire 2015-03-18 15:41:56 -07:00
parent 082346cc32
commit 4662f7a3f3
2 changed files with 8 additions and 4 deletions

View File

@ -112,9 +112,12 @@ public class BlockEventHandler implements Listener
for(int i = 0; i < event.getLines().length; i++) for(int i = 0; i < event.getLines().length; i++)
{ {
String withoutSpaces = event.getLine(i).replace(" ", ""); String withoutSpaces = event.getLine(i).replace(" ", "");
if(!withoutSpaces.isEmpty()) notEmpty = true; if(!withoutSpaces.isEmpty())
{
notEmpty = true;
lines.append("\n " + event.getLine(i)); lines.append("\n " + event.getLine(i));
} }
}
String signMessage = lines.toString(); String signMessage = lines.toString();
@ -122,7 +125,7 @@ public class BlockEventHandler implements Listener
PlayerData playerData = this.dataStore.getPlayerData(player.getUniqueId()); PlayerData playerData = this.dataStore.getPlayerData(player.getUniqueId());
if(notEmpty && playerData.lastMessage != null && !playerData.lastMessage.equals(signMessage)) if(notEmpty && playerData.lastMessage != null && !playerData.lastMessage.equals(signMessage))
{ {
GriefPrevention.AddLogEntry("[Sign Placement] <" + player.getName() + "> " + " @ " + GriefPrevention.getfriendlyLocationString(event.getBlock().getLocation()) + lines.toString()); GriefPrevention.AddLogEntry("[Sign Placement] <" + player.getName() + "> " + " @ " + GriefPrevention.getfriendlyLocationString(event.getBlock().getLocation()) + lines.toString().replace("\r\n", ";"));
playerData.lastMessage = signMessage; playerData.lastMessage = signMessage;
if(!player.hasPermission("griefprevention.eavesdrop")) if(!player.hasPermission("griefprevention.eavesdrop"))

View File

@ -242,6 +242,7 @@ public class GriefPrevention extends JavaPlugin
{ {
GriefPrevention.AddLogEntry("Unable to initialize the file system data store. Details:"); GriefPrevention.AddLogEntry("Unable to initialize the file system data store. Details:");
GriefPrevention.AddLogEntry(e.getMessage()); GriefPrevention.AddLogEntry(e.getMessage());
e.printStackTrace();
} }
} }
@ -258,7 +259,7 @@ public class GriefPrevention extends JavaPlugin
//start the recurring cleanup event for entities in creative worlds //start the recurring cleanup event for entities in creative worlds
EntityCleanupTask task = new EntityCleanupTask(0); EntityCleanupTask task = new EntityCleanupTask(0);
this.getServer().getScheduler().scheduleSyncDelayedTask(GriefPrevention.instance, task, 20L); this.getServer().getScheduler().scheduleSyncDelayedTask(GriefPrevention.instance, task, 20L * 60 * 2);
//start recurring cleanup scan for unused claims belonging to inactive players //start recurring cleanup scan for unused claims belonging to inactive players
CleanupUnusedClaimsTask task2 = new CleanupUnusedClaimsTask(); CleanupUnusedClaimsTask task2 = new CleanupUnusedClaimsTask();