From d391d12ab53ef1c5bc24b0da799fac998736145a Mon Sep 17 00:00:00 2001 From: bm01 Date: Sat, 10 Mar 2012 02:37:22 +0100 Subject: [PATCH] Alert lone players trying to speak in party chat --- .../java/com/gmail/nossr50/commands/party/PCommand.java | 5 +++++ .../java/com/gmail/nossr50/listeners/mcPlayerListener.java | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/src/main/java/com/gmail/nossr50/commands/party/PCommand.java b/src/main/java/com/gmail/nossr50/commands/party/PCommand.java index 1e02742ef..8f8d4b3d6 100644 --- a/src/main/java/com/gmail/nossr50/commands/party/PCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/party/PCommand.java @@ -61,6 +61,11 @@ public class PCommand implements CommandExecutor { // Not a toggle, a message if (args.length >= 1) { + if(!PP.inParty()) { + player.sendMessage("You're not in a party."); //TODO: Use mcLocale + return true; + } + String pMessage = args[0]; for (int i = 1; i <= args.length - 1; i++) { pMessage = pMessage + " " + args[i]; diff --git a/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java index d3e5feeab..78a648b31 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java @@ -304,6 +304,12 @@ public class mcPlayerListener implements Listener if(PP.getPartyChatMode()) { event.setCancelled(true); + + if(!PP.inParty()) { + player.sendMessage("You're not in a party, type /p to leave party chat mode."); //TODO: Use mcLocale + return; + } + String name = (LoadProperties.pDisplayNames) ? player.getDisplayName() : player.getName(); String format = ChatColor.GREEN + "(" + ChatColor.WHITE + name + ChatColor.GREEN + ") "+event.getMessage(); for(Player x : Bukkit.getServer().getOnlinePlayers())