Switch PlayerChatEvent to AsyncPlayerChatEvent for bleeding-edge 1.3.1 Bukkit builds to prevent persistent nag from Bukkit, update Bukkit lib

UNTESTED, please confirm working... looks like chat event cancellation might be bugged in Bukkit at the moment but will hopefully be fixed soon if so
This commit is contained in:
Brettflan 2012-08-05 19:58:50 -05:00
parent 7f228b648a
commit ddd17830c0
3 changed files with 7 additions and 6 deletions

Binary file not shown.

View File

@ -3,6 +3,7 @@ package com.massivecraft.factions.listeners;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.logging.Level;
import java.util.regex.Matcher;
@ -15,7 +16,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.plugin.AuthorNagException;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.RegisteredListener;
@ -55,7 +56,7 @@ public class FactionsChatListener implements Listener
* We offer an optional and very simple chat formating functionality.
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void lowPlayerChatEvent(PlayerChatEvent event)
public void lowPlayerChatEvent(AsyncPlayerChatEvent event)
{
if (Conf.chatSetFormat)
{
@ -79,7 +80,7 @@ public class FactionsChatListener implements Listener
* The side effect is that other plugins at EventPriority.HIGHEST may experience the event as cancelled.
*/
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled=true)
public synchronized void onPlayerChat(PlayerChatEvent event)
public synchronized void onPlayerChat(AsyncPlayerChatEvent event)
{
// Should we even parse?
if ( ! Conf.chatParseTags) return;
@ -105,7 +106,7 @@ public class FactionsChatListener implements Listener
event.setCancelled(true);
// 2. We trigger EventPriority.MONITOR manually without relation color.
PlayerChatEvent monitorOnlyEvent = new PlayerChatEvent(from, message);
AsyncPlayerChatEvent monitorOnlyEvent = new AsyncPlayerChatEvent(false, from, message, new HashSet<Player>(Arrays.asList(Bukkit.getOnlinePlayers())));
monitorOnlyEvent.setFormat(formatWithoutColor);
callEventAtMonitorOnly(monitorOnlyEvent);

View File

@ -4,7 +4,7 @@ import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerPreLoginEvent;
@ -35,7 +35,7 @@ public class MPluginSecretPlayerListener implements Listener
}
@EventHandler(priority = EventPriority.LOW)
public void onPlayerChat(PlayerChatEvent event)
public void onPlayerChat(AsyncPlayerChatEvent event)
{
if (event.isCancelled()) return;