Search in sources :

Example 1 with SpawnChangeEvent

use of org.bukkit.event.world.SpawnChangeEvent in project Glowstone by GlowstoneMC.

the class GlowWorld method setSpawnLocation.

/**
 * Sets the spawn location of the world.
 *
 * @param newSpawn the new spawn location
 * @param anchor   if true, the spawn is never unloaded while the world is running
 * @return true if the spawn location has changed
 */
public boolean setSpawnLocation(Location newSpawn, boolean anchor) {
    Location oldSpawn = spawnLocation;
    if (newSpawn.equals(oldSpawn)) {
        return false;
    }
    spawnLocation = newSpawn;
    if (anchor) {
        setKeepSpawnInMemory(keepSpawnLoaded);
    }
    EventFactory.getInstance().callEvent(new SpawnChangeEvent(this, oldSpawn));
    return true;
}
Also used : SpawnChangeEvent(org.bukkit.event.world.SpawnChangeEvent) Location(org.bukkit.Location)

Aggregations

Location (org.bukkit.Location)1 SpawnChangeEvent (org.bukkit.event.world.SpawnChangeEvent)1