mirror of
https://gitlab.com/SamB440/rpgregions-2.git
synced 2025-12-30 12:19:16 +00:00
Warn and prevent entry if a plugin is doing bad stuff to packets
This commit is contained in:
@@ -12,6 +12,7 @@ import io.netty.channel.ChannelInitializer;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import io.netty.channel.ChannelPromise;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@@ -166,15 +167,21 @@ public abstract class TinyProtocol {
|
||||
listener = new Listener() {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public final void onPlayerLogin(PlayerLoginEvent e) {
|
||||
public final void onPlayerLogin(PlayerLoginEvent event) {
|
||||
if (closed)
|
||||
return;
|
||||
|
||||
Channel channel = getChannel(e.getPlayer());
|
||||
final Player player = event.getPlayer();
|
||||
try {
|
||||
Channel channel = getChannel(player);
|
||||
|
||||
// Don't inject players that have been explicitly uninjected
|
||||
if (!uninjectedChannels.contains(channel)) {
|
||||
injectPlayer(e.getPlayer());
|
||||
// Don't inject players that have been explicitly uninjected
|
||||
if (!uninjectedChannels.contains(channel)) {
|
||||
injectPlayer(player);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, ChatColor.RED + "THIS IS NOT A BUG IN RPGREGIONS. THIS IS A FAULTY PLUGIN MODIFYING PACKETS! A plugin incompatibility between RPGRegions and another plugin has been detected. Please contact the developer of RPGRegions.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user