Fixed certain messages kicking players, fixed rainbow chat, added tbmc.rainbow permission

This commit is contained in:
Norbi Peti 2016-02-27 21:10:02 +01:00
parent 2007001562
commit 6d573a0d68
8 changed files with 28 additions and 3 deletions

Binary file not shown.

View file

@ -23,3 +23,5 @@ depend: [Essentials, Towny, Minigames, Votifier, Factions]
permissions:
tbmc.admin:
description: Gives access to /un- commands and /u admin commands
tbmc.rainbow:
description: Gives access to rainbow colors (/u c).

View file

@ -175,7 +175,7 @@ public class Commands implements CommandExecutor {
DoKittyCannon(player, args);
break;
case "c":
if (PluginMain.permission.has(player, "tbmc.admin"))
if (PluginMain.permission.has(player, "tbmc.rainbow"))
{
p.RainbowPresserColorMode = !p.RainbowPresserColorMode;
if(p.RainbowPresserColorMode)

View file

@ -240,6 +240,21 @@ public class PlayerListener implements Listener { // 2015.07.16.
} catch (MalformedURLException e) {
}
if (player.RainbowPresserColorMode) {
if (item.startsWith(RainbowPresserColors[rpc])) { // Prevent
// words
// being
// equal/starting
// with a
// color
// code
// letter to
// be messed
// up
if (rpc + 1 < RainbowPresserColors.length)
rpc++;
else
rpc = 0;
}
formattedmessage = formattedmessage.replace(item, "§"
+ RainbowPresserColors[rpc] + item);
if (rpc + 1 < RainbowPresserColors.length)
@ -380,6 +395,13 @@ public class PlayerListener implements Listener { // 2015.07.16.
formattedmessage, (greentext ? "green"
: player.CurrentChannel.Color)));
// System.out.println(formattedmessage); // TO!DO: TMP
String jsonstr = json.toString();
if (jsonstr.length() >= 32767) {
event.getPlayer()
.sendMessage(
"§cError: Message too large. Try shortening it, or remove hashtags and other formatting.");
return;
}
if (player.CurrentChannel.equals(Channel.TownChat)
|| player.CurrentChannel.equals(Channel.NationChat))
// for (Resident resident :
@ -835,8 +857,9 @@ public class PlayerListener implements Listener { // 2015.07.16.
if (args[0].toLowerCase().equals("enemy")
&& args[1].equalsIgnoreCase("newhaven")) {
event.setCancelled(true);
event.getPlayer().sendMessage(
"§cYou are not allowed to set New Haven as your enemy faction.");
event.getPlayer()
.sendMessage(
"§cYou are not allowed to set New Haven as your enemy faction.");
}
}
}