Added some verbage around command center block.
Fixed async chat connection stuff.
This commit is contained in:
parent
3ec1653532
commit
cee2883786
@ -164,9 +164,16 @@ public class CoreClientManager implements Listener
|
|||||||
// Load client in miniplugins
|
// Load client in miniplugins
|
||||||
Bukkit.getServer().getPluginManager().callEvent(new AsyncClientLoadEvent(token, client));
|
Bukkit.getServer().getPluginManager().callEvent(new AsyncClientLoadEvent(token, client));
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
// Mysql
|
// Mysql
|
||||||
Bukkit.getServer().getPluginManager().callEvent(new RetrieveClientInformationEvent(client.GetPlayerName(), uuid));
|
Bukkit.getServer().getPluginManager().callEvent(new RetrieveClientInformationEvent(client.GetPlayerName(), uuid));
|
||||||
}
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
System.out.println("Error running RetrieveClientInformationEvent" + exception.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void Login(PlayerLoginEvent event)
|
public void Login(PlayerLoginEvent event)
|
||||||
|
@ -16,8 +16,6 @@ import javax.net.ssl.TrustManager;
|
|||||||
import javax.net.ssl.X509TrustManager;
|
import javax.net.ssl.X509TrustManager;
|
||||||
|
|
||||||
import mineplex.core.MiniClientPlugin;
|
import mineplex.core.MiniClientPlugin;
|
||||||
import mineplex.core.packethandler.IPacketRunnable;
|
|
||||||
import mineplex.core.packethandler.PacketHandler;
|
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
@ -304,14 +302,6 @@ public class Chat extends MiniClientPlugin<ChatClient>
|
|||||||
return hasharray;
|
return hasharray;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String parseResponse(String response)
|
|
||||||
{
|
|
||||||
JSONObject checkresponse = (JSONObject) JSONValue.parse(response);
|
|
||||||
String display = checkresponse.get("response").toString();
|
|
||||||
|
|
||||||
return display;
|
|
||||||
}
|
|
||||||
|
|
||||||
private JSONObject buildJsonChatObject(String filtertype, String name, String player, String msg, int rule)
|
private JSONObject buildJsonChatObject(String filtertype, String name, String player, String msg, int rule)
|
||||||
{
|
{
|
||||||
JSONObject message = new JSONObject();
|
JSONObject message = new JSONObject();
|
||||||
@ -489,6 +479,11 @@ public class Chat extends MiniClientPlugin<ChatClient>
|
|||||||
_repository.saveFilterChat(caller.getUniqueId().toString(), !Get(caller).GetFilterChat());
|
_repository.saveFilterChat(caller.getUniqueId().toString(), !Get(caller).GetFilterChat());
|
||||||
Get(caller).SetFilterChat(!Get(caller).GetFilterChat());
|
Get(caller).SetFilterChat(!Get(caller).GetFilterChat());
|
||||||
|
|
||||||
caller.sendMessage(F.main("Chat", "You have turned chat filtering " + (Get(caller).GetFilterChat() ? "on" : "off") + "."));
|
if (Get(caller).GetFilterChat())
|
||||||
|
caller.playSound(caller.getLocation(), Sound.NOTE_PIANO, 2f, 2f);
|
||||||
|
else
|
||||||
|
caller.playSound(caller.getLocation(), Sound.NOTE_PIANO, 1f, 1f);
|
||||||
|
|
||||||
|
caller.sendMessage(F.main("Chat", "You have turned chat filtering " + ChatColor.YELLOW + (Get(caller).GetFilterChat() ? "ON" : "OFF") + ChatColor.GRAY + "."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,8 @@ import java.util.UUID;
|
|||||||
|
|
||||||
public class ChatRepository
|
public class ChatRepository
|
||||||
{
|
{
|
||||||
|
private static Object _connectionLock = new Object();
|
||||||
|
|
||||||
private String _connectionString;
|
private String _connectionString;
|
||||||
private String _userName = "root";
|
private String _userName = "root";
|
||||||
private String _password = "tAbechAk3wR7tuTh";
|
private String _password = "tAbechAk3wR7tuTh";
|
||||||
@ -74,6 +76,8 @@ public class ChatRepository
|
|||||||
int affectedRows = 0;
|
int affectedRows = 0;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
synchronized (_connectionLock)
|
||||||
{
|
{
|
||||||
if (_connection.isClosed())
|
if (_connection.isClosed())
|
||||||
{
|
{
|
||||||
@ -92,6 +96,7 @@ public class ChatRepository
|
|||||||
System.out.println("Error saving FilterChat option.");
|
System.out.println("Error saving FilterChat option.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
@ -118,6 +123,8 @@ public class ChatRepository
|
|||||||
PreparedStatement preparedStatement = null;
|
PreparedStatement preparedStatement = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
synchronized (_connectionLock)
|
||||||
{
|
{
|
||||||
if (_connection.isClosed())
|
if (_connection.isClosed())
|
||||||
{
|
{
|
||||||
@ -145,6 +152,7 @@ public class ChatRepository
|
|||||||
return resultSet.getBoolean(1);
|
return resultSet.getBoolean(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package mineplex.core.command;
|
package mineplex.core.command;
|
||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.NautHashMap;
|
import mineplex.core.common.util.NautHashMap;
|
||||||
|
import mineplex.core.recharge.Recharge;
|
||||||
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -47,11 +49,18 @@ public class CommandCenter implements Listener
|
|||||||
args = event.getMessage().substring(event.getMessage().indexOf(' ') + 1).split(" ");
|
args = event.getMessage().substring(event.getMessage().indexOf(' ') + 1).split(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
ICommand command = Commands.get(commandName);
|
ICommand command = Commands.get(commandName.toLowerCase());
|
||||||
|
|
||||||
if (command != null && ClientManager.Get(event.getPlayer()).GetRank().Has(event.getPlayer(), command.GetRequiredRank(), true))
|
if (command != null && ClientManager.Get(event.getPlayer()).GetRank().Has(event.getPlayer(), command.GetRequiredRank(), true))
|
||||||
{
|
{
|
||||||
command.SetAliasUsed(commandName);
|
if (!Recharge.Instance.use(event.getPlayer(), "Command", 500, false, false))
|
||||||
|
{
|
||||||
|
event.getPlayer().sendMessage(F.main("Command Center", "You can't spam commands that fast."));
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
command.SetAliasUsed(commandName.toLowerCase());
|
||||||
command.Execute(event.getPlayer(), args);
|
command.Execute(event.getPlayer(), args);
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -62,7 +71,7 @@ public class CommandCenter implements Listener
|
|||||||
{
|
{
|
||||||
for (String commandRoot : command.Aliases())
|
for (String commandRoot : command.Aliases())
|
||||||
{
|
{
|
||||||
Commands.put(commandRoot, command);
|
Commands.put(commandRoot.toLowerCase(), command);
|
||||||
command.SetCommandCenter(this);
|
command.SetCommandCenter(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -71,7 +80,7 @@ public class CommandCenter implements Listener
|
|||||||
{
|
{
|
||||||
for (String commandRoot : command.Aliases())
|
for (String commandRoot : command.Aliases())
|
||||||
{
|
{
|
||||||
Commands.remove(commandRoot);
|
Commands.remove(commandRoot.toLowerCase());
|
||||||
command.SetCommandCenter(null);
|
command.SetCommandCenter(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user