mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-24 11:15:21 +01:00
Add support for AsyncPlayerChatEvent - make silly nagging STFU - still support 1.2.5
This commit is contained in:
parent
905802e558
commit
38a4d869f6
@ -41,6 +41,7 @@ import org.bukkit.event.block.BlockSpreadEvent;
|
|||||||
import org.bukkit.event.block.LeavesDecayEvent;
|
import org.bukkit.event.block.LeavesDecayEvent;
|
||||||
import org.bukkit.event.block.SignChangeEvent;
|
import org.bukkit.event.block.SignChangeEvent;
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
import org.bukkit.event.player.PlayerBedLeaveEvent;
|
import org.bukkit.event.player.PlayerBedLeaveEvent;
|
||||||
import org.bukkit.event.player.PlayerChatEvent;
|
import org.bukkit.event.player.PlayerChatEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
@ -51,6 +52,8 @@ import org.bukkit.event.world.SpawnChangeEvent;
|
|||||||
import org.bukkit.event.world.StructureGrowEvent;
|
import org.bukkit.event.world.StructureGrowEvent;
|
||||||
import org.bukkit.event.world.WorldLoadEvent;
|
import org.bukkit.event.world.WorldLoadEvent;
|
||||||
import org.bukkit.event.world.WorldUnloadEvent;
|
import org.bukkit.event.world.WorldUnloadEvent;
|
||||||
|
import org.bukkit.material.MaterialData;
|
||||||
|
import org.bukkit.material.Tree;
|
||||||
import org.bukkit.permissions.Permission;
|
import org.bukkit.permissions.Permission;
|
||||||
import org.bukkit.permissions.PermissionDefault;
|
import org.bukkit.permissions.PermissionDefault;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
@ -197,6 +200,25 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
|||||||
}, DynmapPlugin.this);
|
}, DynmapPlugin.this);
|
||||||
break;
|
break;
|
||||||
case PLAYER_CHAT:
|
case PLAYER_CHAT:
|
||||||
|
try {
|
||||||
|
Class.forName("org.bukkit.event.player.AsyncPlayerChatEvent");
|
||||||
|
pm.registerEvents(new Listener() {
|
||||||
|
@EventHandler(priority=EventPriority.MONITOR)
|
||||||
|
public void onPlayerChat(AsyncPlayerChatEvent evt) {
|
||||||
|
if(evt.isCancelled()) return;
|
||||||
|
final Player p = evt.getPlayer();
|
||||||
|
final String msg = evt.getMessage();
|
||||||
|
getServer().getScheduler().scheduleSyncDelayedTask(DynmapPlugin.this, new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
DynmapPlayer dp = null;
|
||||||
|
if(p != null)
|
||||||
|
dp = new BukkitPlayer(p);
|
||||||
|
core.listenerManager.processChatEvent(EventType.PLAYER_CHAT, dp, msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, DynmapPlugin.this);
|
||||||
|
} catch (ClassNotFoundException cnfx) {
|
||||||
pm.registerEvents(new Listener() {
|
pm.registerEvents(new Listener() {
|
||||||
@EventHandler(priority=EventPriority.MONITOR)
|
@EventHandler(priority=EventPriority.MONITOR)
|
||||||
public void onPlayerChat(PlayerChatEvent evt) {
|
public void onPlayerChat(PlayerChatEvent evt) {
|
||||||
@ -207,6 +229,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
|||||||
core.listenerManager.processChatEvent(EventType.PLAYER_CHAT, p, evt.getMessage());
|
core.listenerManager.processChatEvent(EventType.PLAYER_CHAT, p, evt.getMessage());
|
||||||
}
|
}
|
||||||
}, DynmapPlugin.this);
|
}, DynmapPlugin.this);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case BLOCK_BREAK:
|
case BLOCK_BREAK:
|
||||||
pm.registerEvents(new Listener() {
|
pm.registerEvents(new Listener() {
|
||||||
|
Loading…
Reference in New Issue
Block a user