Jump to content

(request) random spawn points on death / creation


Recommended Posts

I do have a request..... for random spawn points upon first creating a character and entering the world, and upon the character respawning after death.


would be superawesome to be able to spawn randomly from an array of spawnpoint gameobjects.


Definitely needed in a pvp based game, so players cannot camp spawn points and kill new spawns.

Link to comment
Share on other sites

  • 3 months later...

that shouldn't be a big task as you would just half to on death make the system randomly pick from a list of spawn points. just example havent dug into it yet but somthing like.


HashMap spawns = new HashMap();

Set spawn = this.getConfig().getConfigurationSection("spawn")


int i = 0;

for (String s : spawn) {

String path = "spawn." + s + ".";

spawns.put(i, toLocation(getConfig().getString(path + "location")));





public static Location toLocation(String s) {

String[] file = s.split(";");

World w = Bukkit.getWorld(file[0]);

double x = Double.parseDouble(file[1]);

double y = Double.parseDouble(file[2]);

double z = Double.parseDouble(file[3]);

if (file.length == 6) {

return new Location(w, x, y, z, Float.parseFloat(file[4]),



return new Location(w, x, y, z);




I dout this will work as i haven't looked all way into it but something like this.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recommended Cloud Solution


  • Create New...

Important Information

By using this site, you agree to our Terms of Use.