Edited code to include names and disguise type.
[disguisecraft:dcchat.git] / src / pgDev / bukkit / DCChat / DCListener.java
1 package pgDev.bukkit.DCChat;\r
2 \r
3 import org.bukkit.ChatColor;\r
4 import org.bukkit.entity.Player;\r
5 import org.bukkit.event.*;\r
6 \r
7 import pgDev.bukkit.DisguiseCraft.api.PlayerDisguiseEvent;\r
8 import pgDev.bukkit.DisguiseCraft.api.PlayerUndisguiseEvent;\r
9 import pgDev.bukkit.DisguiseCraft.disguise.Disguise;\r
10 \r
11 public class DCListener implements Listener {\r
12         final DCChat plugin;\r
13         \r
14         public DCListener(DCChat plugin){\r
15                 this.plugin = plugin;\r
16         }\r
17 \r
18         @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)\r
19         public void onDisguise(PlayerDisguiseEvent e){\r
20                 Player p = e.getPlayer();\r
21                 Disguise d = e.getDisguise();\r
22                 \r
23                 p.setDisplayName(ChatColor.GOLD + "[" + d.type.name() + "] " + ChatColor.RESET + p.getName());\r
24         }\r
25         \r
26         @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)\r
27         public void onUndisguise(PlayerUndisguiseEvent e){\r
28                 Player p = e.getPlayer();\r
29                 \r
30                 p.setDisplayName(p.getName());\r
31         }\r
32 }\r