Encoding stuff
This commit is contained in:
parent
d79b0dd687
commit
14837e1d80
6 changed files with 74 additions and 74 deletions
Binary file not shown.
|
@ -11,9 +11,9 @@ public class Channel {
|
||||||
Command = command;
|
Command = command;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Channel GlobalChat = new Channel("§fg§f", "white", "g");
|
public static Channel GlobalChat = new Channel("§fg§f", "white", "g");
|
||||||
public static Channel TownChat = new Channel("§3TC§f", "dark_aqua", "tc");
|
public static Channel TownChat = new Channel("§3TC§f", "dark_aqua", "tc");
|
||||||
public static Channel NationChat = new Channel("§6NC§f", "gold", "nc");
|
public static Channel NationChat = new Channel("§6NC§f", "gold", "nc");
|
||||||
public static Channel AdminChat = new Channel("§cADMIN§f", "red", "a");
|
public static Channel AdminChat = new Channel("§cADMIN§f", "red", "a");
|
||||||
public static Channel ModChat = new Channel("§9MOD§f", "blue", "mod");
|
public static Channel ModChat = new Channel("§9MOD§f", "blue", "mod");
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,8 +92,8 @@ public class ChatProcessing {
|
||||||
// first
|
// first
|
||||||
formattedmessage = formattedmessage.replace("\"", "\\\"");
|
formattedmessage = formattedmessage.replace("\"", "\\\"");
|
||||||
if (PluginMain.permission.has(sender, "tbmc.admin"))
|
if (PluginMain.permission.has(sender, "tbmc.admin"))
|
||||||
formattedmessage = formattedmessage.replace("&", "§");
|
formattedmessage = formattedmessage.replace("&", "§");
|
||||||
formattedmessage = formattedmessage.replace("§r", "§"
|
formattedmessage = formattedmessage.replace("§r", "§"
|
||||||
+ currentchannel.DisplayName.charAt(1));
|
+ currentchannel.DisplayName.charAt(1));
|
||||||
String suggestmsg = formattedmessage;
|
String suggestmsg = formattedmessage;
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ public class ChatProcessing {
|
||||||
}
|
}
|
||||||
StringBuffer buf = new StringBuffer(formattedmessage);
|
StringBuffer buf = new StringBuffer(formattedmessage);
|
||||||
buf.replace(currentindex, currentindex + item.length(),
|
buf.replace(currentindex, currentindex + item.length(),
|
||||||
String.format("§%s%s", RainbowPresserColors[rpc], item));
|
String.format("§%s%s", RainbowPresserColors[rpc], item));
|
||||||
formattedmessage = buf.toString();
|
formattedmessage = buf.toString();
|
||||||
if (rpc + 1 < RainbowPresserColors.length)
|
if (rpc + 1 < RainbowPresserColors.length)
|
||||||
rpc++;
|
rpc++;
|
||||||
|
@ -160,7 +160,7 @@ public class ChatProcessing {
|
||||||
MaybeOfflinePlayer mpp = MaybeOfflinePlayer
|
MaybeOfflinePlayer mpp = MaybeOfflinePlayer
|
||||||
.AddPlayerIfNeeded(p.getUniqueId());
|
.AddPlayerIfNeeded(p.getUniqueId());
|
||||||
color = String.format(
|
color = String.format(
|
||||||
"§%x",
|
"§%x",
|
||||||
(mpp.GetFlairColor() == 0x00 ? 0xb : mpp
|
(mpp.GetFlairColor() == 0x00 ? 0xb : mpp
|
||||||
.GetFlairColor()));
|
.GetFlairColor()));
|
||||||
}
|
}
|
||||||
|
@ -170,21 +170,21 @@ public class ChatProcessing {
|
||||||
"(?i)" + Pattern.quote(p.getName()),
|
"(?i)" + Pattern.quote(p.getName()),
|
||||||
String.format(
|
String.format(
|
||||||
"\",\"color\":\"%s\"},{\"text\":\"%s%s%s\",\"color\":\"blue\"},{\"text\":\"",
|
"\",\"color\":\"%s\"},{\"text\":\"%s%s%s\",\"color\":\"blue\"},{\"text\":\"",
|
||||||
colormode, color, p.getName(), "§r"));
|
colormode, color, p.getName(), "§r"));
|
||||||
}
|
}
|
||||||
for (String n : PlayerListener.nicknames.keySet()) {
|
for (String n : PlayerListener.nicknames.keySet()) {
|
||||||
Player p = null;
|
Player p = null;
|
||||||
String nwithoutformatting = new String(n);
|
String nwithoutformatting = new String(n);
|
||||||
int index;
|
int index;
|
||||||
while ((index = nwithoutformatting.indexOf("§k")) != -1)
|
while ((index = nwithoutformatting.indexOf("§k")) != -1)
|
||||||
nwithoutformatting = nwithoutformatting.replace("§k"
|
nwithoutformatting = nwithoutformatting.replace("§k"
|
||||||
+ nwithoutformatting.charAt(index + 2), ""); // Support
|
+ nwithoutformatting.charAt(index + 2), ""); // Support
|
||||||
// for
|
// for
|
||||||
// one
|
// one
|
||||||
// random
|
// random
|
||||||
// char
|
// char
|
||||||
while ((index = nwithoutformatting.indexOf('§')) != -1)
|
while ((index = nwithoutformatting.indexOf('§')) != -1)
|
||||||
nwithoutformatting = nwithoutformatting.replace("§"
|
nwithoutformatting = nwithoutformatting.replace("§"
|
||||||
+ nwithoutformatting.charAt(index + 1), "");
|
+ nwithoutformatting.charAt(index + 1), "");
|
||||||
if (formattedmessage.matches("(?i).*"
|
if (formattedmessage.matches("(?i).*"
|
||||||
+ Pattern.quote(nwithoutformatting) + ".*")) {
|
+ Pattern.quote(nwithoutformatting) + ".*")) {
|
||||||
|
@ -205,19 +205,19 @@ public class ChatProcessing {
|
||||||
"(?i)" + Pattern.quote(nwithoutformatting),
|
"(?i)" + Pattern.quote(nwithoutformatting),
|
||||||
String.format(
|
String.format(
|
||||||
"\",\"color\":\"%s\"},{\"text\":\"%s%s\",\"color\":\"blue\"},{\"text\":\"",
|
"\",\"color\":\"%s\"},{\"text\":\"%s%s\",\"color\":\"blue\"},{\"text\":\"",
|
||||||
colormode, n, "§r"));
|
colormode, n, "§r"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (formattedmessage.matches("(?i).*" + Pattern.quote("@console")
|
if (formattedmessage.matches("(?i).*" + Pattern.quote("@console")
|
||||||
+ ".*")) {
|
+ ".*")) {
|
||||||
formattedmessage = formattedmessage.replaceAll(
|
formattedmessage = formattedmessage.replaceAll(
|
||||||
"(?i)" + Pattern.quote("@console"), "§b@console§r");
|
"(?i)" + Pattern.quote("@console"), "§b@console§r");
|
||||||
formattedmessage = formattedmessage
|
formattedmessage = formattedmessage
|
||||||
.replaceAll(
|
.replaceAll(
|
||||||
"(?i)" + Pattern.quote("@console"),
|
"(?i)" + Pattern.quote("@console"),
|
||||||
String.format(
|
String.format(
|
||||||
"\",\"color\":\"%s\"},{\"text\":\"§b@console§r\",\"color\":\"blue\"},{\"text\":\"",
|
"\",\"color\":\"%s\"},{\"text\":\"§b@console§r\",\"color\":\"blue\"},{\"text\":\"",
|
||||||
colormode));
|
colormode));
|
||||||
System.out.println("\007");
|
System.out.println("\007");
|
||||||
}
|
}
|
||||||
|
@ -284,13 +284,13 @@ public class ChatProcessing {
|
||||||
formattedmessage, colormode));
|
formattedmessage, colormode));
|
||||||
String jsonstr = json.toString();
|
String jsonstr = json.toString();
|
||||||
if (jsonstr.length() >= 32767) {
|
if (jsonstr.length() >= 32767) {
|
||||||
sender.sendMessage("§cError: Message too large. Try shortening it, or remove hashtags and other formatting.");
|
sender.sendMessage("§cError: Message too large. Try shortening it, or remove hashtags and other formatting.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (currentchannel.equals(Channel.TownChat)
|
if (currentchannel.equals(Channel.TownChat)
|
||||||
|| currentchannel.equals(Channel.NationChat)) {
|
|| currentchannel.equals(Channel.NationChat)) {
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
sender.sendMessage("§cYou are not a player!");
|
sender.sendMessage("§cYou are not a player!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
for (Player p : PluginMain.GetPlayers()) {
|
for (Player p : PluginMain.GetPlayers()) {
|
||||||
|
@ -316,7 +316,7 @@ public class ChatProcessing {
|
||||||
} catch (NotRegisteredException e) {
|
} catch (NotRegisteredException e) {
|
||||||
}
|
}
|
||||||
if (town == null) {
|
if (town == null) {
|
||||||
player.sendMessage("§cYou aren't in a town or an error occured.");
|
player.sendMessage("§cYou aren't in a town or an error occured.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
index = PluginMain.Instance.Towns.indexOf(town);
|
index = PluginMain.Instance.Towns.indexOf(town);
|
||||||
|
@ -345,11 +345,11 @@ public class ChatProcessing {
|
||||||
index, index, json.toString()));
|
index, index, json.toString()));
|
||||||
} catch (IllegalStateException e) {
|
} catch (IllegalStateException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
player.sendMessage("§cAn error occured while sending the message. (IllegalStateException)");
|
player.sendMessage("§cAn error occured while sending the message. (IllegalStateException)");
|
||||||
return true;
|
return true;
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
player.sendMessage("§cAn error occured while sending the message. (IllegalArgumentException)");
|
player.sendMessage("§cAn error occured while sending the message. (IllegalArgumentException)");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (currentchannel.equals(Channel.NationChat)) {
|
} else if (currentchannel.equals(Channel.NationChat)) {
|
||||||
|
@ -361,7 +361,7 @@ public class ChatProcessing {
|
||||||
} catch (NotRegisteredException e) {
|
} catch (NotRegisteredException e) {
|
||||||
}
|
}
|
||||||
if (town == null) {
|
if (town == null) {
|
||||||
player.sendMessage("§cYou aren't in a town or an error occured.");
|
player.sendMessage("§cYou aren't in a town or an error occured.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Nation nation = null;
|
Nation nation = null;
|
||||||
|
@ -370,7 +370,7 @@ public class ChatProcessing {
|
||||||
} catch (NotRegisteredException e) {
|
} catch (NotRegisteredException e) {
|
||||||
}
|
}
|
||||||
if (nation == null) {
|
if (nation == null) {
|
||||||
player.sendMessage("§cYour town isn't in a nation or an error occured.");
|
player.sendMessage("§cYour town isn't in a nation or an error occured.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
index = PluginMain.Instance.Nations.indexOf(nation);
|
index = PluginMain.Instance.Nations.indexOf(nation);
|
||||||
|
@ -399,17 +399,17 @@ public class ChatProcessing {
|
||||||
index, index, json.toString()));
|
index, index, json.toString()));
|
||||||
} catch (IllegalStateException e) {
|
} catch (IllegalStateException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
player.sendMessage("§cAn error occured while sending the message. (IllegalStateException)");
|
player.sendMessage("§cAn error occured while sending the message. (IllegalStateException)");
|
||||||
return true;
|
return true;
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
player.sendMessage("§cAn error occured while sending the message. (IllegalArgumentException)");
|
player.sendMessage("§cAn error occured while sending the message. (IllegalArgumentException)");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (currentchannel.equals(Channel.AdminChat)) {
|
} else if (currentchannel.equals(Channel.AdminChat)) {
|
||||||
try { // TODO: Put message JSON into it's structure
|
try { // TODO: Put message JSON into it's structure
|
||||||
if (player != null && !player.isOp()) {
|
if (player != null && !player.isOp()) {
|
||||||
player.sendMessage("§cYou need to be an OP to use this channel.");
|
player.sendMessage("§cYou need to be an OP to use this channel.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Objective obj = PluginMain.SB.getObjective("admin");
|
Objective obj = PluginMain.SB.getObjective("admin");
|
||||||
|
@ -428,18 +428,18 @@ public class ChatProcessing {
|
||||||
1, 1, json.toString()));
|
1, 1, json.toString()));
|
||||||
} catch (IllegalStateException e) {
|
} catch (IllegalStateException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
player.sendMessage("§cAn error occured while sending the message. (IllegalStateException)");
|
player.sendMessage("§cAn error occured while sending the message. (IllegalStateException)");
|
||||||
return true;
|
return true;
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
player.sendMessage("§cAn error occured while sending the message. (IllegalArgumentException)");
|
player.sendMessage("§cAn error occured while sending the message. (IllegalArgumentException)");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (currentchannel.equals(Channel.ModChat)) {
|
} else if (currentchannel.equals(Channel.ModChat)) {
|
||||||
try {
|
try {
|
||||||
if (player != null
|
if (player != null
|
||||||
&& !PermissionsEx.getUser(player).inGroup("mod")) {
|
&& !PermissionsEx.getUser(player).inGroup("mod")) {
|
||||||
player.sendMessage("§cYou need to be a mod to use this channel.");
|
player.sendMessage("§cYou need to be a mod to use this channel.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Objective obj = PluginMain.SB.getObjective("mod");
|
Objective obj = PluginMain.SB.getObjective("mod");
|
||||||
|
@ -456,11 +456,11 @@ public class ChatProcessing {
|
||||||
1, 1, json.toString()));
|
1, 1, json.toString()));
|
||||||
} catch (IllegalStateException e) {
|
} catch (IllegalStateException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
player.sendMessage("§cAn error occured while sending the message. (IllegalStateException)");
|
player.sendMessage("§cAn error occured while sending the message. (IllegalStateException)");
|
||||||
return true;
|
return true;
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
player.sendMessage("§cAn error occured while sending the message. (IllegalArgumentException)");
|
player.sendMessage("§cAn error occured while sending the message. (IllegalArgumentException)");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -104,12 +104,12 @@ public class MaybeOfflinePlayer {
|
||||||
|
|
||||||
public String GetFormattedFlair() {
|
public String GetFormattedFlair() {
|
||||||
if (FlairTime == FlairTimeCantPress)
|
if (FlairTime == FlairTimeCantPress)
|
||||||
return String.format("§r(--s)§r");
|
return String.format("§r(--s)§r");
|
||||||
if (FlairTime == FlairTimeNonPresser)
|
if (FlairTime == FlairTimeNonPresser)
|
||||||
return String.format("§7(--s)§r");
|
return String.format("§7(--s)§r");
|
||||||
if (FlairTime == FlairTimeNone)
|
if (FlairTime == FlairTimeNone)
|
||||||
return "";
|
return "";
|
||||||
return String.format("§%x(%ss)§r", GetFlairColor(), FlairTime);
|
return String.format("§%x(%ss)§r", GetFlairColor(), FlairTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetFlair(short time) {
|
public void SetFlair(short time) {
|
||||||
|
|
|
@ -227,7 +227,7 @@ public class PlayerListener implements Listener {
|
||||||
if (cmd.equalsIgnoreCase(Channel.GlobalChat.Command)) {
|
if (cmd.equalsIgnoreCase(Channel.GlobalChat.Command)) {
|
||||||
mp.CurrentChannel = Channel.GlobalChat;
|
mp.CurrentChannel = Channel.GlobalChat;
|
||||||
event.getPlayer().sendMessage(
|
event.getPlayer().sendMessage(
|
||||||
"§6You are now talking in: §b"
|
"§6You are now talking in: §b"
|
||||||
+ mp.CurrentChannel.DisplayName);
|
+ mp.CurrentChannel.DisplayName);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
} else if (cmd.equalsIgnoreCase(Channel.TownChat.Command)) {
|
} else if (cmd.equalsIgnoreCase(Channel.TownChat.Command)) {
|
||||||
|
@ -236,7 +236,7 @@ public class PlayerListener implements Listener {
|
||||||
else
|
else
|
||||||
mp.CurrentChannel = Channel.TownChat;
|
mp.CurrentChannel = Channel.TownChat;
|
||||||
event.getPlayer().sendMessage(
|
event.getPlayer().sendMessage(
|
||||||
"§6You are now talking in: §b"
|
"§6You are now talking in: §b"
|
||||||
+ mp.CurrentChannel.DisplayName);
|
+ mp.CurrentChannel.DisplayName);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
} else if (cmd.equalsIgnoreCase(Channel.NationChat.Command)) {
|
} else if (cmd.equalsIgnoreCase(Channel.NationChat.Command)) {
|
||||||
|
@ -245,7 +245,7 @@ public class PlayerListener implements Listener {
|
||||||
else
|
else
|
||||||
mp.CurrentChannel = Channel.NationChat;
|
mp.CurrentChannel = Channel.NationChat;
|
||||||
event.getPlayer().sendMessage(
|
event.getPlayer().sendMessage(
|
||||||
"§6You are now talking in: §b"
|
"§6You are now talking in: §b"
|
||||||
+ mp.CurrentChannel.DisplayName);
|
+ mp.CurrentChannel.DisplayName);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
} else if (cmd.equalsIgnoreCase(Channel.AdminChat.Command)) {
|
} else if (cmd.equalsIgnoreCase(Channel.AdminChat.Command)) {
|
||||||
|
@ -254,7 +254,7 @@ public class PlayerListener implements Listener {
|
||||||
else
|
else
|
||||||
mp.CurrentChannel = Channel.AdminChat;
|
mp.CurrentChannel = Channel.AdminChat;
|
||||||
event.getPlayer().sendMessage(
|
event.getPlayer().sendMessage(
|
||||||
"§6You are now talking in: §b"
|
"§6You are now talking in: §b"
|
||||||
+ mp.CurrentChannel.DisplayName);
|
+ mp.CurrentChannel.DisplayName);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
} else if (cmd.equalsIgnoreCase(Channel.ModChat.Command)) {
|
} else if (cmd.equalsIgnoreCase(Channel.ModChat.Command)) {
|
||||||
|
@ -263,7 +263,7 @@ public class PlayerListener implements Listener {
|
||||||
else
|
else
|
||||||
mp.CurrentChannel = Channel.ModChat;
|
mp.CurrentChannel = Channel.ModChat;
|
||||||
event.getPlayer().sendMessage(
|
event.getPlayer().sendMessage(
|
||||||
"§6You are now talking in: §b"
|
"§6You are now talking in: §b"
|
||||||
+ mp.CurrentChannel.DisplayName);
|
+ mp.CurrentChannel.DisplayName);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -304,9 +304,9 @@ public class PlayerListener implements Listener {
|
||||||
Player player = Bukkit.getPlayer(event.getMessage().substring(
|
Player player = Bukkit.getPlayer(event.getMessage().substring(
|
||||||
index + 1));
|
index + 1));
|
||||||
if (player != null)
|
if (player != null)
|
||||||
player.sendMessage("§b"
|
player.sendMessage("§b"
|
||||||
+ event.getPlayer().getDisplayName()
|
+ event.getPlayer().getDisplayName()
|
||||||
+ " §bis in this world: "
|
+ " §bis in this world: "
|
||||||
+ event.getPlayer().getWorld().getName());
|
+ event.getPlayer().getWorld().getName());
|
||||||
} else if (cmd.equalsIgnoreCase("minecraft:me")) {
|
} else if (cmd.equalsIgnoreCase("minecraft:me")) {
|
||||||
if (!essentials.getUser(event.getPlayer()).isMuted()) {
|
if (!essentials.getUser(event.getPlayer()).isMuted()) {
|
||||||
|
@ -352,7 +352,7 @@ public class PlayerListener implements Listener {
|
||||||
.getId().equalsIgnoreCase("tower")) {
|
.getId().equalsIgnoreCase("tower")) {
|
||||||
event.getPlayer()
|
event.getPlayer()
|
||||||
.sendMessage(
|
.sendMessage(
|
||||||
"§cYou are not allowed to teleport players out from the Tower");
|
"§cYou are not allowed to teleport players out from the Tower");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -370,7 +370,7 @@ public class PlayerListener implements Listener {
|
||||||
PS.valueOf(event.getPlayer().getLocation()))
|
PS.valueOf(event.getPlayer().getLocation()))
|
||||||
.getId().equalsIgnoreCase("tower")) {
|
.getId().equalsIgnoreCase("tower")) {
|
||||||
event.getPlayer().sendMessage(
|
event.getPlayer().sendMessage(
|
||||||
"§cYou are not allowed to teleport to the Tower");
|
"§cYou are not allowed to teleport to the Tower");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -392,7 +392,7 @@ public class PlayerListener implements Listener {
|
||||||
.contains(town2.getNation())) {
|
.contains(town2.getNation())) {
|
||||||
event.getPlayer()
|
event.getPlayer()
|
||||||
.sendMessage(
|
.sendMessage(
|
||||||
"§cYou cannot set homes in enemy territory.");
|
"§cYou cannot set homes in enemy territory.");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -421,7 +421,7 @@ public class PlayerListener implements Listener {
|
||||||
if (war.isWarZone(new WorldCoord(currentWorld, currentLocation
|
if (war.isWarZone(new WorldCoord(currentWorld, currentLocation
|
||||||
.getBlockX(), currentLocation.getBlockZ()))) {
|
.getBlockX(), currentLocation.getBlockZ()))) {
|
||||||
event.getPlayer().sendMessage(
|
event.getPlayer().sendMessage(
|
||||||
"§cError: You can't teleport out of a war zone!");
|
"§cError: You can't teleport out of a war zone!");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -439,7 +439,7 @@ public class PlayerListener implements Listener {
|
||||||
index + 1));
|
index + 1));
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
event.getPlayer().sendMessage(
|
event.getPlayer().sendMessage(
|
||||||
"§cError: Player not found. (/un" + s
|
"§cError: Player not found. (/un" + s
|
||||||
+ " <player>)");
|
+ " <player>)");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -468,7 +468,7 @@ public class PlayerListener implements Listener {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
event.getPlayer()
|
event.getPlayer()
|
||||||
.sendMessage(
|
.sendMessage(
|
||||||
"§cYou are not allowed to set New Haven as your enemy faction.");
|
"§cYou are not allowed to set New Haven as your enemy faction.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -480,15 +480,15 @@ public class PlayerListener implements Listener {
|
||||||
for (String nickname : nicknames.keySet()) {
|
for (String nickname : nicknames.keySet()) {
|
||||||
String nwithoutformatting = nickname;
|
String nwithoutformatting = nickname;
|
||||||
int index;
|
int index;
|
||||||
while ((index = nwithoutformatting.indexOf("§k")) != -1)
|
while ((index = nwithoutformatting.indexOf("§k")) != -1)
|
||||||
nwithoutformatting = nwithoutformatting.replace("§k"
|
nwithoutformatting = nwithoutformatting.replace("§k"
|
||||||
+ nwithoutformatting.charAt(index + 2), ""); // Support
|
+ nwithoutformatting.charAt(index + 2), ""); // Support
|
||||||
// for
|
// for
|
||||||
// one
|
// one
|
||||||
// random
|
// random
|
||||||
// char
|
// char
|
||||||
while ((index = nwithoutformatting.indexOf('§')) != -1)
|
while ((index = nwithoutformatting.indexOf('§')) != -1)
|
||||||
nwithoutformatting = nwithoutformatting.replace("§"
|
nwithoutformatting = nwithoutformatting.replace("§"
|
||||||
+ nwithoutformatting.charAt(index + 1), "");
|
+ nwithoutformatting.charAt(index + 1), "");
|
||||||
if (nwithoutformatting.startsWith(name)
|
if (nwithoutformatting.startsWith(name)
|
||||||
&& !nwithoutformatting.equals(Bukkit.getPlayer(
|
&& !nwithoutformatting.equals(Bukkit.getPlayer(
|
||||||
|
@ -538,7 +538,7 @@ public class PlayerListener implements Listener {
|
||||||
MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p
|
MaybeOfflinePlayer mp = MaybeOfflinePlayer.AllPlayers.get(p
|
||||||
.getUniqueId());
|
.getUniqueId());
|
||||||
mp.PressedF = false;
|
mp.PressedF = false;
|
||||||
p.sendMessage("§bPress F to pay respects.§r");
|
p.sendMessage("§bPress F to pay respects.§r");
|
||||||
}
|
}
|
||||||
Ftimer = new Timer();
|
Ftimer = new Timer();
|
||||||
TimerTask tt = new TimerTask() {
|
TimerTask tt = new TimerTask() {
|
||||||
|
@ -547,9 +547,9 @@ public class PlayerListener implements Listener {
|
||||||
if (ActiveF) {
|
if (ActiveF) {
|
||||||
ActiveF = false;
|
ActiveF = false;
|
||||||
for (Player p : PluginMain.GetPlayers()) {
|
for (Player p : PluginMain.GetPlayers()) {
|
||||||
p.sendMessage("§b" + FCount + " "
|
p.sendMessage("§b" + FCount + " "
|
||||||
+ (FCount == 1 ? "person" : "people")
|
+ (FCount == 1 ? "person" : "people")
|
||||||
+ " paid their respects.§r");
|
+ " paid their respects.§r");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -580,7 +580,7 @@ public class PlayerListener implements Listener {
|
||||||
return;
|
return;
|
||||||
// System.out.println("D");
|
// System.out.println("D");
|
||||||
SkullMeta meta = (SkullMeta) item.getItemMeta();
|
SkullMeta meta = (SkullMeta) item.getItemMeta();
|
||||||
if (!meta.getDisplayName().equals("§rOcelot Head")
|
if (!meta.getDisplayName().equals("§rOcelot Head")
|
||||||
|| !meta.getOwner().equals("MHF_Ocelot"))
|
|| !meta.getOwner().equals("MHF_Ocelot"))
|
||||||
return;
|
return;
|
||||||
// System.out.println("E");
|
// System.out.println("E");
|
||||||
|
@ -591,7 +591,7 @@ public class PlayerListener implements Listener {
|
||||||
if (!(hat != null
|
if (!(hat != null
|
||||||
&& (hat.getType().equals(Material.SKULL) || hat.getType()
|
&& (hat.getType().equals(Material.SKULL) || hat.getType()
|
||||||
.equals(Material.SKULL_ITEM)) && ((SkullMeta) hat
|
.equals(Material.SKULL_ITEM)) && ((SkullMeta) hat
|
||||||
.getItemMeta()).getDisplayName().equals("§rWolf Head")))
|
.getItemMeta()).getDisplayName().equals("§rWolf Head")))
|
||||||
e.getPlayer().damage(1f * item.getAmount(),
|
e.getPlayer().damage(1f * item.getAmount(),
|
||||||
Bukkit.getPlayer(meta.getLore().get(0)));
|
Bukkit.getPlayer(meta.getLore().get(0)));
|
||||||
e.getItem().remove();
|
e.getItem().remove();
|
||||||
|
@ -610,7 +610,7 @@ public class PlayerListener implements Listener {
|
||||||
PluginMain.economy.depositPlayer(op, 50.0);
|
PluginMain.economy.depositPlayer(op, 50.0);
|
||||||
}
|
}
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
p.sendMessage("§bThanks for voting! $50 was added to your account.");
|
p.sendMessage("§bThanks for voting! $50 was added to your account.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -658,14 +658,14 @@ public class PlayerListener implements Listener {
|
||||||
* System.out.println("Cause: "+e.getCause());
|
* System.out.println("Cause: "+e.getCause());
|
||||||
*/
|
*/
|
||||||
e.getPlayer().sendMessage(
|
e.getPlayer().sendMessage(
|
||||||
"§cYou are not allowed to teleport to/from No Mans Land.");
|
"§cYou are not allowed to teleport to/from No Mans Land.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MaybeOfflinePlayer.GetFromPlayer(e.getPlayer()).ChatOnly) {
|
if (MaybeOfflinePlayer.GetFromPlayer(e.getPlayer()).ChatOnly) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
e.getPlayer()
|
e.getPlayer()
|
||||||
.sendMessage(
|
.sendMessage(
|
||||||
"§cYou are not allowed to teleport while in chat-only mode.");
|
"§cYou are not allowed to teleport while in chat-only mode.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -684,7 +684,7 @@ public class PlayerListener implements Listener {
|
||||||
if (block.getType() == Material.ENDER_CHEST) {
|
if (block.getType() == Material.ENDER_CHEST) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
e.getPlayer().sendMessage(
|
e.getPlayer().sendMessage(
|
||||||
"§You are not allowed to use enderchests here.");
|
"§You are not allowed to use enderchests here.");
|
||||||
System.out.println(e.getPlayer().getName()
|
System.out.println(e.getPlayer().getName()
|
||||||
+ " tried to use an enderchest in twohundred.");
|
+ " tried to use an enderchest in twohundred.");
|
||||||
}
|
}
|
||||||
|
@ -704,7 +704,7 @@ public class PlayerListener implements Listener {
|
||||||
if (cmd.equalsIgnoreCase(Channel.GlobalChat.Command)) {
|
if (cmd.equalsIgnoreCase(Channel.GlobalChat.Command)) {
|
||||||
ConsoleChannel = Channel.GlobalChat;
|
ConsoleChannel = Channel.GlobalChat;
|
||||||
event.getSender().sendMessage(
|
event.getSender().sendMessage(
|
||||||
"§6You are now talking in: §b"
|
"§6You are now talking in: §b"
|
||||||
+ ConsoleChannel.DisplayName);
|
+ ConsoleChannel.DisplayName);
|
||||||
event.setCommand("dontrunthiscmd");
|
event.setCommand("dontrunthiscmd");
|
||||||
} else if (cmd.equalsIgnoreCase(Channel.AdminChat.Command)) {
|
} else if (cmd.equalsIgnoreCase(Channel.AdminChat.Command)) {
|
||||||
|
@ -713,7 +713,7 @@ public class PlayerListener implements Listener {
|
||||||
else
|
else
|
||||||
ConsoleChannel = Channel.AdminChat;
|
ConsoleChannel = Channel.AdminChat;
|
||||||
event.getSender().sendMessage(
|
event.getSender().sendMessage(
|
||||||
"§6You are now talking in: §b"
|
"§6You are now talking in: §b"
|
||||||
+ ConsoleChannel.DisplayName);
|
+ ConsoleChannel.DisplayName);
|
||||||
event.setCommand("dontrunthiscmd");
|
event.setCommand("dontrunthiscmd");
|
||||||
} else if (cmd.equalsIgnoreCase(Channel.ModChat.Command)) {
|
} else if (cmd.equalsIgnoreCase(Channel.ModChat.Command)) {
|
||||||
|
@ -722,7 +722,7 @@ public class PlayerListener implements Listener {
|
||||||
else
|
else
|
||||||
ConsoleChannel = Channel.ModChat;
|
ConsoleChannel = Channel.ModChat;
|
||||||
event.getSender().sendMessage(
|
event.getSender().sendMessage(
|
||||||
"§6You are now talking in: §b"
|
"§6You are now talking in: §b"
|
||||||
+ ConsoleChannel.DisplayName);
|
+ ConsoleChannel.DisplayName);
|
||||||
event.setCommand("dontrunthiscmd");
|
event.setCommand("dontrunthiscmd");
|
||||||
}
|
}
|
||||||
|
@ -782,7 +782,7 @@ public class PlayerListener implements Listener {
|
||||||
target = Bukkit.getPlayer(event.getCommand().substring(index + 1));
|
target = Bukkit.getPlayer(event.getCommand().substring(index + 1));
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
event.getSender().sendMessage(
|
event.getSender().sendMessage(
|
||||||
"§cError: Player not found. (/un" + s + " <player>)");
|
"§cError: Player not found. (/un" + s + " <player>)");
|
||||||
event.setCommand("dontrunthiscmd");
|
event.setCommand("dontrunthiscmd");
|
||||||
}
|
}
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
|
|
|
@ -82,27 +82,27 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
||||||
Commands comm = new Commands();
|
Commands comm = new Commands();
|
||||||
this.getCommand("u").setExecutor(comm);
|
this.getCommand("u").setExecutor(comm);
|
||||||
this.getCommand("u").setUsage(
|
this.getCommand("u").setUsage(
|
||||||
this.getCommand("u").getUsage().replace('&', '§'));
|
this.getCommand("u").getUsage().replace('&', '§'));
|
||||||
this.getCommand("nrp").setExecutor(comm);
|
this.getCommand("nrp").setExecutor(comm);
|
||||||
this.getCommand("nrp").setUsage(
|
this.getCommand("nrp").setUsage(
|
||||||
this.getCommand("nrp").getUsage().replace('&', '§'));
|
this.getCommand("nrp").getUsage().replace('&', '§'));
|
||||||
this.getCommand("ooc").setExecutor(comm);
|
this.getCommand("ooc").setExecutor(comm);
|
||||||
this.getCommand("ooc").setUsage(
|
this.getCommand("ooc").setUsage(
|
||||||
this.getCommand("ooc").getUsage().replace('&', '§'));
|
this.getCommand("ooc").getUsage().replace('&', '§'));
|
||||||
this.getCommand("unlol").setExecutor(comm);
|
this.getCommand("unlol").setExecutor(comm);
|
||||||
this.getCommand("unlaugh").setExecutor(comm);
|
this.getCommand("unlaugh").setExecutor(comm);
|
||||||
this.getCommand("mwiki").setExecutor(comm);
|
this.getCommand("mwiki").setExecutor(comm);
|
||||||
this.getCommand("mwiki").setUsage(
|
this.getCommand("mwiki").setUsage(
|
||||||
this.getCommand("mwiki").getUsage().replace('&', '§'));
|
this.getCommand("mwiki").getUsage().replace('&', '§'));
|
||||||
this.getCommand("tableflip").setExecutor(comm);
|
this.getCommand("tableflip").setExecutor(comm);
|
||||||
this.getCommand("tableflip").setUsage(
|
this.getCommand("tableflip").setUsage(
|
||||||
this.getCommand("tableflip").getUsage().replace('&', '§'));
|
this.getCommand("tableflip").getUsage().replace('&', '§'));
|
||||||
this.getCommand("unflip").setExecutor(comm);
|
this.getCommand("unflip").setExecutor(comm);
|
||||||
this.getCommand("unflip").setUsage(
|
this.getCommand("unflip").setUsage(
|
||||||
this.getCommand("unflip").getUsage().replace('&', '§'));
|
this.getCommand("unflip").getUsage().replace('&', '§'));
|
||||||
this.getCommand("chatonly").setExecutor(comm);
|
this.getCommand("chatonly").setExecutor(comm);
|
||||||
this.getCommand("chatonly").setUsage(
|
this.getCommand("chatonly").setUsage(
|
||||||
this.getCommand("chatonly").getUsage().replace('&', '§'));
|
this.getCommand("chatonly").getUsage().replace('&', '§'));
|
||||||
Instance = this;
|
Instance = this;
|
||||||
Console = this.getServer().getConsoleSender();
|
Console = this.getServer().getConsoleSender();
|
||||||
LoadFiles(false);
|
LoadFiles(false);
|
||||||
|
@ -312,9 +312,9 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
|
||||||
Player p = Bukkit.getPlayer(mp.UUID);
|
Player p = Bukkit.getPlayer(mp.UUID);
|
||||||
if (mp.FlairState.equals(FlairStates.Commented) && p != null)
|
if (mp.FlairState.equals(FlairStates.Commented) && p != null)
|
||||||
if (mp.UserNames.size() > 1)
|
if (mp.UserNames.size() > 1)
|
||||||
p.sendMessage("§9Multiple Reddit users commented your name. You can select with /u accept.§r §6Type /u accept or /u ignore§r");
|
p.sendMessage("§9Multiple Reddit users commented your name. You can select with /u accept.§r §6Type /u accept or /u ignore§r");
|
||||||
else
|
else
|
||||||
p.sendMessage("§9A Reddit user commented your name. Is that you?§r §6Type /u accept or /u ignore§r");
|
p.sendMessage("§9A Reddit user commented your name. Is that you?§r §6Type /u accept or /u ignore§r");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Collection<? extends Player> GetPlayers() {
|
public static Collection<? extends Player> GetPlayers() {
|
||||||
|
|
Loading…
Reference in a new issue