Remove 3 second chat delay.

This commit is contained in:
TadahTech 2016-07-24 22:20:55 -05:00 committed by cnr
parent 8d0dc0ce08
commit 9529789159

View File

@ -1,40 +1,5 @@
package mineplex.core.chat;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.nio.charset.Charset;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import java.util.function.Function;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import org.apache.commons.lang3.Validate;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.JSONValue;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager;
@ -53,6 +18,39 @@ import mineplex.core.preferences.PreferencesManager;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import org.apache.commons.lang3.Validate;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.JSONValue;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.nio.charset.Charset;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import java.util.function.Function;
public class Chat extends MiniPlugin
{
@ -69,7 +67,6 @@ public class Chat extends MiniPlugin
private int _chatSlow = 0;
private long _silenced = 0;
private boolean _threeSecondDelay = true;
private List<Function<AsyncPlayerChatEvent, Boolean>> _highPriorityFilters = new ArrayList<>();
private List<Function<AsyncPlayerChatEvent, Boolean>> _lowPriorityFilters = new ArrayList<>();
@ -349,15 +346,6 @@ public class Chat extends MiniPlugin
event.setCancelled(true);
return;
}
else if (_threeSecondDelay &&
_clientManager.Get(sender).GetRank() == Rank.ALL &&
_achievements.getMineplexLevelNumber(sender, Rank.ALL) < 25 &&
!Recharge.Instance.use(sender, "All Chat Message", 3000, false, false))
{
UtilPlayer.message(sender, C.cYellow + "You can only chat once every 3 seconds to prevent spam.");
UtilPlayer.message(sender, C.cYellow + "Buy a Rank at " + C.cGreen + "www.mineplex.com/shop" + C.cYellow + " to remove this limit!");
event.setCancelled(true);
}
else if (!_clientManager.Get(sender).GetRank().has(Rank.MODERATOR) &&
!Recharge.Instance.use(sender, "Chat Message", 400, false, false))
{
@ -645,11 +633,6 @@ public class Chat extends MiniPlugin
_playerLastMessage.remove(event.getPlayer().getUniqueId());
}
public void setThreeSecondDelay(boolean b)
{
_threeSecondDelay = b;
}
/**
* If the function returns Boolean.TRUE then the message will be CANCELLED.
*/