All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.minecraft.server.CommandSetWorldSpawn Maven / Gradle / Ivy

package net.minecraft.server;

import java.util.List;

public class CommandSetWorldSpawn extends CommandAbstract {
	
	public CommandSetWorldSpawn() {
	}
	
	public String getCommand() {
		return "setworldspawn";
	}
	
	public int a() {
		return 2;
	}
	
	public String getUsage(ICommandListener icommandlistener) {
		return "commands.setworldspawn.usage";
	}
	
	public void execute(ICommandListener icommandlistener, String[] astring) throws CommandException {
		BlockPosition blockposition;
		
		if (astring.length == 0) {
			blockposition = b(icommandlistener).getChunkCoordinates();
		} else {
			if (astring.length != 3 || icommandlistener.getWorld() == null) {
				throw new ExceptionUsage("commands.setworldspawn.usage");
			}
			
			blockposition = a(icommandlistener, astring, 0, true);
		}
		
		icommandlistener.getWorld().B(blockposition);
		MinecraftServer.getServer().getPlayerList().sendAll(new PacketPlayOutSpawnPosition(blockposition));
		a(icommandlistener, this, "commands.setworldspawn.success", Integer.valueOf(blockposition.getX()), Integer.valueOf(blockposition.getY()), Integer.valueOf(blockposition.getZ()));
	}
	
	public List tabComplete(ICommandListener icommandlistener, String[] astring, BlockPosition blockposition) {
		return astring.length > 0 && astring.length <= 3 ? a(astring, 0, blockposition) : null;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy