mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-11-27 20:59:16 +01:00
Update to use async chat event.
This commit is contained in:
parent
8a6a97cc90
commit
526734b9f6
@ -9,7 +9,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerChatEvent;
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
|
|
||||||
import java.util.UnknownFormatConversionException;
|
import java.util.UnknownFormatConversionException;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
@ -24,7 +24,7 @@ public class FactionsChatListener implements Listener {
|
|||||||
|
|
||||||
// this is for handling slashless command usage and faction/alliance chat, set at lowest priority so Factions gets to them first
|
// this is for handling slashless command usage and faction/alliance chat, set at lowest priority so Factions gets to them first
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onPlayerEarlyChat(PlayerChatEvent event) {
|
public void onPlayerEarlyChat(AsyncPlayerChatEvent event) {
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -34,15 +34,6 @@ public class FactionsChatListener implements Listener {
|
|||||||
FPlayer me = FPlayers.i.get(talkingPlayer);
|
FPlayer me = FPlayers.i.get(talkingPlayer);
|
||||||
ChatMode chat = me.getChatMode();
|
ChatMode chat = me.getChatMode();
|
||||||
|
|
||||||
// slashless factions commands need to be handled here if the user isn't in public chat mode
|
|
||||||
if (chat != ChatMode.PUBLIC && p.handleCommand(talkingPlayer, msg, false, true)) {
|
|
||||||
if (Conf.logPlayerCommands) {
|
|
||||||
Bukkit.getLogger().log(Level.INFO, "[PLAYER_COMMAND] " + talkingPlayer.getName() + ": " + msg);
|
|
||||||
}
|
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Is it a faction chat message?
|
// Is it a faction chat message?
|
||||||
if (chat == ChatMode.FACTION) {
|
if (chat == ChatMode.FACTION) {
|
||||||
Faction myFaction = me.getFaction();
|
Faction myFaction = me.getFaction();
|
||||||
@ -60,7 +51,6 @@ public class FactionsChatListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
|
||||||
} else if (chat == ChatMode.ALLIANCE) {
|
} else if (chat == ChatMode.ALLIANCE) {
|
||||||
Faction myFaction = me.getFaction();
|
Faction myFaction = me.getFaction();
|
||||||
|
|
||||||
@ -84,13 +74,12 @@ public class FactionsChatListener implements Listener {
|
|||||||
Bukkit.getLogger().log(Level.INFO, ChatColor.stripColor("AllianceChat: " + message));
|
Bukkit.getLogger().log(Level.INFO, ChatColor.stripColor("AllianceChat: " + message));
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is for handling insertion of the player's faction tag, set at highest priority to give other plugins a chance to modify chat first
|
// this is for handling insertion of the player's faction tag, set at highest priority to give other plugins a chance to modify chat first
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onPlayerChat(PlayerChatEvent event) {
|
public void onPlayerChat(AsyncPlayerChatEvent event) {
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user