forked from SteamWar/SteamWar
Ensure parity with old techhider by suppressing select packets
This commit is contained in:
@@ -28,4 +28,5 @@ public interface AccessPrivilegeProvider {
|
||||
boolean isPlayerPrivilegedToAccessBlock(Player p, int blockX, int blockY, int blockZ, Block block);
|
||||
boolean isPlayerPrivilegedToAccessEntity(Player p, int entityId);
|
||||
boolean isPlayerPrivilegedToAccessBlockEntity(Player p, int blockX, int blockY, int blockZ, BlockEntityType<?> type);
|
||||
boolean isPlayerPrivalegedToPerformAction(Player p);
|
||||
}
|
||||
|
||||
@@ -331,6 +331,9 @@ public abstract class TechHider implements AccessPrivilegeProvider {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
TinyProtocol.instance.addFilter(ServerboundUseItemOnPacket.class, (p, packet) -> isPlayerPrivalegedToPerformAction(p) ? packet : null);
|
||||
TinyProtocol.instance.addFilter(ServerboundInteractPacket.class, (p, packet) -> isPlayerPrivalegedToPerformAction(p) ? packet : null);
|
||||
}
|
||||
|
||||
private Packet<?> processPacket(Player player, Packet<?> packet) {
|
||||
@@ -563,4 +566,5 @@ public abstract class TechHider implements AccessPrivilegeProvider {
|
||||
public abstract boolean isPlayerPrivilegedToAccessBlock(Player p, int blockX, int blockY, int blockZ, Block block);
|
||||
public abstract boolean isPlayerPrivilegedToAccessEntity(Player p, int entityId);
|
||||
public abstract boolean isPlayerPrivilegedToAccessBlockEntity(Player p, int blockX, int blockY, int blockZ, BlockEntityType<?> type);
|
||||
public abstract boolean isPlayerPrivalegedToPerformAction(Player p);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user