From b91f0fe488ba0f9d3030132968e2083f228a3245 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Wed, 20 Jun 2012 23:15:31 -0500 Subject: [PATCH] Implement plugin channel events. Addresses BUKKIT-1844 By: Wesley Wolfe --- .../org/bukkit/craftbukkit/entity/CraftPlayer.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 3291608f32..b3da75ef54 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -39,7 +39,9 @@ import org.bukkit.craftbukkit.map.RenderData; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerGameModeChangeEvent; +import org.bukkit.event.player.PlayerRegisterChannelEvent; import org.bukkit.event.player.PlayerTeleportEvent; +import org.bukkit.event.player.PlayerUnregisterChannelEvent; import org.bukkit.inventory.InventoryView.Property; import org.bukkit.map.MapView; import org.bukkit.metadata.MetadataValue; @@ -744,11 +746,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public void addChannel(String channel) { - channels.add(channel); + if (channels.add(channel)) { + server.getPluginManager().callEvent(new PlayerRegisterChannelEvent(this, channel)); + } } public void removeChannel(String channel) { - channels.remove(channel); + if (channels.remove(channel)) { + server.getPluginManager().callEvent(new PlayerUnregisterChannelEvent(this, channel)); + } } public Set getListeningPluginChannels() {