Using latest CAPI for integration

This commit is contained in:
Olof Larsson 2012-01-31 21:14:05 +01:00
parent 900f05c62f
commit 0abc3f397a
3 changed files with 9 additions and 9 deletions

Binary file not shown.

View File

@ -1,8 +1,6 @@
package com.massivecraft.factions.integration.capi; package com.massivecraft.factions.integration.capi;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.event.Event;
import org.bukkit.event.Event.Priority;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import com.massivecraft.factions.P; import com.massivecraft.factions.P;
@ -15,7 +13,7 @@ public class CapiFeatures
if (plug != null && plug.getClass().getName().equals("com.massivecraft.capi.P")) if (plug != null && plug.getClass().getName().equals("com.massivecraft.capi.P"))
{ {
P.p.log("Integration with the CAPI plugin was successful"); P.p.log("Integration with the CAPI plugin was successful");
P.p.registerEvent(Event.Type.CUSTOM_EVENT, new PluginCapiListener(P.p), Priority.Normal); Bukkit.getPluginManager().registerEvents(new PluginCapiListener(P.p), P.p);
} }
} }
} }

View File

@ -5,6 +5,9 @@ import java.util.Set;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import com.massivecraft.capi.Channel; import com.massivecraft.capi.Channel;
import com.massivecraft.capi.Channels; import com.massivecraft.capi.Channels;
@ -12,14 +15,13 @@ import com.massivecraft.capi.events.CAPIListChannelsEvent;
import com.massivecraft.capi.events.CAPIMessageToChannelEvent; import com.massivecraft.capi.events.CAPIMessageToChannelEvent;
import com.massivecraft.capi.events.CAPIMessageToPlayerEvent; import com.massivecraft.capi.events.CAPIMessageToPlayerEvent;
import com.massivecraft.capi.events.CAPISelectChannelEvent; import com.massivecraft.capi.events.CAPISelectChannelEvent;
import com.massivecraft.capi.listeners.CapiListener;
import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
import com.massivecraft.factions.P; import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Rel; import com.massivecraft.factions.struct.Rel;
public class PluginCapiListener extends CapiListener public class PluginCapiListener implements Listener
{ {
P p; P p;
@ -50,7 +52,7 @@ public class PluginCapiListener extends CapiListener
return format; return format;
} }
@Override @EventHandler(priority = EventPriority.NORMAL)
public void onListChannelsEvent(CAPIListChannelsEvent event) public void onListChannelsEvent(CAPIListChannelsEvent event)
{ {
for (Channel c : Channels.i.getAll()) for (Channel c : Channels.i.getAll())
@ -62,7 +64,7 @@ public class PluginCapiListener extends CapiListener
} }
} }
@Override @EventHandler(priority = EventPriority.NORMAL)
public void onMessageToChannel(CAPIMessageToChannelEvent event) public void onMessageToChannel(CAPIMessageToChannelEvent event)
{ {
if (event.isCancelled()) return; if (event.isCancelled()) return;
@ -89,14 +91,14 @@ public class PluginCapiListener extends CapiListener
} }
} }
@Override @EventHandler(priority = EventPriority.NORMAL)
public void onMessageToPlayer(CAPIMessageToPlayerEvent event) public void onMessageToPlayer(CAPIMessageToPlayerEvent event)
{ {
if (event.isCancelled()) return; if (event.isCancelled()) return;
event.setFormat(this.replacePlayerTags(event.getFormat(), FPlayers.i.get(event.getMe()), FPlayers.i.get(event.getYou()))); event.setFormat(this.replacePlayerTags(event.getFormat(), FPlayers.i.get(event.getMe()), FPlayers.i.get(event.getYou())));
} }
@Override @EventHandler(priority = EventPriority.NORMAL)
public void onSelectChannel(CAPISelectChannelEvent event) public void onSelectChannel(CAPISelectChannelEvent event)
{ {
if (event.isCancelled()) return; if (event.isCancelled()) return;