org.bukkit.event.world.SpawnChangeEvent Java Examples

The following examples show how to use org.bukkit.event.world.SpawnChangeEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CraftWorld.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
public boolean setSpawnLocation(int x, int y, int z) {
    try {
        Location previousLocation = getSpawnLocation();
        world.worldInfo.setSpawn(new BlockPos(x, y, z));

        // Notify anyone who's listening.
        SpawnChangeEvent event = new SpawnChangeEvent(this, previousLocation);
        server.getPluginManager().callEvent(event);

        return true;
    } catch (Exception e) {
        return false;
    }
}
 
Example #2
Source File: ExprSpawn.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected Location[] get(final Event e, final World[] source) {
	if (getTime() == -1 && e instanceof SpawnChangeEvent && !Delay.isDelayed(e)) {
		return new Location[] {((SpawnChangeEvent) e).getPreviousLocation()};
	}
	return get(source, new Converter<World, Location>() {
		@Override
		@Nullable
		public Location convert(final World w) {
			return w.getSpawnLocation();
		}
	});
}
 
Example #3
Source File: CraftWorld.java    From Thermos with GNU General Public License v3.0 5 votes vote down vote up
public boolean setSpawnLocation(int x, int y, int z) {
    try {
        Location previousLocation = getSpawnLocation();
        world.worldInfo.setSpawnPosition(x, y, z);

        // Notify anyone who's listening.
        SpawnChangeEvent event = new SpawnChangeEvent(this, previousLocation);
        server.getPluginManager().callEvent(event);

        return true;
    } catch (Exception e) {
        return false;
    }
}
 
Example #4
Source File: ExprSpawn.java    From Skript with GNU General Public License v3.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public boolean setTime(final int time) {
	return super.setTime(time, getExpr(), SpawnChangeEvent.class);
}
 
Example #5
Source File: ThreadSafetyListener.java    From LagMonitor with MIT License 4 votes vote down vote up
@EventHandler
public void onSpawnChange(SpawnChangeEvent spawnChangeEvent) {
    checkSafety(spawnChangeEvent);
}
 
Example #6
Source File: ThreadSafetyListener.java    From LagMonitor with MIT License 4 votes vote down vote up
@EventHandler
public void onSpawnChange(SpawnChangeEvent spawnChangeEvent) {
    checkSafety(spawnChangeEvent);
}