From 03354992f24ebc91e78279cec0f260fe2d188b97 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 9 Apr 2022 16:33:57 +0200 Subject: [PATCH 1/3] Allow replay skip only the starter of the replay Signed-off-by: Lixfel --- .../src/de/steamwar/fightsystem/commands/SkipCommand.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/commands/SkipCommand.java b/FightSystem_Core/src/de/steamwar/fightsystem/commands/SkipCommand.java index 5bd30a4..ba99371 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/commands/SkipCommand.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/commands/SkipCommand.java @@ -21,6 +21,7 @@ package de.steamwar.fightsystem.commands; import de.steamwar.fightsystem.ArenaMode; import de.steamwar.fightsystem.Config; +import de.steamwar.fightsystem.fight.Fight; import de.steamwar.fightsystem.record.PacketProcessor; import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.StateDependentCommand; @@ -42,7 +43,7 @@ public class SkipCommand implements CommandExecutor { } Player player = (Player) sender; - if(PacketProcessor.isReplaying()) { + if(PacketProcessor.isReplaying() && Fight.getBlueTeam().getDesignatedLeader() == player.getUniqueId()) { PacketProcessor.currentReplay().skipToSubtitle(); } else { Commands.toggleSkip(player); From affb2630abe94bc21413ac7293eab525ea3e9191 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 9 Apr 2022 16:38:16 +0200 Subject: [PATCH 2/3] Potential fix for empty subtitles in 1.18 on <=1.15 servers Signed-off-by: Lixfel --- FightSystem_Core/src/de/steamwar/fightsystem/utils/FightUI.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/utils/FightUI.java b/FightSystem_Core/src/de/steamwar/fightsystem/utils/FightUI.java index ee3532f..da6df9c 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/utils/FightUI.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/utils/FightUI.java @@ -232,7 +232,7 @@ public class FightUI { } Message message = queue.poll(); - Bukkit.getOnlinePlayers().forEach(p -> WorldOfColorWrapper.impl.sendTitle(p, "", FightSystem.getMessage().parse(message.getMsg(), p, message.getParams()), 5, 40, 5)); + Bukkit.getOnlinePlayers().forEach(p -> WorldOfColorWrapper.impl.sendTitle(p, " ", FightSystem.getMessage().parse(message.getMsg(), p, message.getParams()), 5, 40, 5)); Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), FightUI::printSubtitle, 50); subtitleScheduled = true; } From 21b271c01a9a0f8dbe0d389ac049592fed0eb876 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 9 Apr 2022 20:32:46 +0200 Subject: [PATCH 3/3] Fix 1.18 Techhider Signed-off-by: Lixfel --- .../fightsystem/utils/TechHider18.java | 38 ++++--------------- 1 file changed, 7 insertions(+), 31 deletions(-) diff --git a/FightSystem_18/src/de/steamwar/fightsystem/utils/TechHider18.java b/FightSystem_18/src/de/steamwar/fightsystem/utils/TechHider18.java index d17fb72..b22f4a2 100644 --- a/FightSystem_18/src/de/steamwar/fightsystem/utils/TechHider18.java +++ b/FightSystem_18/src/de/steamwar/fightsystem/utils/TechHider18.java @@ -26,12 +26,12 @@ import io.netty.buffer.UnpooledByteBufAllocator; import net.minecraft.core.IRegistry; import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData; import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket; +import net.minecraft.util.SimpleBitStorage; import net.minecraft.world.level.block.entity.TileEntityTypes; import org.bukkit.World; import org.bukkit.entity.Player; import java.nio.ByteBuffer; -import java.nio.LongBuffer; import java.util.List; import java.util.Set; import java.util.function.IntFunction; @@ -93,15 +93,17 @@ public class TechHider18 implements TechHider.ChunkHider { buffer.writeBytes(data, curI, dataArrayLength * 8); } else { ByteBuffer source = ByteBuffer.wrap(data, curI, dataArrayLength * 8); - VariableValueArray values = new VariableValueArray(bitsPerBlock, dataArrayLength, source.asLongBuffer()); + long[] array = new long[dataArrayLength]; + source.asLongBuffer().get(array); + SimpleBitStorage values = new SimpleBitStorage(bitsPerBlock, 4096, array); for (int pos = 0; pos < 4096; pos++) { - if (hiddenBlockIds.contains(values.get(pos))) { - values.set(pos, obfuscateWith); + if (hiddenBlockIds.contains(values.a(pos))) { + values.b(pos, obfuscateWith); } } - for (long l : values.backing) + for (long l : values.a()) buffer.writeLong(l); } }); @@ -145,30 +147,4 @@ public class TechHider18 implements TechHider.ChunkHider { return i; } - - private static final class VariableValueArray { - private final long[] backing; - private final int bitsPerValue; - private final long valueMask; - private final int valuesPerLong; - - public VariableValueArray(int bitsPerEntry, int dataArrayLength, LongBuffer buffer) { - this.bitsPerValue = bitsPerEntry; - this.backing = new long[dataArrayLength]; - buffer.get(backing); - this.valueMask = (1L << this.bitsPerValue) - 1; - this.valuesPerLong = 64 / bitsPerEntry; - } - - public int get(int index) { - return (int)((backing[index / valuesPerLong] >> ((index % valuesPerLong) * bitsPerValue)) & valueMask); - } - - public void set(int index, int value) { - int i0 = index / valuesPerLong; - int i1 = index % valuesPerLong; - - backing[i0] = backing[i0] & ~(this.valueMask << i1) | (value & valueMask) << i1; - } - } }