From ac23c10f015891f53ed180810d5e296e7eb12e09 Mon Sep 17 00:00:00 2001 From: ElgarL Date: Wed, 1 Feb 2012 05:43:23 +0000 Subject: [PATCH] v0.17: - If a player has no permissions for any channel but we are still set to modify chat, remove the channelTag and msgcolour entries. - Fix Spam timer to work in milliseconds so values of 0.5 actually work. --- src/changelog.txt | 5 ++++- .../TownyChat/event/TownyPlayerHighestListener.java | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/changelog.txt b/src/changelog.txt index 682e31a..8c9898a 100644 --- a/src/changelog.txt +++ b/src/changelog.txt @@ -84,4 +84,7 @@ v0.16: - Lowered event priorities to HIGH to allow other plugins the chance to beat us to the event and cancel. - Fixed Op's with no default mode set using local chat. It will now try global, then world, then local in it's search order. - Added a new command '/townychat reload'. - - spam_time now accepts smaller values (eg. 0.5). \ No newline at end of file + - spam_time now accepts smaller values (eg. 0.5). +v0.17: + - If a player has no permissions for any channel but we are still set to modify chat, remove the channelTag and msgcolour entries. + - Fix Spam timer to work in milliseconds so values of 0.5 actually work. \ No newline at end of file diff --git a/src/com/palmergames/bukkit/TownyChat/event/TownyPlayerHighestListener.java b/src/com/palmergames/bukkit/TownyChat/event/TownyPlayerHighestListener.java index 5e11bfa..045c383 100644 --- a/src/com/palmergames/bukkit/TownyChat/event/TownyPlayerHighestListener.java +++ b/src/com/palmergames/bukkit/TownyChat/event/TownyPlayerHighestListener.java @@ -136,7 +136,7 @@ public class TownyPlayerHighestListener implements Listener { if (ChatSettings.isModify_chat()) { try { - event.setFormat(ChatSettings.getRelevantFormatGroup(player).getGLOBAL()); + event.setFormat(ChatSettings.getRelevantFormatGroup(player).getGLOBAL().replace("{channelTag}", "").replace("{msgcolour}", "")); Resident resident = TownyUniverse.getDataSource().getResident(player.getName()); TownyChatEvent chatEvent = new TownyChatEvent(event, resident); @@ -388,7 +388,7 @@ public class TownyPlayerHighestListener implements Listener { */ private boolean isSpam(Player player) { - long timeNow = System.currentTimeMillis()/1000; + long timeNow = System.currentTimeMillis(); long spam = timeNow; if (SpamTime.containsKey(player)) { @@ -396,12 +396,12 @@ public class TownyPlayerHighestListener implements Listener { SpamTime.remove(player); } else { // No record found so ensure we don't trigger for spam - spam -= (ChatSettings.getSpam_time() + 1); + spam -= ((ChatSettings.getSpam_time() + 1)*1000); } SpamTime.put(player, timeNow); - if (timeNow - spam < ChatSettings.getSpam_time()) { + if (timeNow - spam < (ChatSettings.getSpam_time()*1000)) { TownyMessaging.sendErrorMsg(player, "Unable to talk...You are spamming!"); return true; }