mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
Fixed /p and /a incompatibilities with bChatManager
This commit is contained in:
parent
06ede80435
commit
84e36d758e
@ -17,6 +17,8 @@ Version 1.3.07
|
||||
+ Added a permission node for Farmer's Diet
|
||||
+ Added config options for enabling/disabling specific double drops
|
||||
+ Added automatic zip backup of flatfile database & config files
|
||||
= Fixed /p and /a incompatibilities with bChatManager
|
||||
= Fixed Iron Grip working reversely
|
||||
= Fixed NPE when user clicked the HUD button with Spout
|
||||
= Fixed bug where the permission node for Impact didn't work
|
||||
= Fixed some bypass nodes defaulting true for Ops
|
||||
@ -38,7 +40,6 @@ Version 1.3.06
|
||||
+ Added API functions for admin & party chat
|
||||
+ Added Iron Grip skill to Unarmed which gives players an chance to keep from being disarmed.
|
||||
+ Added some new languages to the locale files.
|
||||
= Fixed Iron Grip working reversely
|
||||
= Fixed Green Thumb consuming 2 seeds instead of 1
|
||||
= Fixed exploit where you could teleport to yourself with PTP to prevent things like fall damage
|
||||
= Fixed NPE error with Metrics on startup
|
||||
|
@ -286,60 +286,59 @@ public class PlayerListener implements Listener {
|
||||
*
|
||||
* @param event The event to watch
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onPlayerChat(PlayerChatEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
boolean partyChat = PP.getPartyChatMode();
|
||||
boolean adminChat = PP.getAdminChatMode();
|
||||
Set<Player> recipients = event.getRecipients();
|
||||
|
||||
Set<Player> intendedRecipients = new HashSet<Player>();
|
||||
ChatColor color = null;
|
||||
if (PP.getPartyChatMode()) {
|
||||
if (!PP.inParty()) {
|
||||
player.sendMessage("You're not in a party, type /p to leave party chat mode."); //TODO: Use mcLocale
|
||||
return;
|
||||
}
|
||||
|
||||
if (partyChat || adminChat) {
|
||||
if (partyChat) {
|
||||
if (!PP.inParty()) {
|
||||
player.sendMessage("You're not in a party, type /p to leave party chat mode."); //TODO: Use mcLocale
|
||||
return;
|
||||
}
|
||||
McMMOPartyChatEvent chatEvent = new McMMOPartyChatEvent(player.getName(), PP.getParty(), event.getMessage());
|
||||
plugin.getServer().getPluginManager().callEvent(chatEvent);
|
||||
|
||||
color = ChatColor.GREEN;
|
||||
if(chatEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
McMMOPartyChatEvent chatEvent = new McMMOPartyChatEvent(player.getName(), PP.getParty(), event.getMessage());
|
||||
plugin.getServer().getPluginManager().callEvent(chatEvent);
|
||||
event.setMessage(chatEvent.getMessage());
|
||||
|
||||
if(chatEvent.isCancelled()) return;
|
||||
Set<Player> intendedRecipients = new HashSet<Player>();
|
||||
|
||||
event.setMessage(chatEvent.getMessage());
|
||||
for (Player x : Party.getInstance().getOnlineMembers(player)) {
|
||||
intendedRecipients.add(x);
|
||||
}
|
||||
|
||||
for (Player x : Party.getInstance().getOnlineMembers(player)) {
|
||||
ChatColor bracketColor = ChatColor.GREEN;
|
||||
|
||||
event.setFormat(bracketColor + "(" + ChatColor.WHITE + "%1$s" + bracketColor + ") %2$s");
|
||||
event.getRecipients().retainAll(intendedRecipients);
|
||||
}
|
||||
else if (PP.getAdminChatMode()) {
|
||||
McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent(player.getName(), event.getMessage());
|
||||
plugin.getServer().getPluginManager().callEvent(chatEvent);
|
||||
|
||||
if(chatEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.setMessage(chatEvent.getMessage());
|
||||
|
||||
Set<Player> intendedRecipients = new HashSet<Player>();
|
||||
|
||||
for (Player x : plugin.getServer().getOnlinePlayers()) {
|
||||
if (x.isOp() || Permissions.getInstance().adminChat(x)) {
|
||||
intendedRecipients.add(x);
|
||||
}
|
||||
|
||||
event.setFormat(color + "(" + ChatColor.WHITE + "%1$s" + color + ") %2$s");
|
||||
}
|
||||
|
||||
if (adminChat) {
|
||||
color = ChatColor.AQUA;
|
||||
ChatColor bracketColor = ChatColor.AQUA;
|
||||
|
||||
McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent(player.getName(), event.getMessage());
|
||||
plugin.getServer().getPluginManager().callEvent(chatEvent);
|
||||
|
||||
if(chatEvent.isCancelled()) return;
|
||||
|
||||
event.setMessage(chatEvent.getMessage());
|
||||
|
||||
for (Player x : plugin.getServer().getOnlinePlayers()) {
|
||||
if (x.isOp() || Permissions.getInstance().adminChat(x)) {
|
||||
intendedRecipients.add(x);
|
||||
}
|
||||
}
|
||||
|
||||
event.setFormat(color + "{" + ChatColor.WHITE + "%1$s" + color + "} %2$s");
|
||||
}
|
||||
|
||||
recipients.retainAll(intendedRecipients);
|
||||
event.setFormat(bracketColor + "{" + ChatColor.WHITE + "%1$s" + bracketColor + "} %2$s");
|
||||
event.getRecipients().retainAll(intendedRecipients);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user