forked from SteamWar/SteamWar
Fix Warp WorldSpawn
This commit is contained in:
@@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.warp;
|
||||
import de.steamwar.bausystem.region.RegionSystem;
|
||||
import de.steamwar.bausystem.worlddata.WorldData;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
@@ -35,14 +36,20 @@ public class Warp {
|
||||
private static Map<String, Warp> warpMap = new HashMap<>();
|
||||
|
||||
public static void enable() {
|
||||
Warp worldSpawn = new Warp("WorldSpawn");
|
||||
worldSpawn.setLocation(RegionSystem.INSTANCE.getWorldSpawn());
|
||||
Warp worldSpawn = new Warp("WorldSpawn") {
|
||||
@Override
|
||||
public Location getLocation() {
|
||||
return RegionSystem.INSTANCE.getWorldSpawn();
|
||||
}
|
||||
};
|
||||
worldSpawn.setMat(Material.NETHER_STAR);
|
||||
warpMap.put("WorldSpawn", worldSpawn);
|
||||
}
|
||||
|
||||
private String name;
|
||||
@Setter
|
||||
private Location location;
|
||||
@Setter
|
||||
private Material mat;
|
||||
|
||||
private Warp(String name) {
|
||||
@@ -91,21 +98,13 @@ public class Warp {
|
||||
return warpMap.get(name);
|
||||
}
|
||||
|
||||
public void setMat(Material mat) {
|
||||
this.mat = mat;
|
||||
}
|
||||
|
||||
public void setLocation(Location location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public void delete() {
|
||||
warpMap.remove(name);
|
||||
WorldData.getWarpData().remove(name);
|
||||
}
|
||||
|
||||
public void teleport(Player player) {
|
||||
player.teleport(location, PlayerTeleportEvent.TeleportCause.PLUGIN);
|
||||
player.playSound(location, Sound.ENTITY_ENDERMAN_TELEPORT, SoundCategory.PLAYERS, 1, 1);
|
||||
player.teleport(getLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN);
|
||||
player.playSound(getLocation(), Sound.ENTITY_ENDERMAN_TELEPORT, SoundCategory.PLAYERS, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user