Dieser Commit ist enthalten in:
Ursprung
74e57fa3a1
Commit
05183a4173
@ -55,7 +55,7 @@ public class LobbySystem extends JavaPlugin {
|
|||||||
new ParticleListener();
|
new ParticleListener();
|
||||||
new InventoryInteraction();
|
new InventoryInteraction();
|
||||||
new WorldInteraction();
|
new WorldInteraction();
|
||||||
new WorldBorder();
|
new AlphaWall(l -> l.getZ() > 1250, AlphaWall.REFLECT_Z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,50 +19,36 @@
|
|||||||
|
|
||||||
package de.steamwar.lobby.listener;
|
package de.steamwar.lobby.listener;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import de.steamwar.lobby.command.ModifyCommand;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
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
|
@EventHandler
|
||||||
public void onMove(PlayerMoveEvent event) {
|
public void onMove(PlayerMoveEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
if(ModifyCommand.modifying(player) || allowed.apply(event.getTo()))
|
||||||
|
return;
|
||||||
|
|
||||||
if(!data.locationIsInRegion(event.getTo())) {
|
Location to = event.getFrom().clone();
|
||||||
//player.teleport(event.getFrom());
|
to.setYaw(reflect - to.getYaw());
|
||||||
}
|
player.teleport(to, PlayerTeleportEvent.TeleportCause.PLUGIN);
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -76,7 +76,13 @@ public class FightserverPortal implements PortalHandler, Comparable<FightserverP
|
|||||||
this.target = target;
|
this.target = target;
|
||||||
this.bluePlayers = bluePlayers;
|
this.bluePlayers = bluePlayers;
|
||||||
this.redPlayers = redPlayers;
|
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);
|
setServer(null);
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren