forked from SteamWar/SteamWar
remove container hiding as it has no lacalaity mapping posibility
This commit is contained in:
@@ -107,16 +107,6 @@ public class TechHiderWrapper extends StateDependent implements Listener {
|
|||||||
Region hiddenRegion = getHiddenRegion(p);
|
Region hiddenRegion = getHiddenRegion(p);
|
||||||
return !hiddenRegion.inRegion(blockX, blockY, blockZ) || !blockEntityTypeToObfuscate.contains(type);
|
return !hiddenRegion.inRegion(blockX, blockY, blockZ) || !blockEntityTypeToObfuscate.contains(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isPlayerPrivilegedToAccessContainer(Player p, int containerId) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isPlayerPrivilegedToAccessSound(Player p, ResourceLocation soundId) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
new StateDependentListener(ENABLED, FightState.Schem, this);
|
new StateDependentListener(ENABLED, FightState.Schem, this);
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ public abstract class TechHider {
|
|||||||
ClientboundBlockChangedAckPacket.class, // 7.1.5 Acknowledge Block Change
|
ClientboundBlockChangedAckPacket.class, // 7.1.5 Acknowledge Block Change
|
||||||
ClientboundChunkBatchFinishedPacket.class, // 7.1.12 Chunk Batch Finished (Delimiter)
|
ClientboundChunkBatchFinishedPacket.class, // 7.1.12 Chunk Batch Finished (Delimiter)
|
||||||
ClientboundChunkBatchStartPacket.class, // 7.1.13 Chunk Batch Start (Delimiter)
|
ClientboundChunkBatchStartPacket.class, // 7.1.13 Chunk Batch Start (Delimiter)
|
||||||
// ClientboundChunksBiomesPacket.class, // 7.1.14 Chunk Biomes
|
ClientboundChunksBiomesPacket.class, // 7.1.14 Chunk Biomes
|
||||||
ClientboundContainerClosePacket.class, // 7.1.18 Close Container
|
ClientboundContainerClosePacket.class, // 7.1.18 Close Container
|
||||||
ClientboundSetChunkCacheCenterPacket.class, // 7.1.93 Set Center Chunk
|
ClientboundSetChunkCacheCenterPacket.class, // 7.1.93 Set Center Chunk
|
||||||
ClientboundForgetLevelChunkPacket.class, // 7.1.38 Unload Chunk
|
ClientboundForgetLevelChunkPacket.class, // 7.1.38 Unload Chunk
|
||||||
@@ -188,9 +188,11 @@ public abstract class TechHider {
|
|||||||
ClientboundPlayerInfoRemovePacket.class, // 7.1.68 Player Info Remove
|
ClientboundPlayerInfoRemovePacket.class, // 7.1.68 Player Info Remove
|
||||||
ClientboundPlayerInfoUpdatePacket.class, // 7.1.69 Player Info Update
|
ClientboundPlayerInfoUpdatePacket.class, // 7.1.69 Player Info Update
|
||||||
ClientboundMoveVehiclePacket.class, // 7.1.56 Move Vehicle (vehicle the player is in)
|
ClientboundMoveVehiclePacket.class, // 7.1.56 Move Vehicle (vehicle the player is in)
|
||||||
ClientboundStopSoundPacket.class // 7.1.118 Stop Sound: sound state side channel
|
ClientboundStopSoundPacket.class, // 7.1.118 Stop Sound: sound state side channel
|
||||||
|
|
||||||
|
|
||||||
|
ClientboundContainerSetContentPacket.class, // 7.1.19 Set Container Content
|
||||||
|
ClientboundContainerSetDataPacket.class, // 7.1.20 Set Container Property
|
||||||
|
ClientboundContainerSetSlotPacket.class // 7.1.21 Set Container Slot
|
||||||
));
|
));
|
||||||
|
|
||||||
BiFunction<Player, Packet<? extends PacketListener>, Packet<? extends PacketListener>> tossPacket = (p, packet) -> null;
|
BiFunction<Player, Packet<? extends PacketListener>, Packet<? extends PacketListener>> tossPacket = (p, packet) -> null;
|
||||||
@@ -276,14 +278,6 @@ public abstract class TechHider {
|
|||||||
// 7.1.48 Update Light: lighting can reveal hidden blocks/operations.
|
// 7.1.48 Update Light: lighting can reveal hidden blocks/operations.
|
||||||
processors.put(ClientboundLightUpdatePacket.class, tossPacket);
|
processors.put(ClientboundLightUpdatePacket.class, tossPacket);
|
||||||
|
|
||||||
// --- Container packets ---
|
|
||||||
// 7.1.19 Set Container Content
|
|
||||||
processors.put(ClientboundContainerSetContentPacket.class, buildContainerPacketProcessor(ClientboundContainerSetContentPacket::containerId));
|
|
||||||
// 7.1.20 Set Container Property
|
|
||||||
processors.put(ClientboundContainerSetDataPacket.class, buildContainerPacketProcessor(ClientboundContainerSetDataPacket::getContainerId));
|
|
||||||
// 7.1.21 Set Container Slot
|
|
||||||
processors.put(ClientboundContainerSetSlotPacket.class, buildContainerPacketProcessor(ClientboundContainerSetSlotPacket::getContainerId));
|
|
||||||
|
|
||||||
// --- Sound packets ---
|
// --- Sound packets ---
|
||||||
// 7.1.115 Entity Sound Effect: entity id and sound.
|
// 7.1.115 Entity Sound Effect: entity id and sound.
|
||||||
processors.put(ClientboundSoundEntityPacket.class, this.buildEntityPacketProcessor(ClientboundSoundEntityPacket::getId));
|
processors.put(ClientboundSoundEntityPacket.class, this.buildEntityPacketProcessor(ClientboundSoundEntityPacket::getId));
|
||||||
@@ -545,21 +539,6 @@ public abstract class TechHider {
|
|||||||
return chunkHider.processLevelChunkWithLightPacket(p, packet);
|
return chunkHider.processLevelChunkWithLightPacket(p, packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Packet<? extends PacketListener> processContainerPacket(Player player, int containerId, Packet<? extends PacketListener> packet) {
|
|
||||||
if(isPlayerPrivilegedToAccessContainer(player, containerId)) {
|
|
||||||
return packet;
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private <TTargetPacket extends Packet<?>> BiFunction<Player, Packet<?>, Packet<?>> buildContainerPacketProcessor(ToIntFunction<TTargetPacket> containerIdExtractor) {
|
|
||||||
return (p, rawPacket) -> {
|
|
||||||
TTargetPacket packet = (TTargetPacket) rawPacket;
|
|
||||||
|
|
||||||
return processContainerPacket(p, containerIdExtractor.applyAsInt(packet), packet);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private Packet<? extends PacketListener> proccessPositionBasedPacket(Player player, int blockX, int blockY, int blockZ, Packet<? extends PacketListener> packet) {
|
private Packet<? extends PacketListener> proccessPositionBasedPacket(Player player, int blockX, int blockY, int blockZ, Packet<? extends PacketListener> packet) {
|
||||||
if(isPlayerPrivilegedToAccessPosition(player, blockX, blockY, blockZ)) {
|
if(isPlayerPrivilegedToAccessPosition(player, blockX, blockY, blockZ)) {
|
||||||
return packet;
|
return packet;
|
||||||
@@ -583,6 +562,4 @@ public abstract class TechHider {
|
|||||||
public abstract boolean isPlayerPrivilegedToAccessBlock(Player p, int blockX, int blockY, int blockZ, Block block);
|
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 isPlayerPrivilegedToAccessEntity(Player p, int entityId);
|
||||||
public abstract boolean isPlayerPrivilegedToAccessBlocEntity(Player p, int blockX, int blockY, int blockZ, BlockEntityType<?> type);
|
public abstract boolean isPlayerPrivilegedToAccessBlocEntity(Player p, int blockX, int blockY, int blockZ, BlockEntityType<?> type);
|
||||||
public abstract boolean isPlayerPrivilegedToAccessContainer(Player p, int containerId);
|
|
||||||
public abstract boolean isPlayerPrivilegedToAccessSound(Player p, ResourceLocation soundId);
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user