Random Spawn
Random Spawn is a simple plugin that spawns players at a random location in the world on their first login (configurable) and when they die. Sleeping in a bed disables the random spawn function and players will respawn at their bed when they die.
This is the first plugin I made. The idea for this plugin came from NuclearW's SpawnArea. I've used that for a while on my own server but thought it could use some extra features, so I tried to make one myself.
Thanks to NuclearW and Bretflann for being awesome and letting me use some of their code!
Thanks to WayGroovy and Francis Fenderson for donating!
Features:
- Random Spawn will not spawn players in:
- lava
- cacti
- water
- fire
- You can set a border where the players will random spawn inside
- After a player has lain or slept in a bed he won't be random spawned anymore and he will re-spawn at their bed if he dies
- This can be disabled when setting usebeds: false in the world.yml
- You can configure if players will be random spawned on there first join. (if false they will spawn at the map's default spawnpoint)
- you can set the first spawn location with the /setspawn command
- You can exclude players from being random spawned using the RandomSpawn.exclude permission node
- Random Spawn spawns players in a set area. You can define this area per world in the worlds.yml.
- Multiworld compatable
- Random Spawn signs. Type: [RandomSpawn] on the first line of a sign. To specify a world, type the world name on the second line. Configurable in config.yml.
- Custom messages after respawning.
- Spawning on command. since 2.4
When updating to version 1.6, please remove all the yml's and reconfigure them!
Commands:
See this page!
Permissions:
The permission nodes are optional.
- RandomSpawn.info Defaulted true
- RandomSpawn.help
- RandomSpawn.reload
- RandomSpawn.configure
- RandomSpawn.exclude
- RandomSpawn.setfirstspawn
- RandomSpawn.tpfirstspawn
- RandomSpawn.placesign
- RandomSpawn.usesign Defaulted true
- RandomSpawn.spawn
To-do list:
- Increase performance Increased performance a lot in version 1.6.1
- Circular spawn area's
- Any idea's?
Conflicting Plugins:
- SpawnX
Source available on Github!
If you like what I'm doing. Consider donating :) Please use the donate button in the top right.
Could you create an option for removing the chance of spawning in caves by further limiting blocks players can spawn on to include stone and gravel? I really like your plugin by the way. :)
@Digitalink2008
Ah, to be sure you could give jailed players the RandomSpawn.exclude permission and everything will be fine.
Without the permission it depends on what you use simplejail for. If you only use it for players who join the world for the first time it's fine if you remove -firstjoin from the randomspawnflags. However if you use it to ban/punish players they could indeed escape if they die inside the jail.
Hey ya josvth, quick question for you. I've used your plugin to provide some fun on a pvp server of mine and i loved it. I'm now interested in adding it to my casual play server but I've one concern.
We use simplejail for our jail needs. Have you ever seen them used in tandem before? I was afraid that a jailed player would have their spawn logic nabbed by random spawn and they would get out if they died in jail.
Just doing a bit of homework before dropping it in :)
Thanks man, Digi
@josvth
Okay I think these flags will do:
When a player changes to a normal world:
- from-other-world , rs player if coming from any other world
- from-own-nether , rs player if coming from this worlds nether
- from-own-end , rs player if coming from this worlds end
When a player changes to any other environment
- from-other-world, rs player if coming from any other world
@WayGroovy
That's a great solution!
However I was thinking of adding more randomspawnflags (those things under 'randomspawnon:' in the worlds.yml) like: - worldchange .
But I need to find a way to check if the 'from' world is a nether or a end world of the 'to' world.
Actually, I think this is already possible with the nodes you have in place.
If you were to enable random spawn on teleport, an admin could add randomspawn.exclude specifically to the nether and end versions of those worlds.
PermissionsEX example:
/pex group default add RandomSpawn.exclude world_nether /pex group default add RandomSpawn.exclude world_the_end
Aha! Now I understand.
What if it were controlled with a permissions node.
Then an administrator could use a multi-world permissions manager, such as permissionsex, to grant or deny that permission on a per world basis, including the nether and end worlds.
@WayGroovy
The multiworld home solution seems a good idea. But Random Spawn doesn't random spawn players if they teleport to a different world. Because joining a server or changing worlds are two different things and at the moment Random Spawn only works when a player joins the world.
I could change it, allowing it to act when a player changes world. But there are some small problems. For example when I say that Random Spawn should spawn players when they change to world A, they will also be randomspawned if they join world A from world A_nether or A_end.
Hey no problem. I've had an incredibly difficult time finding a working solution to my problem. I would think that individual inventory and location management would be a default option for multiverse, to add worlds with what would have the same effect of additional servers.
Thanks for taking the time for a fullly fleshed out response.
I've been seeking an answer to this problem in all sorts of places. /r/bukkit, /r/moddingmc, /r/admincraft, bukkit plugin requests, and multiverses ticket system.
I just had a wonderful idea. Maybe I'll go with a multiworld home solution, link homes to beds in only that world, enable random spawn for any and all visits to that world. Then, whenever a player tele-s into that world, they are randomspawned.
Already using MultiInv, but keep having difficulties with it. It particularly doesn't work well with Spectate yet.
I dunno, thinking 'out loud' there.
@WayGroovy
In my plugin I try to offer a basic multi world support. I would like to improve it, but without hooking in to other plugins such as Multiverse this may cause unwanted results. With basic support I mean, you can enable it in one world and disable it in one other.
However there are some tricks you could use.
At the moment Random Spawn tries to take full control when a player is respawned or joins the world for the first time. This however sometimes fails when an other plugin, say HomeSpawnPlus, tries to do the same. When a player joins a world (note. this is when a player connects to the server) Random Spawn checks if this is the first join of a player* and if the world is configured in the worlds.yml and randomspawns the player accordingly.
* Random Spawn checks if the players folder inside the world folder contains the .dat file of the player. If not it is the first join. However only normal environment worlds contain these .dat files. Forcing me to disable Random Spawn on first join in Nether and End environments.
The same goes for respawning, but Random Spawn assumes that a player is Random Spawning in the same world it dies. (I will come back to this point later) When the randomspawnflag: bedspawn is not set. It will respawn a player accordingly to it saved bedspawn. In other words, the last bed a player has slept in. If you want separate beds for separate worlds you could use Multiverse Inventories Beta plugin. However since my plugin refers to the last bed a player has slept in and Inventories probably saves the beds in it's own database a player will be spawned at the last bed it has slept in if the player should normally be randomspawned in the world he died.
Any other results might be caused by plugins that are overruling Random Spawn.
I recommend you to use Multiverse in a combination with Multiverse Inventories. However I'm just as you unfamiliar with handling multiple worlds. What you can do is use the overworld or respawn-world (I don't remember how it's called) of Multiverse and set this to the same world. However then there are 2 things you should keep in mind:
As for the "returning to where you were on a per world basis" I don't know if Multiverse supports it (if there is a plugin that does it, it's probably Multiverse) or if there's a separate plugin for this. But I will see if I can find one or think of a clever solution for it.
For the point I promised to come back to. Instead of assuming that the player respawns in the same world I can try to get his respawn location and use that world assuming the respawn location has been set by other plugins and mine will override it after. This is one of several ways I could improve the multiworld support of my plugin but they all lean to: "Forcing things and hoping it works in every situation." For example I could give my plugin a greater control of spawning events but if other plugins do the same we are stuck on the same problem.
As I said I don't know how my plugin will respond in a situation with x multiworld plugin. I will test some things out if I have the time. If you could report your findings back that would be great!
PS. Sorry for the freaking long post. I have problems finding the right worlds as well when handling multi world senarios.
Pardon me, kind sir, but how does Random-Spawn work now for multiworld?
Or rather, how does it track a players location after they leave when they return to a world with random spawn?
Let me rewind a bit.
I am seeking out a plugin to help manage a multiverse server, but haven't found one that would suit my needs quite yet, so I come to you for help.
Does a plugin exist that manages returning to where you were on a per world basis?
Does your plugin work from a multi-wolrd scenario where only one world, not the main world, would be affected by random-spawn?
I'm having a hard time articulating exactly what I'm looking for...
Basically, I'd like each world to be treated as if it were it's own server, for warping and login logout purposes...
Any help would be appreciated. Thank you for your time.
@deathwing911
@WayGroovy
Although I completely agree with WayGroovy. You can use RandomSpawn.exculed: false for the ops group I think.
I am not familliar with bpermissions, it would have to be handled at their level. One would be to not give * out to ops, but actually take the time and effort to figure out what permissions nodes for each plugin you want to give to each group and only give those out.
If you were using permissionsEX you could add negative nodes, such as "/pex group admin add -RandomSpawn.exclude", but again, I'm not familiar with bperms.
In short, using * is not a best-practice for managing permissions. Spend some time and sort out all your permissions and groups or switch to a more flexible permissions manager that utilizes negative nodes.
@josvth
is there a way to make ops remove this permission ?
@deathwing911
It might cause that all your op's have the RandomSpawn.exclude permission. ;)
@WayGroovy
yes ,why ? is it the cause ? edit : Using Bpermission
@Josvth
I tried multiple blocks. I always end up underground.
@deathwing911
Do you have a superperm set up like * for your ops/admin group?
@deathwing911
My plugin doesn't make differences between players and ops. Only those with the RandomSpawn.exclude permission will be exclude. But I will still check if something is wrong.
@aBoneFire
Do you have this every time you random spawn? And do you see this kind of block forming when you are random spawned? And is there a specific block that's causing this? Leaves are a problem most of the time.