From 30c3d2bfb9c0ceb392a6706647ce008d9fd14bcc Mon Sep 17 00:00:00 2001 From: ayunami2000 Date: Sun, 24 Jul 2022 20:05:41 -0400 Subject: [PATCH] Patch plugin messages still sending to backend server --- .../md_5/bungee/eaglercraft/PluginEaglerSkins.java | 11 +++++++---- .../md_5/bungee/eaglercraft/PluginEaglerVoice.java | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/eaglercraftbungee/src/main/java/net/md_5/bungee/eaglercraft/PluginEaglerSkins.java b/eaglercraftbungee/src/main/java/net/md_5/bungee/eaglercraft/PluginEaglerSkins.java index e3242c6..54aea81 100644 --- a/eaglercraftbungee/src/main/java/net/md_5/bungee/eaglercraft/PluginEaglerSkins.java +++ b/eaglercraftbungee/src/main/java/net/md_5/bungee/eaglercraft/PluginEaglerSkins.java @@ -46,17 +46,18 @@ public class PluginEaglerSkins extends Plugin implements Listener { String user = ((UserConnection)event.getSender()).getName(); byte[] msg = event.getData(); try { + event.setCancelled(true); if("EAG|MySkin".equals(event.getTag())) { if(!skinCollection.containsKey(user)) { int t = (int)msg[0] & 0xFF; - if(t >= 0 && t < SKIN_DATA_SIZE.length && msg.length == (SKIN_DATA_SIZE[t] + 1)) { + if(t < SKIN_DATA_SIZE.length && msg.length == (SKIN_DATA_SIZE[t] + 1)) { skinCollection.put(user, msg); } } }else if("EAG|MyCape".equals(event.getTag())) { if(!capeCollection.containsKey(user)) { int t = (int)msg[0] & 0xFF; - if(t >= 0 && t < CAPE_DATA_SIZE.length && msg.length == (CAPE_DATA_SIZE[t] + 2)) { + if(t < CAPE_DATA_SIZE.length && msg.length == (CAPE_DATA_SIZE[t] + 2)) { capeCollection.put(user, msg); } } @@ -80,7 +81,7 @@ public class PluginEaglerSkins extends Plugin implements Listener { }else if("EAG|SkinLayers".equals(event.getTag())) { long millis = System.currentTimeMillis(); Long lsu = lastSkinLayerUpdate.get(user); - if(lsu != null && millis - lsu.longValue() < 700l) { // DoS protection + if(lsu != null && millis - lsu < 700L) { // DoS protection return; } lastSkinLayerUpdate.put(user, millis); @@ -97,10 +98,12 @@ public class PluginEaglerSkins extends Plugin implements Listener { dd.writeUTF(user); byte[] bpacket = bao.toByteArray(); for(ProxiedPlayer pl : getProxy().getPlayers()) { - if(!pl.equals(user)) { + if(!pl.getName().equals(user)) { pl.sendData("EAG|SkinLayers", bpacket); } } + }else { + event.setCancelled(false); } }catch(Throwable t) { // hacker diff --git a/eaglercraftbungee/src/main/java/net/md_5/bungee/eaglercraft/PluginEaglerVoice.java b/eaglercraftbungee/src/main/java/net/md_5/bungee/eaglercraft/PluginEaglerVoice.java index 48c6c25..efe8178 100644 --- a/eaglercraftbungee/src/main/java/net/md_5/bungee/eaglercraft/PluginEaglerVoice.java +++ b/eaglercraftbungee/src/main/java/net/md_5/bungee/eaglercraft/PluginEaglerVoice.java @@ -66,6 +66,7 @@ public class PluginEaglerVoice extends Plugin implements Listener { byte[] msg = event.getData(); try { if (!("EAG|Voice".equals(event.getTag()))) return; + event.setCancelled(true); DataInputStream streamIn = new DataInputStream(new ByteArrayInputStream(msg)); int sig = streamIn.read(); switch (sig) {