13
0
Dieser Commit ist enthalten in:
zOnlyKroks 2022-02-13 13:30:05 +01:00
Ursprung 7bd7bd52c2
Commit f5150aa27c
3 geänderte Dateien mit 57 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -60,10 +60,12 @@ public class LobbySystem extends JavaPlugin {
new ParticleListener(); new ParticleListener();
new PlayerInventoryListener(); new PlayerInventoryListener();
new PlayerWorldInteractionListener(); new PlayerWorldInteractionListener();
new PlayerMoveListener();
World world = Bukkit.getWorlds().get(0); World world = Bukkit.getWorlds().get(0);
world.setGameRule(GameRule.ANNOUNCE_ADVANCEMENTS, false); world.setGameRule(GameRule.ANNOUNCE_ADVANCEMENTS, false);
Bukkit.getOfflinePlayer("zOnlyKroks").setWhitelisted(true); Bukkit.getOfflinePlayer("zOnlyKroks").setWhitelisted(true);
Bukkit.getOfflinePlayer("LordMainex").setWhitelisted(true);
} }
public static LobbySystem getPlugin() { public static LobbySystem getPlugin() {

Datei anzeigen

@ -24,10 +24,13 @@ public class ElytraListener extends BasicListener {
Player player = event.getPlayer(); Player player = event.getPlayer();
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player); LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player);
if (event.getMaterial() != LobbyInventory.ELYTRA_READY) return;
if(!lobbyPlayer.isFlyingElytra()) { if(!lobbyPlayer.isFlyingElytra()) {
player.getInventory().setChestplate(new ItemStack(Material.ELYTRA)); player.getInventory().setChestplate(new ItemStack(Material.ELYTRA));
player.setGliding(true); player.setGliding(true);
player.teleport(new Location(Bukkit.getWorlds().get(0),player.getLocation().getX(),player.getLocation().getY() + 4, player.getLocation().getZ(), player.getLocation().getYaw(), player.getLocation().getPitch())); player.teleport(new Location(Bukkit.getWorlds().get(0),player.getLocation().getX(),player.getLocation().getY() + 4, player.getLocation().getZ(), player.getLocation().getYaw(), player.getLocation().getPitch()));
player.setGliding(true);
lobbyPlayer.setFlyingElytra(true); lobbyPlayer.setFlyingElytra(true);
LobbyInventory.givePlayerLobbyItems(player); LobbyInventory.givePlayerLobbyItems(player);
} }

Datei anzeigen

@ -0,0 +1,52 @@
package de.steamwar.lobby.listener.features;
import de.steamwar.lobby.Config;
import de.steamwar.lobby.listener.BasicListener;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerMoveEvent;
public class PlayerMoveListener extends BasicListener {
final BorderData data = new BorderData();
@EventHandler
public void onMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
Location playerLoc = player.getLocation();
if(!data.locationIsInRegion(playerLoc)) {
player.teleport(new Location(Bukkit.getWorlds().get(0), Config.SpawnX, Config.SpawnY, Config.SpawnZ, Config.Yaw, Config.Pitch));
}
}
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;
}
}
}