13
0

Add debugging, Reflecting AlphaWalls
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
Lixfel 2022-03-11 16:24:00 +01:00
Ursprung 74e57fa3a1
Commit 05183a4173
3 geänderte Dateien mit 28 neuen und 36 gelöschten Zeilen

Datei anzeigen

@ -55,7 +55,7 @@ public class LobbySystem extends JavaPlugin {
new ParticleListener();
new InventoryInteraction();
new WorldInteraction();
new WorldBorder();
new AlphaWall(l -> l.getZ() > 1250, AlphaWall.REFLECT_Z);
}

Datei anzeigen

@ -19,50 +19,36 @@
package de.steamwar.lobby.listener;
import org.bukkit.Bukkit;
import de.steamwar.lobby.command.ModifyCommand;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
public class WorldBorder extends BasicListener {
import java.util.function.Function;
final BorderData data = new BorderData();
public class AlphaWall extends BasicListener {
public static float REFLECT_X = 360f;
public static float REFLECT_Z = 180f;
private final Function<Location, Boolean> allowed;
private final float reflect;
public AlphaWall(Function<Location, Boolean> allowed, float reflect) {
this.allowed = allowed;
this.reflect = reflect;
}
@EventHandler
public void onMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
if(ModifyCommand.modifying(player) || allowed.apply(event.getTo()))
return;
if(!data.locationIsInRegion(event.getTo())) {
//player.teleport(event.getFrom());
}
}
public static final class BorderData {
final World world = Bukkit.getWorlds().get(0);
final Location loc1 = new Location(world,1337,0,1803);
final Location loc2 = new Location(world,2610,0,1800);
private double maxX;
private double maxZ;
private double minX;
private double minZ;
public BorderData() {
maxX = Math.max(loc1.getX(), loc2.getX());
maxZ = Math.max(loc1.getZ(), loc2.getZ());
minX = Math.min(loc1.getX(), loc2.getX());
minZ = Math.min(loc1.getZ(), loc2.getZ());
}
public boolean locationIsInRegion(Location loc) {
return loc.getX() > minX && loc.getX() < maxX
&& loc.getZ() > minZ && loc.getZ() < maxZ;
}
Location to = event.getFrom().clone();
to.setYaw(reflect - to.getYaw());
player.teleport(to, PlayerTeleportEvent.TeleportCause.PLUGIN);
}
}

Datei anzeigen

@ -76,7 +76,13 @@ public class FightserverPortal implements PortalHandler, Comparable<FightserverP
this.target = target;
this.bluePlayers = bluePlayers;
this.redPlayers = redPlayers;
hologram = new Hologram(null, portal.getPos1().clone().add(portal.denormalize(new Vector(0.5, 0.5, 0.5))), "a", false);
hologram = new Hologram(null, portal.getPos1().clone().add(portal.denormalize(new Vector(0.5, 0.5, 0.5))), "", false);
if(portal.getId() == "Lixfel") {
System.out.println(portal.getPos1());
System.out.println(portal.getPos2());
System.out.println(portal.getPos1().clone().add(portal.denormalize(new Vector(0.5, 0.5, 0.5))));
}
setServer(null);