SteamWar/BauSystem2.0
Archiviert
12
0

Fix NoClipCommand for real now
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2022-07-31 21:21:20 +02:00
Ursprung 92b7a6ddbc
Commit 04249488d9
4 geänderte Dateien mit 10 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -69,6 +69,8 @@ public class NMSWrapper15 implements NMSWrapper.INMSWrapper {
index = index - 8 + 36; index = index - 8 + 36;
} }
player.getInventory().setItem(index, CraftItemStack.asBukkitCopy(packetPlayInSetCreativeSlot.getItemStack())); player.getInventory().setItem(index, CraftItemStack.asBukkitCopy(packetPlayInSetCreativeSlot.getItemStack()));
if (index < 9) player.getInventory().setHeldItemSlot(index);
player.updateInventory();
} }
@Override @Override

Datei anzeigen

@ -74,6 +74,8 @@ public class NMSWrapper18 implements NMSWrapper.INMSWrapper {
index = index - 8 + 36; index = index - 8 + 36;
} }
player.getInventory().setItem(index, CraftItemStack.asBukkitCopy(packetPlayInSetCreativeSlot.c())); player.getInventory().setItem(index, CraftItemStack.asBukkitCopy(packetPlayInSetCreativeSlot.c()));
if (index < 9) player.getInventory().setHeldItemSlot(index);
player.updateInventory();
} }
@Override @Override

Datei anzeigen

@ -74,6 +74,8 @@ public class NMSWrapper19 implements NMSWrapper.INMSWrapper {
index = index - 8 + 36; index = index - 8 + 36;
} }
player.getInventory().setItem(index, CraftItemStack.asBukkitCopy(packetPlayInSetCreativeSlot.c())); player.getInventory().setItem(index, CraftItemStack.asBukkitCopy(packetPlayInSetCreativeSlot.c()));
if (index < 9) player.getInventory().setHeldItemSlot(index);
player.updateInventory();
} }
@Override @Override

Datei anzeigen

@ -32,6 +32,7 @@ import de.steamwar.bausystem.utils.ProtocolWrapper;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import lombok.Getter; import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -154,8 +155,10 @@ public class NoClipCommand extends SWCommand implements Listener {
return; return;
} }
if (NOCLIPS.contains(event.getPlayer())) { if (NOCLIPS.contains(event.getPlayer())) {
event.getPlayer().setSpectatorTarget(null);
event.setCancelled(true); event.setCancelled(true);
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
event.getPlayer().setSpectatorTarget(null);
}, 1L);
} }
} }