forked from SteamWar/SteamWar
Add RegionSystem.getWorldSpawn
Fix Warp Update FixedRegionSystem
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
|
||||
package de.steamwar.bausystem.features.warp;
|
||||
|
||||
import de.steamwar.bausystem.region.RegionSystem;
|
||||
import de.steamwar.bausystem.worlddata.WorldData;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.*;
|
||||
@@ -35,8 +36,7 @@ public class Warp {
|
||||
|
||||
public static void enable() {
|
||||
Warp worldSpawn = new Warp("WorldSpawn");
|
||||
Location spawnPoint = Bukkit.getWorlds().get(0).getHighestBlockAt(org.bukkit.Bukkit.getWorlds().get(0).getSpawnLocation()).getLocation();
|
||||
worldSpawn.setLocation(spawnPoint.add(0.5, 1, 0.5));
|
||||
worldSpawn.setLocation(RegionSystem.INSTANCE.getWorldSpawn());
|
||||
worldSpawn.setMat(Material.NETHER_STAR);
|
||||
warpMap.put("WorldSpawn", worldSpawn);
|
||||
}
|
||||
|
||||
@@ -42,6 +42,12 @@ public interface RegionSystem {
|
||||
*/
|
||||
void save();
|
||||
|
||||
/**
|
||||
* Returns the Location to teleport players to when they first join or Warp to "WorldSpawn"
|
||||
*/
|
||||
@NonNull
|
||||
Location getWorldSpawn();
|
||||
|
||||
/**
|
||||
* Returns the GlobalRegion. This Region should have their {@link Region#getID()} return the
|
||||
* '00000000-0000-0000-0000-000000000000' UUID for easier retrieval with {@link #getRegion(UUID)}.
|
||||
|
||||
+8
@@ -23,6 +23,7 @@ import de.steamwar.bausystem.region.fixed.FixedGlobalRegion;
|
||||
import de.steamwar.bausystem.region.fixed.loader.PrototypeLoader;
|
||||
import de.steamwar.bausystem.region.fixed.loader.RegionLoader;
|
||||
import lombok.NonNull;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -45,6 +46,13 @@ public class FixedRegionSystem implements RegionSystem {
|
||||
public void save() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Location getWorldSpawn() {
|
||||
Location spawnLocation = Bukkit.getWorlds().get(0).getSpawnLocation();
|
||||
Location spawnPoint = Bukkit.getWorlds().get(0).getHighestBlockAt(spawnLocation).getLocation();
|
||||
return spawnPoint.add(0.5, 1, 0.5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Region getGlobalRegion() {
|
||||
return FixedGlobalRegion.INSTANCE;
|
||||
|
||||
Reference in New Issue
Block a user