Merge pull request 'Fix Insecure PopUp (zOnlyKroks made it)' (#219) from FixInsecurePopup into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #219 Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Commit
e3d9ce513c
@ -19,10 +19,8 @@
|
|||||||
|
|
||||||
package de.steamwar.core;
|
package de.steamwar.core;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
|
||||||
import net.minecraft.network.chat.IChatMutableComponent;
|
import net.minecraft.network.chat.IChatMutableComponent;
|
||||||
import net.minecraft.network.chat.contents.LiteralContents;
|
import net.minecraft.network.chat.contents.LiteralContents;
|
||||||
import net.minecraft.network.protocol.game.ClientboundServerDataPacket;
|
|
||||||
|
|
||||||
public class ChatWrapper19 implements ChatWrapper {
|
public class ChatWrapper19 implements ChatWrapper {
|
||||||
|
|
||||||
@ -30,12 +28,4 @@ public class ChatWrapper19 implements ChatWrapper {
|
|||||||
public Object stringToChatComponent(String text) {
|
public Object stringToChatComponent(String text) {
|
||||||
return IChatMutableComponent.a(new LiteralContents(text));
|
return IChatMutableComponent.a(new LiteralContents(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Reflection.FieldAccessor<Boolean> accessor = Reflection.getField(ClientboundServerDataPacket.class, boolean.class,0);
|
|
||||||
@Override
|
|
||||||
public Object modifyServerDataPacket(Object o) {
|
|
||||||
ClientboundServerDataPacket clientboundServerDataPacket = (ClientboundServerDataPacket) o;
|
|
||||||
accessor.set(clientboundServerDataPacket,true);
|
|
||||||
return clientboundServerDataPacket;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -28,9 +28,4 @@ public class ChatWrapper8 implements ChatWrapper {
|
|||||||
public Object stringToChatComponent(String text) {
|
public Object stringToChatComponent(String text) {
|
||||||
return chatComponentConstructor.invoke(text);
|
return chatComponentConstructor.invoke(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object modifyServerDataPacket(Object o) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,4 @@ public interface ChatWrapper {
|
|||||||
ChatWrapper impl = VersionDependent.getVersionImpl(Core.getInstance());
|
ChatWrapper impl = VersionDependent.getVersionImpl(Core.getInstance());
|
||||||
|
|
||||||
Object stringToChatComponent(String text);
|
Object stringToChatComponent(String text);
|
||||||
|
|
||||||
Object modifyServerDataPacket(Object o);
|
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ import de.steamwar.core.events.PlayerJoinedEvent;
|
|||||||
import de.steamwar.core.events.WorldLoadEvent;
|
import de.steamwar.core.events.WorldLoadEvent;
|
||||||
import de.steamwar.message.Message;
|
import de.steamwar.message.Message;
|
||||||
import de.steamwar.network.NetworkReceiver;
|
import de.steamwar.network.NetworkReceiver;
|
||||||
|
import de.steamwar.network.handlers.ServerDataHandler;
|
||||||
import de.steamwar.sql.SchematicNode;
|
import de.steamwar.sql.SchematicNode;
|
||||||
import de.steamwar.sql.SteamwarUser;
|
import de.steamwar.sql.SteamwarUser;
|
||||||
import de.steamwar.sql.internal.Statement;
|
import de.steamwar.sql.internal.Statement;
|
||||||
@ -122,7 +123,7 @@ public class Core extends JavaPlugin{
|
|||||||
Bukkit.getScheduler().runTaskTimer(Core.getInstance(), SchematicNode::clear, 20L * 30, 20L * 30);
|
Bukkit.getScheduler().runTaskTimer(Core.getInstance(), SchematicNode::clear, 20L * 30, 20L * 30);
|
||||||
|
|
||||||
if(Core.getVersion() >= 19)
|
if(Core.getVersion() >= 19)
|
||||||
//new ServerDataHandler();
|
new ServerDataHandler();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
getLogger().log(Level.INFO, "Running on: " + new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec("hostname").getInputStream())).readLine());
|
getLogger().log(Level.INFO, "Running on: " + new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec("hostname").getInputStream())).readLine());
|
||||||
|
@ -2,19 +2,12 @@ package de.steamwar.network.handlers;
|
|||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import com.comphenix.tinyprotocol.Reflection;
|
||||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||||
import de.steamwar.core.ChatWrapper;
|
|
||||||
import de.steamwar.core.CraftbukkitWrapper;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class ServerDataHandler {
|
public class ServerDataHandler {
|
||||||
|
|
||||||
private Class<?> serverDataPacket = Reflection.getClass("{nms.network.protocol.game}.ClientboundServerDataPacket");
|
private Class<?> serverDataPacket = Reflection.getClass("{nms.network.protocol.game}.ClientboundServerDataPacket");
|
||||||
|
|
||||||
public ServerDataHandler() {
|
public ServerDataHandler() {
|
||||||
TinyProtocol.instance.addFilter(serverDataPacket, this::packetFilter);
|
TinyProtocol.instance.addFilter(serverDataPacket, (p, o) -> null);
|
||||||
}
|
|
||||||
|
|
||||||
private Object packetFilter(Player player, Object o) {
|
|
||||||
return ChatWrapper.impl.modifyServerDataPacket(o);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren