From 724e05d73b6997e07ed3558918a5b01cc5eec229 Mon Sep 17 00:00:00 2001 From: Simon Rigby Date: Fri, 11 Mar 2011 11:10:25 +0000 Subject: [PATCH] Basic Spawn & setSpawn Commands. --- .../MultiVerseCore/commands/MVSetSpawn.java | 15 +++++++++++++-- .../MultiVerseCore/commands/MVSpawn.java | 12 +++++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/com/onarandombox/MultiVerseCore/commands/MVSetSpawn.java b/src/com/onarandombox/MultiVerseCore/commands/MVSetSpawn.java index 262dbf9a..aa428dfe 100644 --- a/src/com/onarandombox/MultiVerseCore/commands/MVSetSpawn.java +++ b/src/com/onarandombox/MultiVerseCore/commands/MVSetSpawn.java @@ -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; } diff --git a/src/com/onarandombox/MultiVerseCore/commands/MVSpawn.java b/src/com/onarandombox/MultiVerseCore/commands/MVSpawn.java index b8d41dc4..03daf859 100644 --- a/src/com/onarandombox/MultiVerseCore/commands/MVSpawn.java +++ b/src/com/onarandombox/MultiVerseCore/commands/MVSpawn.java @@ -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; } }