From 40dcee6eee19bc7149a8efc2c898a38134b658ec Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 16 Oct 2023 17:45:18 +0200 Subject: [PATCH] Fix Warp and Compass a bit --- .../src/de/steamwar/bausystem/features/warp/Warp.java | 5 +++-- .../src/de/steamwar/bausystem/features/warp/WarpCommand.java | 1 + .../de/steamwar/bausystem/features/warp/WarpListener.java | 3 +-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/warp/Warp.java b/BauSystem_Main/src/de/steamwar/bausystem/features/warp/Warp.java index 6cbc6c10..4ccddf76 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/warp/Warp.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/warp/Warp.java @@ -20,6 +20,7 @@ package de.steamwar.bausystem.features.warp; import de.steamwar.bausystem.worlddata.WorldData; +import de.steamwar.core.Core; import lombok.Getter; import org.bukkit.*; import org.bukkit.entity.Player; @@ -33,9 +34,9 @@ public class Warp { private static Map warpMap = new HashMap<>(); - static { + public static void enable() { Warp worldSpawn = new Warp("WorldSpawn"); - worldSpawn.setLocation(Bukkit.getWorlds().get(0).getSpawnLocation()); + worldSpawn.setLocation(Bukkit.getWorlds().get(0).getSpawnLocation().clone().add(0.5, Core.getVersion() == 20 ? 124 : 1, 0.5)); worldSpawn.setMat(Material.NETHER_STAR); warpMap.put("WorldSpawn", worldSpawn); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpCommand.java index cf44f51f..8fa832a7 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpCommand.java @@ -147,6 +147,7 @@ public class WarpCommand extends SWCommand implements Disable, Enable { WorldData.getWarpData().forEach((name, yapionAnyType) -> { new Warp(name, (YAPIONObject) yapionAnyType); }); + Warp.enable(); } @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpListener.java index 953d709a..d92e7e58 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpListener.java @@ -79,7 +79,6 @@ public class WarpListener implements Listener { warpEntityServer.put(p, entityServer); Vector current = p.getLocation().clone().add(p.getLocation().getDirection().multiply(5)).toVector(); - current.setY(p.getLocation().getY() - 1); Map locations = new HashMap<>(); if (sneaking) { @@ -110,7 +109,7 @@ public class WarpListener implements Listener { Vector position = p.getLocation().toVector().clone().add(vector.normalize().multiply(5)); position.setY(p.getLocation().getY() - 1); - if (position.distanceSquared(current) < 0.2) { + if (position.distanceSquared(current) < 0.1) { name = "§a§l" + name; selected.computeIfAbsent(p, player -> new ArrayList<>()).add(location); }