More AdminWorld tweaks.

This commit is contained in:
StevenLawson 2013-08-12 12:51:30 -04:00
parent c636ee043a
commit 4b91de7414
2 changed files with 19 additions and 10 deletions

View File

@ -12,9 +12,16 @@ public class Command_adminworld extends TFM_Command
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
playerMsg("Going to world: adminworld");
if (sender_p.getWorld() == TFM_AdminWorld.getInstance().getAdminWorld())
{
playerMsg("Going to the main world.");
sender_p.teleport(server.getWorlds().get(0).getSpawnLocation());
}
else
{
playerMsg("Going to the AdminWorld.");
TFM_AdminWorld.getInstance().sendToAdminWorld(sender_p);
}
return true;
}
}

View File

@ -10,11 +10,9 @@ import org.bukkit.WorldCreator;
import org.bukkit.WorldType;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Sign;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.material.MaterialData;
import org.bukkit.scheduler.BukkitRunnable;
public class TFM_AdminWorld
@ -74,6 +72,11 @@ public class TFM_AdminWorld
}
}
public World getAdminWorld()
{
return adminWorld;
}
private boolean cachedIsUserSuperadmin(CommandSender user)
{
long currentTimeMillis = System.currentTimeMillis();
@ -107,11 +110,10 @@ public class TFM_AdminWorld
Block welcomeSignBlock = adminWorld.getBlockAt(0, 50, 0);
welcomeSignBlock.setType(Material.SIGN_POST);
Sign welcomeSign = (Sign) welcomeSignBlock.getState();
org.bukkit.block.Sign welcomeSign = (org.bukkit.block.Sign) welcomeSignBlock.getState();
org.bukkit.material.Sign signData = new org.bukkit.material.Sign(Material.SIGN_POST);
org.bukkit.material.Sign signData = (org.bukkit.material.Sign) welcomeSign.getData();
signData.setFacingDirection(BlockFace.NORTH);
welcomeSign.setData(signData);
welcomeSign.setLine(0, ChatColor.GREEN + "AdminWorld");
welcomeSign.setLine(1, ChatColor.DARK_GRAY + "---");