SteamWar/BauSystem2.0
Archiviert
12
0

Merge branch 'master' into KillcheckerImprovements
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
YoyoNow 2023-03-15 21:10:11 +01:00
Commit 7ea2ef694e
6 geänderte Dateien mit 15 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -28,6 +28,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.*; import net.minecraft.network.protocol.game.*;
import net.minecraft.network.syncher.DataWatcher;
import net.minecraft.server.level.PlayerInteractManager; import net.minecraft.server.level.PlayerInteractManager;
import net.minecraft.world.level.EnumGamemode; import net.minecraft.world.level.EnumGamemode;
import net.minecraft.world.phys.Vec3D; import net.minecraft.world.phys.Vec3D;
@ -44,7 +45,6 @@ import org.bukkit.inventory.ItemStack;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.function.LongSupplier; import java.util.function.LongSupplier;
public class NMSWrapper19 implements NMSWrapper { public class NMSWrapper19 implements NMSWrapper {
@ -91,7 +91,9 @@ public class NMSWrapper19 implements NMSWrapper {
if (entity instanceof TNTPrimed) { if (entity instanceof TNTPrimed) {
net.minecraft.world.entity.Entity serverEntity = ((CraftEntity) entity).getHandle(); net.minecraft.world.entity.Entity serverEntity = ((CraftEntity) entity).getHandle();
packets.add(new PacketPlayOutEntityMetadata(serverEntity.ah(), Objects.requireNonNull(serverEntity.al().c()))); List<DataWatcher.b<?>> list = serverEntity.al().c();
if(list != null)
packets.add(new PacketPlayOutEntityMetadata(serverEntity.ah(), list));
} }
}); });
} }

Datei anzeigen

@ -35,6 +35,7 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockExplodeEvent; import org.bukkit.event.block.BlockExplodeEvent;
import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityExplodeEvent;
@ -83,7 +84,7 @@ public class TNTListener implements Listener {
explode(event.blockList(), event.getBlock().getLocation(), null, null); explode(event.blockList(), event.getBlock().getLocation(), null, null);
} }
@EventHandler @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onExplode(EntityExplodeEvent event) { public void onExplode(EntityExplodeEvent event) {
explode(event.blockList(), event.getLocation(), EventType.TNTExplodeInBuild, event); explode(event.blockList(), event.getLocation(), EventType.TNTExplodeInBuild, event);
} }

Datei anzeigen

@ -47,7 +47,7 @@ public class ScriptListener implements Listener {
new ScriptExecutor((BookMeta) item.getItemMeta(), event.getPlayer(), null); new ScriptExecutor((BookMeta) item.getItemMeta(), event.getPlayer(), null);
} }
@EventHandler @EventHandler(priority = EventPriority.LOWEST)
public void onPlayerJoin(PlayerJoinEvent event) { public void onPlayerJoin(PlayerJoinEvent event) {
GLOBAL_CONTEXT.put(event.getPlayer(), new Context()); GLOBAL_CONTEXT.put(event.getPlayer(), new Context());
} }

Datei anzeigen

@ -46,7 +46,7 @@ public class If implements SpecialCommand {
BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_NO_BOOLEAN", scriptExecutor.getPlayer()); BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_NO_BOOLEAN", scriptExecutor.getPlayer());
return false; return false;
} }
if (v.asBoolean()) { if (v.asBoolean() && command.length > 2) {
jumpToIndex(scriptExecutor, command[2]); jumpToIndex(scriptExecutor, command[2]);
} else if (command.length > 3) { } else if (command.length > 3) {
jumpToIndex(scriptExecutor, command[3]); jumpToIndex(scriptExecutor, command[3]);

Datei anzeigen

@ -30,6 +30,7 @@ import org.bukkit.Bukkit;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockBreakEvent;
@ -58,7 +59,7 @@ public class EventListener implements Listener {
}, 2, 2); }, 2, 2);
} }
@EventHandler @EventHandler(priority = EventPriority.MONITOR)
public void onPlayerJoin(PlayerJoinEvent event) { public void onPlayerJoin(PlayerJoinEvent event) {
manager.callEvent(EventType.SelfJoin, event.getPlayer(), event); manager.callEvent(EventType.SelfJoin, event.getPlayer(), event);
} }

Datei anzeigen

@ -32,6 +32,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed; import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntitySpawnEvent; import org.bukkit.event.entity.EntitySpawnEvent;
@ -180,7 +181,7 @@ public class Recorder implements Listener {
}); });
} }
@EventHandler @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onEntityExplode(EntityExplodeEvent event) { public void onEntityExplode(EntityExplodeEvent event) {
Entity entity = event.getEntity(); Entity entity = event.getEntity();
if (!(entity instanceof TNTPrimed)) { if (!(entity instanceof TNTPrimed)) {
@ -188,7 +189,9 @@ public class Recorder implements Listener {
} }
TraceRecorder traceRecorder = get((TNTPrimed) entity); TraceRecorder traceRecorder = get((TNTPrimed) entity);
Region region = tntTraceRecorderMap.get((TNTPrimed) entity); Region region = tntTraceRecorderMap.get((TNTPrimed) entity);
traceRecorder.explode((TNTPrimed) entity, !event.blockList().isEmpty() && region.inRegion(event.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION)); boolean inBuildRegion = event.blockList().stream().anyMatch(block -> region.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION));
System.out.println(event.blockList() + " " + inBuildRegion);
traceRecorder.explode((TNTPrimed) entity, inBuildRegion);
tntTraceRecorderMap.remove(entity); tntTraceRecorderMap.remove(entity);
tick(); tick();
} }