diff --git a/TheButtonAutoFlair.jar b/TheButtonAutoFlair.jar index bee080c..da82965 100644 Binary files a/TheButtonAutoFlair.jar and b/TheButtonAutoFlair.jar differ diff --git a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java index f4326ba..61d0e2c 100644 --- a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java +++ b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/Commands.java @@ -196,6 +196,9 @@ public class Commands implements CommandExecutor { p.OtherColorMode, p.OtherColorMode)); else player.sendMessage("§eMessage color reset."); + } else { + player.sendMessage("§cYou don't have permission for this command."); + return true; } } break; diff --git a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java index 68e3a84..2ac1f4e 100644 --- a/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java +++ b/TheButtonAutoFlair/src/tk/sznp/thebuttonautoflair/PlayerListener.java @@ -10,7 +10,6 @@ import java.util.Random; import java.util.Timer; import java.util.TimerTask; import java.util.UUID; -import java.util.regex.Matcher; import java.util.regex.Pattern; import org.bukkit.Bukkit; @@ -27,6 +26,7 @@ import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.PlayerChatTabCompleteEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerPickupItemEvent; @@ -223,6 +223,7 @@ public class PlayerListener implements Listener { // 2015.07.16. final String[] RainbowPresserColors = new String[] { "c", "6", "e", "a", "9", "5" }; int rpc = 0; + int currentindex = 0; for (String item : parts) { try { URL url = new URL(item); @@ -256,15 +257,25 @@ public class PlayerListener implements Listener { // 2015.07.16. else rpc = 0; } - formattedmessage = formattedmessage.replaceFirst( - "(?i)" + Pattern.quote(item), - Matcher.quoteReplacement("§" - + RainbowPresserColors[rpc] + item)); + /*System.out.println("item: " + item); // TO!DO: TMP + System.out.println("currentindex: " + currentindex); + System.out.println("format: " + + String.format("§%s%s", RainbowPresserColors[rpc], + item)); + System.out.println("formattedmessage: " + formattedmessage);*/ + StringBuffer buf = new StringBuffer(formattedmessage); + buf.replace(currentindex, currentindex + item.length(), + String.format("§%s%s", RainbowPresserColors[rpc], item)); + formattedmessage = buf.toString(); + /* + * "§" + RainbowPresserColors[rpc] + item)); + */ if (rpc + 1 < RainbowPresserColors.length) rpc++; else rpc = 0; } + currentindex += item.length() + 3; } if (player.OtherColorMode != 0xFF) { formattedmessage = String.format("§%x%s", player.OtherColorMode, @@ -1065,4 +1076,21 @@ public class PlayerListener implements Listener { // 2015.07.16. "§cYou are not allowed to teleport to/from No Mans Land."); } } + + @EventHandler + public void onPlayerInteract(PlayerInteractEvent e) { + MinigamePlayer mp = Minigames.plugin.pdata.getMinigamePlayer(e + .getPlayer()); + if (mp == null) + return; + if (mp.getMinigame().getName(false).equalsIgnoreCase("twohundred")) { + if (e.getClickedBlock().getType() == Material.ENDER_CHEST) { + e.setCancelled(true); + e.getPlayer().sendMessage( + "§You are not allowed to use enderchests here."); + System.out.println(e.getPlayer().getName() + + " tried to use an enderchest in twohundred."); + } + } + } } diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands$2.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands$2.class index f952630..e1bbc8e 100644 Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands$2.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands$2.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands.class index 489ae70..555a91a 100644 Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/Commands.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$3.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$3.class index 577e9cc..b41dcdc 100644 Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$3.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$3.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$4.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$4.class index b4fd590..4370f02 100644 Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$4.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener$4.class differ diff --git a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener.class b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener.class index a11798d..7ba8677 100644 Binary files a/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener.class and b/TheButtonAutoFlair/target/classes/tk/sznp/thebuttonautoflair/PlayerListener.class differ