Basic Spawn & setSpawn Commands.

This commit is contained in:
Simon Rigby 2011-03-11 11:10:25 +00:00
parent b110c51062
commit 724e05d73b
2 changed files with 22 additions and 5 deletions

View File

@ -1,6 +1,9 @@
package com.onarandombox.MultiVerseCore.commands;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.onarandombox.MultiVerseCore.MVCommandHandler;
import com.onarandombox.MultiVerseCore.MultiVerseCore;
@ -9,12 +12,20 @@ public class MVSetSpawn extends MVCommandHandler {
public MVSetSpawn(MultiVerseCore plugin) {
super(plugin);
// TODO Auto-generated constructor stub
}
@Override
public boolean perform(CommandSender sender, String[] args) {
// TODO Auto-generated method stub
// TODO: Permissions
if(sender instanceof Player){
Player p = (Player) sender;
Location l = p.getLocation();
World w = p.getWorld();
w.setSpawnLocation(l.getBlockX(),l.getBlockY(),l.getBlockZ());
p.sendMessage(w.getName() + " - Spawn set to X: " + l.getBlockX() + " Y: " + l.getBlockY() + " Z: " + l.getBlockZ());
} else {
sender.sendMessage("Must be used in game");
}
return false;
}

View File

@ -1,6 +1,7 @@
package com.onarandombox.MultiVerseCore.commands;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.onarandombox.MultiVerseCore.MVCommandHandler;
import com.onarandombox.MultiVerseCore.MultiVerseCore;
@ -9,13 +10,18 @@ public class MVSpawn extends MVCommandHandler {
public MVSpawn(MultiVerseCore plugin) {
super(plugin);
// TODO Auto-generated constructor stub
}
@Override
public boolean perform(CommandSender sender, String[] args) {
// TODO Auto-generated method stub
return false;
// TODO: Permissions
if(sender instanceof Player){
Player p = (Player) sender;
p.teleportTo(p.getWorld().getSpawnLocation());
} else {
sender.sendMessage("Must be used in game.");
}
return true;
}
}