(Went back and edited my post to be more clear) Plugin category: Teleport Suggested name: 2 Up 1 Forward What I want: A command to teleport a player 2 blocks up, 1 block forward. That way if you have adventure type areas of maps, and have block breaking disabled, they can get out of wholes. An adjustable cooldown, or maybe set it for something like 10 minutes so it isn't griefed. Ideas for commands: /upforward Ideas for permissions: player.upforward When I'd like it by: When convenient
Hi, so in tecnical manner you want a plugin that will allow you to for instance /up and it will mabe u go 2 blocks up in the air and 1 forward... What i dont understand: 1. you want it to be executed by commandblocks? 2. you want it to have a specific message? 3. you wlso want a land protection (No break or/and no place of blocks)? 4. Do you mean launchpads? (this is somthing that wen u step on it aunces u high and moves u forward.) thanks
I am doing it. It will be available for download on http://www.shadowcasted.com/#downloads Glad to help you. If you find any bug, just tell me! EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Thanks for working on it! It works fine if you are in a hole above ground (sky above), but if you are underground it goes straight to the top (like the /top command). Also, is there a way to do an adjustable cooldown?
Ya, sure, I will tell you when it's available for download. lucasbuck I did that you were teleported to the first hole above you. Someone could help me for the cooldown? please send the function and how to use them. Thanks. EDIT by Moderator: merged posts, please use the edit button instead of double posting.
au2001 Me personally i use a cool down plugin for my server .. it is tons easier and you can make ANY command have a cool down of your choice.
@JoTyle Yes but here, I need to do that in one plugin... I am still interested in that plugin to see how the've done. What's the name?
au2001 To make a cool down system is actually quite simple You just need to create an arrayList that stores the players name who is on cool down, and then when they type the command check if they are in the arrayList. If they are not, execute the command, then using a scheduler add them to the cool down list for a certain amount of time, and once that time runs out, have it remove them. If they are already on the arrayList just deny them access to it using if statements. If you still don't get it by this afternoon I will send some of my code over
Benlewis9000 That's what I did : Code:java private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);static ArrayList<Player> cooldown = new ArrayList<Player>();public void addtoList(final Player player) {cooldown.add(player);final Runnable remove = new Runnable() {public void run() { cooldown.remove(player); }};final ScheduledFuture<?> schedule = scheduler.scheduleAtFixedRate(remove, 10, 10, TimeUnit.SECONDS);scheduler.schedule(new Runnable() {public void run() { schedule.cancel(true); }}, 30, TimeUnit.SECONDS);} So now it works. The cool down is 30 seconds.
That works, thank you! 2 questions: 1) Is the permission player.upforward ? 2) Would it be hard to make the cooldown editable, like through a yml file? I was actually playing around with eclipse to see if I could do it myself, but I'm in over my head.
au2001 Instead of TimeUnit.SECONDS it is a lot easier to just set the tick cooldown to 'ticks * 20. That has aloways worked for me with config input. If you send me the source I could try?
Benlewis9000 Here's the source, thanks for trying : Code:java package me.au2001.UpForward; import java.util.ArrayList;import java.util.concurrent.Executors;import java.util.concurrent.ScheduledExecutorService;import java.util.concurrent.ScheduledFuture;import java.util.concurrent.TimeUnit;import java.util.logging.Logger; 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.plugin.PluginDescriptionFile;import org.bukkit.plugin.java.JavaPlugin; public class UpForward extends JavaPlugin {public final Logger logger = Logger.getLogger("Minecraft");private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);static ArrayList<Player> cooldown = new ArrayList<Player>();private static long cooldown_lenght = 30;public static UpForward plugin; public void onEnable() {PluginDescriptionFile pdfFile = this.getDescription();this.logger.info("[" + pdfFile.getName() + "] v" + pdfFile.getVersion() + " is enabled!");} public void onDisable() {PluginDescriptionFile pdfFile = this.getDescription();this.logger.info("[" + pdfFile.getName() + "] is disabled!");} public void addtoList(final Player player) {cooldown.add(player);final Runnable remove = new Runnable() {public void run() { cooldown.remove(player); }};final ScheduledFuture<?> schedule = scheduler.scheduleAtFixedRate(remove, 1, 10, TimeUnit.SECONDS);scheduler.schedule(new Runnable() {public void run() { schedule.cancel(true); }}, cooldown_lenght, TimeUnit.SECONDS);} public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {if (commandLabel.equalsIgnoreCase("upforward")) {if (args.length == 2 && args[0].equalsIgnoreCase("set")) {cooldown_lenght = Integer.parseInt(args[1].replaceAll("[\\D]", ""));sender.sendMessage("Cooldown lenght set to " + cooldown_lenght + " seconds.");return true;} else {if (sender instanceof Player) {Player player = (Player)sender;if (player.hasPermission("player.upforward")) {if (!cooldown.contains(player)) {Location location = player.getLocation().add(1, 0, 0);boolean found = false;while (!found) {if (player.getWorld().getBlockAt(location).getType().equals(Material.AIR)) {if (player.getWorld().getBlockAt(location.add(0, 1, 0)).getType().equals(Material.AIR)) {found = true;}} else {location.add(0, 1, 0);}}player.teleport(location);addtoList(player);return true;} else {sender.sendMessage(ChatColor.RED + "You must wait " + cooldown_lenght + " seconds between each command.");}} else {sender.sendMessage(ChatColor.RED + "You don't have permissions to execute this command.");}} else {sender.sendMessage("You must be a player to execute this command.");}}}return false;}} In this version, you can change the cool down length with /upforward set <length>
au2001 Great, I'll have a look this afternoon EDIT: Um, my pc has broken... Fails to get past the startup screen and just goes black, saying my wacom drivers are not installed out something...
Simple, set the y to 2 and teleport the player to it set also the x etc.. is this so hard? Everyone can code this
timtower MordorKing78 But that is saying that the y+2 and the x+ 1(direction) is air … if it isn't well… Suffocation.
You can download the ned version, I redid the permissions : upforward.use lets you use /upforward upforward.cooldown.bypass lets you bypass the cool down And I added the config, you choose the cool down length (it's in seconds). Also, I made that it takes the closest hole there is above you, here is a 2d illustration : ||_|||| ||__|| ||_x || <-- Goes here, not at the surface ||_|||| ||P|| <-- Player that does /upforward |||||| _ -> air || -> blocks
No it goes + try it with an effect u set the y to 2 and the effect will go up 2. Ur get the location with p.getlocation etc. You cant suffocate in air. EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Its saying first he gets that location the he adds a y of 2 and x of +1 were u looking at. Like p.getLocation.add(0,2,1) or something I could help u with it. EDIT by Moderator: merged posts, please use the edit button instead of double posting.
MordorKing78 That's too late sorry I will upload the new version in a few hours, it should be the final one.
not really no, just do that : Code:java private static final ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor();static ArrayList<Player> cooldown = new ArrayList<Player>(); if (!cooldown.contains(player) || player.hasPermission("upforward.cooldown.bypass")) {...if (!player.hasPermission("upforward.cooldown.bypass")) {cooldown.add(player);Runnable task = new Runnable() { public void run() { cooldown.remove(0); }};worker.schedule(task, getConfig().getInt("cooldown"), TimeUnit.SECONDS);}} else {// ERROR MESSAGE, cool down isn't finished yet}
lucasbuck Since this plugin has been created, please mark this as filled. If I helped you, like me, follow me and donate!
Thank you very much, and sorry for the late reply! After the update, I've had a mess. Kind of bad when you build and educational server with a ton of Citizens that give kids quests, and then they break Citizens. Still trying to sort out what direction to go. But again, thanks so much and sorry I didn't reply sooner.