0

Changed cgt message format

This commit is contained in:
Pepich 2017-02-01 21:16:33 +01:00
parent bc0144e33e
commit 5136bc64ec

View File

@ -26,13 +26,13 @@ import com.redstoner.modules.Module;
* *
* @author Pepich */ * @author Pepich */
@AutoRegisterListener @AutoRegisterListener
@Version(major = 1, minor = 1, revision = 6, compatible = 1) @Version(major = 1, minor = 1, revision = 7, compatible = 1)
public class Chatgroups implements Module, Listener public class Chatgroups implements Module, Listener
{ {
private static final char defaultKey = ':'; private static final char defaultKey = ':';
private static final File groupsLocation = new File(Main.plugin.getDataFolder(), "chatgroups.json"); private static final File groupsLocation = new File(Main.plugin.getDataFolder(), "chatgroups.json");
private static final File keysLocation = new File(Main.plugin.getDataFolder(), "chatgroup_keys.json"); private static final File keysLocation = new File(Main.plugin.getDataFolder(), "chatgroup_keys.json");
private ArrayList<CommandSender> cgtoggled; private ArrayList<UUID> cgtoggled;
private static JSONObject groups, keys; private static JSONObject groups, keys;
private boolean enabled = false; private boolean enabled = false;
@ -51,7 +51,7 @@ public class Chatgroups implements Module, Listener
keys = new JSONObject(); keys = new JSONObject();
saveKeys(); saveKeys();
} }
cgtoggled = new ArrayList<CommandSender>(); cgtoggled = new ArrayList<UUID>();
enabled = true; enabled = true;
} }
@ -204,13 +204,13 @@ public class Chatgroups implements Module, Listener
if (getGroup(sender) != null) if (getGroup(sender) != null)
if (cgtoggled.contains(sender)) if (cgtoggled.contains(sender))
{ {
cgtoggled.remove(sender); cgtoggled.remove(((Player) sender).getUniqueId());
Utils.sendMessage(sender, null, "Cgt now §cdisbled"); Utils.sendMessage(sender, null, "CGT now §cdisbled");
} }
else else
{ {
cgtoggled.add(sender); cgtoggled.add(((Player) sender).getUniqueId());
Utils.sendMessage(sender, null, "Cgt now §aenabled"); Utils.sendMessage(sender, null, "CGT now §aenabled");
} }
else else
Utils.sendErrorMessage(sender, null, "You are not in a chatgroup!"); Utils.sendErrorMessage(sender, null, "You are not in a chatgroup!");
@ -226,7 +226,7 @@ public class Chatgroups implements Module, Listener
{ {
removeGroup(sender); removeGroup(sender);
Utils.sendMessage(sender, null, "Successfully removed you from your group!"); Utils.sendMessage(sender, null, "Successfully removed you from your group!");
cgtoggled.remove(sender); cgtoggled.remove(((Player) sender).getUniqueId());
return true; return true;
} }
@ -274,7 +274,7 @@ public class Chatgroups implements Module, Listener
event.setCancelled(true); event.setCancelled(true);
sendToGroup(event.getPlayer(), event.getMessage().replaceFirst(getKey(player), "")); sendToGroup(event.getPlayer(), event.getMessage().replaceFirst(getKey(player), ""));
} }
else if (cgtoggled.contains(event.getPlayer())) else if (cgtoggled.contains(event.getPlayer().getUniqueId()))
{ {
event.setCancelled(true); event.setCancelled(true);
sendToGroup(event.getPlayer(), event.getMessage()); sendToGroup(event.getPlayer(), event.getMessage());