Our server really needs a plugin to allow players in certain worlds to respawn in the same world they died in. I only need it for a couple worlds, so the plugin would have to have a config file where I could add the world name to a list where I want the plugin to work. Example: Players die in our KitsPVP world, but they get teleported back to the main hub spawn. We need them to get teleported right back to the KitsPVP world spawn. HUGE thanks in advance! Our server cannot move forward until we get this sorted out. Great work could result in a DEV staff position on our server if you're interested.
http://forums.bukkit.org/threads/kits.258640/#post-2423913 http://forums.bukkit.org/threads/can-anyone-create-this-for-me-playermenu.258253/#post-2421371 http://forums.bukkit.org/threads/sign-time-loop.247956/#post-2371867 http://forums.bukkit.org/threads/far-reach.252615/#post-2389874 You seem to be notorious for saying your gonna do something and then never doing it, not a good habit
I will do it . Done.. I am uploading it right now EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Alright so. Not to be mean but did you miss the part where I said XD I put it in and players were re-spawning in the same world they died in, in EVERY WORLD. I only need it in a world named pvp So can you make it so players only respawn in the same world they died in if they are in world 'pvp'?? Thanks for the efforts though man!!!
PhoKing bro use multiverse u can define a respawn world per world in the config. And if you use essentials you might have to take out essentials spawn bc it might conflict
PhoKing I'll have this done for you https://drive.google.com/file/d/0B6niH8eaqdpKWlByUEt3V0RxaEk/edit?usp=sharing EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Whoops! I missed that part but no worries, It was only a few lines of code. Glad to see someone else finished it tho. PhoKing
Henzz 22 minutes including upload time and time to type up your post, Man your a fast dev, even though that plugin is really light-weight.
There's actually a problem with the plugin. So the config was setup like this when I looked into config file. Code: # List the worlds you want the plugin to work on worlds: - world - world_nether - world_the_end But the weird thing is.. I didn't touch the config, and it respawned me in the same world for 'pvp' only. Even though in config it says it should respawn me in same world at world,nether, and end. So I changed the config to this.. Code: # List the worlds you want the plugin to work on worlds: - pvp - minigameshub But the plugin STILL only works in the world pvp. Any idea why the config file isn't working? Thanks man.
PhoKing Download: https://drive.google.com/file/d/0B6niH8eaqdpKODM1THFJTnl1QlE/edit?usp=sharing Just use the command /swset to set the spawn point for the world you want players to respawn in (if they die in the same world). If you don't want the plugin to work for specific worlds, just remove the world name and its child nodes from the config. Make sure you delete the config to regenerate a new one.
felpeti Code: package main.java.net.bigbadcraft.sameworld; import java.util.Set; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.plugin.java.JavaPlugin; public class SameWorld extends JavaPlugin implements Listener { private final ChatColor GREEN = ChatColor.GREEN; private Set<String> allowedWorlds; public void onEnable() { getServer().getPluginManager().registerEvents(this, this); saveDefaultConfig(); allowedWorlds = getConfig().getConfigurationSection("worlds").getKeys(false); getCommand("swset").setExecutor(this); } @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onDeath(PlayerRespawnEvent event) { Player player = event.getPlayer(); if (allowedWorlds.size() > 0 && allowedWorlds.contains(player.getWorld().getName())) { event.setRespawnLocation(getLocation(player.getWorld().getName())); player.sendMessage(GREEN + "You respawned in the same world."); } } @Override public boolean onCommand(CommandSender sender, Command cmd, String lbl, String[] args) { if (!(sender instanceof Player)) { return true; } Player player = (Player) sender; Location loc = player.getLocation(); Location underneath = loc.subtract(0.0, 1.0, 0.0); if (cmd.getName().equalsIgnoreCase("swset")) { if (args.length == 0) { if (underneath.getBlock() == null || underneath.getBlock().getType() == Material.AIR) { player.sendMessage(GREEN + "Cannot save spawn point on nothing."); return true; } saveSpawn(player.getLocation()); player.sendMessage(GREEN + "Successfully saved new spawn point."); } } return true; } private void saveSpawn(Location loc) { reloadConfig(); getConfig().set("worlds."+loc.getWorld().getName()+".x", loc.getBlockX()); getConfig().set("worlds."+loc.getWorld().getName()+".y", loc.getBlockY()); getConfig().set("worlds."+loc.getWorld().getName()+".z", loc.getBlockZ()); getConfig().set("worlds."+loc.getWorld().getName()+".yaw", loc.getYaw()); getConfig().set("worlds."+loc.getWorld().getName()+".pitch", loc.getPitch()); saveConfig(); } private Location getLocation(String path) { int x = getConfig().getInt("worlds."+path+".x"); int y = getConfig().getInt("worlds."+path+".y"); int z = getConfig().getInt("worlds."+path+".z"); float yaw = (float) getConfig().getDouble("worlds."+path+".yaw"); float pitch = (float) getConfig().getDouble("worlds."+path+".pitch"); return new Location(Bukkit.getWorld(path), x+0.5D, y, z+0.5D, yaw, pitch); } }