mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-22 17:18:37 +01:00
parent
1a07815f4b
commit
af73c11638
@ -67,7 +67,7 @@ import org.yaml.snakeyaml.error.YAMLException;
|
||||
|
||||
public class Essentials extends JavaPlugin implements IEssentials
|
||||
{
|
||||
public static final int BUKKIT_VERSION = 2267;
|
||||
public static final int BUKKIT_VERSION = 2289;
|
||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
||||
private transient ISettings settings;
|
||||
private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this);
|
||||
|
@ -50,7 +50,7 @@ public class EssentialsPlayerListener implements Listener
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onPlayerChat(final PlayerChatEvent event)
|
||||
public void onPlayerChat(final AsyncPlayerChatEvent event)
|
||||
{
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
if (user.isMuted())
|
||||
|
@ -8,7 +8,7 @@ import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
@ -34,7 +34,7 @@ public class EssentialsChat extends JavaPlugin
|
||||
}
|
||||
|
||||
chatListener = new ConcurrentSkipListMap<String, IEssentialsChatListener>();
|
||||
final Map<PlayerChatEvent, ChatStore> chatStore = Collections.synchronizedMap(new HashMap<PlayerChatEvent, ChatStore>());
|
||||
final Map<AsyncPlayerChatEvent, ChatStore> chatStore = Collections.synchronizedMap(new HashMap<AsyncPlayerChatEvent, ChatStore>());
|
||||
|
||||
|
||||
final EssentialsChatPlayerListenerLowest playerListenerLowest = new EssentialsChatPlayerListenerLowest(getServer(), ess, chatListener, chatStore);
|
||||
|
@ -12,7 +12,7 @@ import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
|
||||
//TODO: Translate the local/spy tags
|
||||
public abstract class EssentialsChatPlayer implements Listener
|
||||
@ -21,12 +21,12 @@ public abstract class EssentialsChatPlayer implements Listener
|
||||
protected final static Logger logger = Logger.getLogger("Minecraft");
|
||||
protected final transient Map<String, IEssentialsChatListener> listeners;
|
||||
protected final transient Server server;
|
||||
protected final transient Map<PlayerChatEvent, ChatStore> chatStorage;
|
||||
protected final transient Map<AsyncPlayerChatEvent, ChatStore> chatStorage;
|
||||
|
||||
public EssentialsChatPlayer(final Server server,
|
||||
final IEssentials ess,
|
||||
final Map<String, IEssentialsChatListener> listeners,
|
||||
final Map<PlayerChatEvent, ChatStore> chatStorage)
|
||||
final Map<AsyncPlayerChatEvent, ChatStore> chatStorage)
|
||||
{
|
||||
this.ess = ess;
|
||||
this.listeners = listeners;
|
||||
@ -34,11 +34,11 @@ public abstract class EssentialsChatPlayer implements Listener
|
||||
this.chatStorage = chatStorage;
|
||||
}
|
||||
|
||||
public void onPlayerChat(final PlayerChatEvent event)
|
||||
public void onPlayerChat(final AsyncPlayerChatEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
public boolean isAborted(final PlayerChatEvent event)
|
||||
public boolean isAborted(final AsyncPlayerChatEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
{
|
||||
@ -69,17 +69,17 @@ public abstract class EssentialsChatPlayer implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
public ChatStore getChatStore(final PlayerChatEvent event)
|
||||
public ChatStore getChatStore(final AsyncPlayerChatEvent event)
|
||||
{
|
||||
return chatStorage.get(event);
|
||||
}
|
||||
|
||||
public void setChatStore(final PlayerChatEvent event, final ChatStore chatStore)
|
||||
public void setChatStore(final AsyncPlayerChatEvent event, final ChatStore chatStore)
|
||||
{
|
||||
chatStorage.put(event, chatStore);
|
||||
}
|
||||
|
||||
public ChatStore delChatStore(final PlayerChatEvent event)
|
||||
public ChatStore delChatStore(final AsyncPlayerChatEvent event)
|
||||
{
|
||||
return chatStorage.remove(event);
|
||||
}
|
||||
@ -89,7 +89,7 @@ public abstract class EssentialsChatPlayer implements Listener
|
||||
charge.charge(user);
|
||||
}
|
||||
|
||||
protected boolean charge(final PlayerChatEvent event, final ChatStore chatStore)
|
||||
protected boolean charge(final AsyncPlayerChatEvent event, final ChatStore chatStore)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -104,7 +104,7 @@ public abstract class EssentialsChatPlayer implements Listener
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void sendLocalChat(final PlayerChatEvent event, final ChatStore chatStore)
|
||||
protected void sendLocalChat(final AsyncPlayerChatEvent event, final ChatStore chatStore)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
final User sender = chatStore.getUser();
|
||||
|
@ -5,7 +5,7 @@ import java.util.Map;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
|
||||
|
||||
public class EssentialsChatPlayerListenerHighest extends EssentialsChatPlayer
|
||||
@ -13,14 +13,14 @@ public class EssentialsChatPlayerListenerHighest extends EssentialsChatPlayer
|
||||
public EssentialsChatPlayerListenerHighest(final Server server,
|
||||
final IEssentials ess,
|
||||
final Map<String, IEssentialsChatListener> listeners,
|
||||
final Map<PlayerChatEvent, ChatStore> chatStorage)
|
||||
final Map<AsyncPlayerChatEvent, ChatStore> chatStorage)
|
||||
{
|
||||
super(server, ess, listeners, chatStorage);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@Override
|
||||
public void onPlayerChat(final PlayerChatEvent event)
|
||||
public void onPlayerChat(final AsyncPlayerChatEvent event)
|
||||
{
|
||||
final ChatStore chatStore = delChatStore(event);
|
||||
if (isAborted(event))
|
||||
|
@ -9,7 +9,7 @@ import java.util.Map;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
|
||||
|
||||
public class EssentialsChatPlayerListenerLowest extends EssentialsChatPlayer
|
||||
@ -17,14 +17,14 @@ public class EssentialsChatPlayerListenerLowest extends EssentialsChatPlayer
|
||||
public EssentialsChatPlayerListenerLowest(final Server server,
|
||||
final IEssentials ess,
|
||||
final Map<String, IEssentialsChatListener> listeners,
|
||||
final Map<PlayerChatEvent, ChatStore> chatStorage)
|
||||
final Map<AsyncPlayerChatEvent, ChatStore> chatStorage)
|
||||
{
|
||||
super(server, ess, listeners, chatStorage);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
@Override
|
||||
public void onPlayerChat(final PlayerChatEvent event)
|
||||
public void onPlayerChat(final AsyncPlayerChatEvent event)
|
||||
{
|
||||
if (isAborted(event))
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ import java.util.Map;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
|
||||
|
||||
public class EssentialsChatPlayerListenerNormal extends EssentialsChatPlayer
|
||||
@ -16,14 +16,14 @@ public class EssentialsChatPlayerListenerNormal extends EssentialsChatPlayer
|
||||
public EssentialsChatPlayerListenerNormal(final Server server,
|
||||
final IEssentials ess,
|
||||
final Map<String, IEssentialsChatListener> listeners,
|
||||
final Map<PlayerChatEvent, ChatStore> chatStorage)
|
||||
final Map<AsyncPlayerChatEvent, ChatStore> chatStorage)
|
||||
{
|
||||
super(server, ess, listeners, chatStorage);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
@Override
|
||||
public void onPlayerChat(final PlayerChatEvent event)
|
||||
public void onPlayerChat(final AsyncPlayerChatEvent event)
|
||||
{
|
||||
if (isAborted(event))
|
||||
{
|
||||
|
@ -1,12 +1,12 @@
|
||||
package com.earth2me.essentials.chat;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
|
||||
|
||||
public interface IEssentialsChatListener
|
||||
{
|
||||
boolean shouldHandleThisChat(PlayerChatEvent event);
|
||||
boolean shouldHandleThisChat(AsyncPlayerChatEvent event);
|
||||
|
||||
String modifyMessage(PlayerChatEvent event, Player target, String message);
|
||||
String modifyMessage(AsyncPlayerChatEvent event, Player target, String message);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
@ -154,7 +154,7 @@ public class EssentialsHelp implements Listener
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerChat(final PlayerChatEvent event)
|
||||
public void onPlayerChat(final AsyncPlayerChatEvent event)
|
||||
{
|
||||
if (event.getPlayer() == chatUser)
|
||||
{
|
||||
|
@ -10,7 +10,7 @@ import org.bukkit.entity.Player;
|
||||
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.PlayerJoinEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
@ -100,7 +100,7 @@ public class UpdateProcess implements Listener
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onPlayerChat(final PlayerChatEvent event)
|
||||
public void onPlayerChat(final AsyncPlayerChatEvent event)
|
||||
{
|
||||
if (event.getPlayer() == currentPlayer)
|
||||
{
|
||||
|
@ -5,7 +5,7 @@ import com.earth2me.essentials.User;
|
||||
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.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
@ -28,7 +28,7 @@ class EssentialsXMPPPlayerListener implements Listener
|
||||
}
|
||||
|
||||
@EventHandler(priority= EventPriority.MONITOR)
|
||||
public void onPlayerChat(final PlayerChatEvent event)
|
||||
public void onPlayerChat(final AsyncPlayerChatEvent event)
|
||||
{
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
sendMessageToSpyUsers(String.format(event.getFormat(), user.getDisplayName(), event.getMessage()));
|
||||
|
BIN
lib/bukkit.jar
BIN
lib/bukkit.jar
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user