Dieser Commit ist enthalten in:
Ursprung
ed89d2b37b
Commit
f1a99b0938
@ -23,6 +23,7 @@ import com.comphenix.tinyprotocol.Reflection;
|
|||||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||||
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 {
|
||||||
@Override
|
@Override
|
||||||
@ -35,4 +36,10 @@ public class ChatWrapper19 implements ChatWrapper {
|
|||||||
public String getNameByLoginPacket(Object packet) {
|
public String getNameByLoginPacket(Object packet) {
|
||||||
return getName.get(packet);
|
return getName.get(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object modifyServerDataPacket(Object o) {
|
||||||
|
ClientboundServerDataPacket clientboundServerDataPacket = (ClientboundServerDataPacket) o;
|
||||||
|
return new ClientboundServerDataPacket(clientboundServerDataPacket.b().get(),clientboundServerDataPacket.c().get(),true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ package de.steamwar.core;
|
|||||||
import com.comphenix.tinyprotocol.Reflection;
|
import com.comphenix.tinyprotocol.Reflection;
|
||||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class ChatWrapper8 implements ChatWrapper {
|
public class ChatWrapper8 implements ChatWrapper {
|
||||||
|
|
||||||
@ -36,4 +37,9 @@ public class ChatWrapper8 implements ChatWrapper {
|
|||||||
public String getNameByLoginPacket(Object packet) {
|
public String getNameByLoginPacket(Object packet) {
|
||||||
return getGameProfile.get(packet).getName();
|
return getGameProfile.get(packet).getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object modifyServerDataPacket(Object o) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,4 +24,6 @@ public interface ChatWrapper {
|
|||||||
|
|
||||||
Object stringToChatComponent(String text);
|
Object stringToChatComponent(String text);
|
||||||
String getNameByLoginPacket(Object packet);
|
String getNameByLoginPacket(Object packet);
|
||||||
|
|
||||||
|
Object modifyServerDataPacket(Object o);
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,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.Statement;
|
import de.steamwar.sql.Statement;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -132,6 +133,9 @@ public class Core extends JavaPlugin{
|
|||||||
if(Core.getVersion() < 17 && Bukkit.getPluginManager().getPlugin("ViaVersion") != null)
|
if(Core.getVersion() < 17 && Bukkit.getPluginManager().getPlugin("ViaVersion") != null)
|
||||||
new PartialChunkFixer();
|
new PartialChunkFixer();
|
||||||
|
|
||||||
|
if(Core.getVersion() < 18)
|
||||||
|
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());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
package de.steamwar.network.handlers;
|
||||||
|
|
||||||
|
import com.comphenix.tinyprotocol.Reflection;
|
||||||
|
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||||
|
import de.steamwar.core.ChatWrapper;
|
||||||
|
import de.steamwar.core.CraftbukkitWrapper;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class ServerDataHandler {
|
||||||
|
|
||||||
|
private Class<?> explosionPacket = Reflection.getClass("{nms.network.protocol.game}.ClientboundServerDataPacket");
|
||||||
|
|
||||||
|
public ServerDataHandler() {
|
||||||
|
TinyProtocol.instance.addFilter(explosionPacket, this::packetFilter);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Object packetFilter(Player player, Object o) {
|
||||||
|
return ChatWrapper.impl.modifyServerDataPacket(o);
|
||||||
|
}
|
||||||
|
}
|
In neuem Issue referenzieren
Einen Benutzer sperren