forked from SteamWar/SteamWar
Merge branch 'main' into FightSystem/fix-tech-and-hull-hider
# Conflicts: # FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/HullHider.java # SpigotCore/SpigotCore_Main/src/de/steamwar/core/events/AntiNocom.java
This commit is contained in:
@@ -2,6 +2,7 @@ package com.comphenix.tinyprotocol;
|
||||
|
||||
import com.google.common.collect.MapMaker;
|
||||
import de.steamwar.Reflection;
|
||||
import de.steamwar.core.CRIUWakeupEvent;
|
||||
import de.steamwar.core.Core;
|
||||
import io.netty.channel.*;
|
||||
import net.minecraft.network.Connection;
|
||||
@@ -164,6 +165,10 @@ public class TinyProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onCRIUWakeup(CRIUWakeupEvent event) {
|
||||
registerChannelHandler();
|
||||
}
|
||||
};
|
||||
|
||||
plugin.getServer().getPluginManager().registerEvents(listener, plugin);
|
||||
@@ -222,15 +227,10 @@ public class TinyProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
public <T> void addTypedFilter(Class<T> packetType, BiFunction<Player, ? super T, Object> filter) {
|
||||
public <T> void addFilter(Class<T> packetType, BiFunction<Player, ? super T, Object> filter) {
|
||||
packetFilters.computeIfAbsent(packetType, c -> new CopyOnWriteArrayList<>()).add((BiFunction) filter);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void addFilter(Class<?> packetType, BiFunction<Player, Object, Object> filter) {
|
||||
packetFilters.computeIfAbsent(packetType, c -> new CopyOnWriteArrayList<>()).add(filter);
|
||||
}
|
||||
|
||||
public void removeFilter(Class<?> packetType, BiFunction<Player, ?, Object> filter) {
|
||||
packetFilters.getOrDefault(packetType, Collections.emptyList()).remove(filter);
|
||||
}
|
||||
@@ -342,6 +342,8 @@ public class TinyProtocol {
|
||||
|
||||
// Lookup channel again
|
||||
if (channel == null) {
|
||||
System.out.println(((CraftPlayer) player).getHandle());
|
||||
System.out.println(((CraftPlayer) player).getHandle().connection);
|
||||
Channel playerChannel = ((CraftPlayer) player).getHandle().connection.connection.channel;
|
||||
channelLookup.put(player.getName(), channel = playerChannel);
|
||||
}
|
||||
|
||||
@@ -79,11 +79,14 @@ class CheckpointUtilsJ9 {
|
||||
return;
|
||||
}
|
||||
|
||||
e.printStackTrace();
|
||||
|
||||
Bukkit.shutdown();
|
||||
|
||||
if (!message.contains("Can't dump ghost file") && !message.contains("Can't create link remap")) // File/Jar has been updated
|
||||
throw new SecurityException(e);
|
||||
} finally {
|
||||
if (true) return;
|
||||
// Delete checkpoint
|
||||
try (Stream<Path> stream = Files.walk(path)) {
|
||||
stream.sorted(Comparator.reverseOrder()).map(Path::toFile).forEach(File::delete);
|
||||
|
||||
@@ -43,9 +43,8 @@ public class WorldIdentifier {
|
||||
}
|
||||
|
||||
public WorldIdentifier() {
|
||||
TinyProtocol.instance.addFilter(ClientboundLoginPacket.class, (player, o) -> {
|
||||
if (resourceKey == null) return o;
|
||||
ClientboundLoginPacket packet = (ClientboundLoginPacket) o;
|
||||
TinyProtocol.instance.addFilter(ClientboundLoginPacket.class, (player, packet) -> {
|
||||
if (resourceKey == null) return packet;
|
||||
|
||||
return new ClientboundLoginPacket(packet.playerId(),
|
||||
packet.hardcore(),
|
||||
|
||||
@@ -46,7 +46,7 @@ public class AntiNocom implements Listener {
|
||||
private final Map<Player, Integer> flags = new ConcurrentHashMap<>();
|
||||
|
||||
public AntiNocom() {
|
||||
TinyProtocol.instance.addTypedFilter(ServerboundPlayerActionPacket.class, this::onDig);
|
||||
TinyProtocol.instance.addFilter(ServerboundPlayerActionPacket.class, this::onDig);
|
||||
registerUseItem();
|
||||
}
|
||||
|
||||
|
||||
@@ -343,9 +343,9 @@ public class REntity {
|
||||
}
|
||||
|
||||
private Object getMoveLookPacket(double diffX, double diffY, double diffZ, boolean rotEq) {
|
||||
short x = (short) (this.x * 4096);
|
||||
short y = (short) (this.y * 4096);
|
||||
short z = (short) (this.z * 4096);
|
||||
short x = (short) (diffX * 4096);
|
||||
short y = (short) (diffY * 4096);
|
||||
short z = (short) (diffZ * 4096);
|
||||
byte yaw = (byte) (this.yaw * 256 / 360);
|
||||
byte pitch = (byte) (this.pitch * 256 / 360);
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ public class REntityServer implements Listener {
|
||||
this.callback = callback;
|
||||
|
||||
if (uninitialized) {
|
||||
TinyProtocol.instance.addTypedFilter(ServerboundInteractPacket.class, filter);
|
||||
TinyProtocol.instance.addFilter(ServerboundInteractPacket.class, filter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user