RandomPlacer
Description
This is my first plugin, and I made it because sometimes players would like to be isolated or find a spot far away from somewhere to build a house. This plugin allows them to teleport to a random location with a command. You may set a boundary for how far they can teleport to limit lag or have them teleport to an arena or something. This simple plugin could help servers be more spread out in their maps and not be really cluttered together.
Important
Current users will need to edit their config, changing `x` to `positiveX`, `z` to `positiveZ`, `nx` to `negativeX`, and `nz` to `negativeZ` or their limits will be reset. This was changed because it may have been confusing at first.
Commands/Permissions
- Type `/tpr` to teleport to a random location on the map. - This requires the permission `RandomPlacer.use`
- Use `/tpr reload` to reload the config. - This requires the permission `RandomPlacer.reload`
Config
- RandomPlacer.limit.positiveX: This is the limit of how far the player can teleport on the x axis. Default is 1000.
- RandomPlacer.limit.positiveZ: This is the limit of how far the player can teleport on the z axis. Default is 1000.
- RandomPlacer.limit.negativeX: This is the limit of how far the player can teleport on the -x axis. Default is -1000
- RandomPlacer.limit.negativeZ: This is the limit of how far the player can teleport on the -z axis. Default is -1000
- RandomPlacer.Teleported: Tells the player their current coordinates after the teleport. {x} will be replaced with their x, {z} will be replaced with their Z.
- Error.Cooldown: Tells the user they have to wait for the command to cooldown before using it. {cooldown} is the number of seconds they have to wait, {s} is for adding an S to the end if the word should be plurl.
- RandomPlacer.cooldown: How many seconds the user has to wait between sending the command again.
Source
Source code can be found here.
Change Log
1.0.0: Initial commit, basic teleportation within limits
1.1.1: Added a cooldown, fixed the config, cleanup
2.0: Cleaned up the code a ton, some edits to the config.
@nasonfish
Awesome - I'm actually starting to learn java/how to make plugins so I was going to try to make it check for liquid myself (still might for practice, I have a few ideas, not sure if they'll work 100%).
I'll likely read over your source once you finish it to learn how you went about doing it, to see if I was on the right track or not. :D
I've started work on a way to block spawning above certain blocks (lava, fire, water, anything you specify in the config) and I will have that done sometime, hopefully soon. :)
This is great, lightweight too, I just wish there was a way to block it in certain worlds - and if you could do what superpeanut911 suggested as well, that'd be amazing.
I'm spawning in oceans a lot and it's a bit annoying. Add an config option for blocks people can't spawn on? So if you don't want people spawning in oceans, turn off water spawns or sand if you dislike deserts for some reason? Thanks!
My server is an ocean with some islands... would it work to find (ungenerated) islands?
thanks dude ;)
I hope you are still updating this! :D It's a great plugin, super lightweight.
Yes, it is, i'm sure about this :P
Is this plugin working with 1.4.2?
I need plugin that teleports player from world X to world Y at random location, your plugin looks good, but will you support multiworld - selecting what world it will teleport to?
Derp ; Error I Have craftbukkit 1.3.1 R2.0
12:48:01 [GRAVE] Could not load 'plugins/RandomPlacer.jar' in folder 'plugins' org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: me/zippy120/RandomPlacer : Unsupported major.minor version 51.0 at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:155) at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:305) at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:230) at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:222) at org.bukkit.craftbukkit.CraftServer.<init>(CraftServer.java:198) at net.minecraft.server.ServerConfigurationManagerAbstract.<init>(ServerConfigurationManagerAbstract.java:50) at net.minecraft.server.ServerConfigurationManager.<init>(SourceFile:11) at net.minecraft.server.DedicatedServer.init(DedicatedServer.java:105) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:378) at net.minecraft.server.ThreadServerApplication.run(SourceFile:539) Caused by: java.lang.UnsupportedClassVersionError: me/zippy120/RandomPlacer : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) at java.lang.ClassLoader.defineClass(ClassLoader.java:615) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) at java.net.URLClassLoader.access$000(URLClassLoader.java:58) at java.net.URLClassLoader$1.run(URLClassLoader.java:197) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:44) at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:29) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:247) at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:144) ... 9 more
@Zippy120
I have the spawn in one world, and do not want to transfer it to all the other worlds. I would like a world setting so the command teleports them to the world specified in the config, between the set paremeters. And the different limits for each world would be nice, too.
@DarklightPvP
The plugin uses the world the player is in currently, so if you went to the nether/end and used the command (I wouldn't suggest that...) It would teleport the player accordingly. Do you mean something else like that, like different limits for each world or only letting them do it in one world?
@Zippy120
Oh, and also: I am planning on multiple maps for my server, like swapping them every now and then so the players don't get bored of the same map, and I would need a "world" option from this plugin for it to work. So you would still have your x, y, etc but then the world it spawns you in. If you could add this I'll be a happy bunny c:
@1337minecrafer
Okay, thanks for your input! I'll make it place players above the block so they won't drop in, and add x and z to the tp message (in the next version i think you should be able to do it yourself)
@Zippy120
It's only happened once or twice, so it should be ok. And I cannot expand my limits because I have a custom map that wasn't generated with a server plugin.
Also, a couple of feature requests: 1: Instead of the coordinates when you spawn saying "345, 235", how about: x345, y235"? 2: You somtimes get glitched into blocks when teleporting. No biggie on my server because of the type, but it can be annoying for players sometimes.
EDIT: I was logged into the wrong account when posting this, if you were confused :s
Okay, I'm trying to get the config to be the way it was, the plugin is not cooperating.
I'm working on the cooldown as well, it should be in soon, probably along with the config fix.
@DarklightPvP: As for WorldGuard, I've never really experimented or used that plugin at all, but if you get teleported to the spawn, I'd suggest just doing the command again.
If it happens frequently, expand your limits with the config. Higher radius means more places to teleport to that don't include the spawn.
Updates may be a bit rare due to me being pretty busy, but I'll try to keep it working and up-to-date as best I can. If you have any suggestions, questions, comments, etc., just ask in the comments. I'll get to them.
I would like a feature that it doesn't spawn people inside certain WorldGuard areas, because I have a map with a spawn in the centre, and it sometimes spawns people inside the spawn, which can get annoying.
@cydp3
Config is inside the RandomPlacer.jar, just open it and edit the config.
Yeah the config file seems to be missing in 1.3. Could you update it please? I love this plugin.