From f5e7d08acea6c0425aaaa8dc258ad8569af32653 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 19 Jun 2016 16:14:13 +1000 Subject: [PATCH] Allow duplicates after 5s --- .../main/java/com/plotsquared/bukkit/object/BukkitPlayer.java | 3 ++- .../main/java/com/plotsquared/sponge/object/SpongePlayer.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java b/Bukkit/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java index a148b1d2d..a6661c541 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java @@ -67,8 +67,9 @@ public class BukkitPlayer extends PlotPlayer { @Override public void sendMessage(String message) { - if (!StringMan.isEqual(this.getMeta("lastMessage"), message)) { + if (!StringMan.isEqual(this.getMeta("lastMessage"), message) || (System.currentTimeMillis() - this.getMeta("lastMessageTime") > 5000)) { setMeta("lastMessage", message); + setMeta("lastMessageTime", System.currentTimeMillis()); this.player.sendMessage(message); } } diff --git a/Sponge/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java b/Sponge/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java index 33560973e..9a306993f 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java @@ -74,8 +74,9 @@ public class SpongePlayer extends PlotPlayer { @Override public void sendMessage(String message) { - if (!StringMan.isEqual(this.getMeta("lastMessage"), message)) { + if (!StringMan.isEqual(this.getMeta("lastMessage"), message) || (System.currentTimeMillis() - this.getMeta("lastMessageTime") > 5000)) { setMeta("lastMessage", message); + setMeta("lastMessageTime", System.currentTimeMillis()); this.player.sendMessage(ChatTypes.CHAT, TextSerializers.LEGACY_FORMATTING_CODE.deserialize(message)); } }