I want to make everyone registered on my server start in one specific location the next time they login, despite where they were last time they logged off. The purpose is to start players at the new spawn location. How can I do this? Is there a command that comes with Essentials or anything? Can I get a plugin to handle this? This is very important I need to know an answer soon! Thanks guys. EDIT by Moderator: merged posts, please use the edit button instead of double posting.
i just signed up to bukkit to try and help you i thought that you could do this in the API but tested it and it don't work unfortunately :-( Code: Location setLoc = new Location(plugin.getServer().getWorld("world"),-100,64,100); for(OfflinePlayer Player : plugin.getServer().getOfflinePlayers()){ Player.getPlayer().teleport(setLoc); } what you could do is get all the offline players and store them and when they join the server next tp them to the location or even simpler you could just get every player to be tp'd to the location every time they join the server no matter what
Thanks for the responce...but wouldnt that make it so everytime someone logs on they start back at the spawn?
yeah but if the plugin stored every one in a list and as soon as they joined the server they would get tp'd there and then removed from the list and will not be tp'd again i made it and it works: Code: public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){ if(!sender.isOp())return true; if (!(sender instanceof Player))return true; Player Sender = (Player)sender; Location setLoc = Sender.getLocation(); List<String> playerList = new ArrayList<String>(); for(OfflinePlayer Player : getServer().getOfflinePlayers()){ if(Player.isOnline()){ Player.getPlayer().teleport(setLoc); } else { playerList.add(Player.getName()); } } getConfig().set("PlayersToTP", playerList); getConfig().set("TPworld", setLoc.getWorld().getName()); getConfig().set("TPx", setLoc.getX()); getConfig().set("TPy", setLoc.getY()); getConfig().set("TPz", setLoc.getZ()); saveConfig(); return true; } @EventHandler(priority = EventPriority.NORMAL) public void onPlayerJoin(PlayerJoinEvent event) { if(getConfig().contains("PlayersToTP")){ String TPworld = getConfig().getString("TPworld"); Double TPx = getConfig().getDouble("TPx"); Double TPy = getConfig().getDouble("TPy"); Double TPz = getConfig().getDouble("TPz"); Location TPloc = new Location(getServer().getWorld(TPworld),TPx,TPy,TPz); List<String> playerList = (List<String>) getConfig().getList("PlayersToTP"); if (playerList.contains(event.getPlayer().getName())){ event.getPlayer().teleport(TPloc); playerList.remove(event.getPlayer().getName()); getConfig().set("PlayersToTP", playerList); saveConfig(); } } } if you need me to i can make the plugin jar for you EDIT by Moderator: merged posts, please use the edit button instead of double posting.