Plugin category: Fun Suggested name: Speed boost plugin. What I want: A plugin that gives you a small speed boost when you run for more than 3 seconds. Like super mario 3d world. Kind of useless, but I think it would be nice for my server. And a configurable running time before you hit the boost and the speed of the specific boost in the config. Ideas for commands: No commands needed for this plugin. Ideas for permissions: speedboost.boost When I'd like it by: This week.
, How long do you think it would take? Not to rush you or anything. :3 Sorry to bump, but could you possibly add effects to the speed boost? Like the explosion effect. EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Yeah I misread the original, good thing I only spent 8 minutes on it. It wouldn't be the worst to change it though But I removed the original post. So i'll give it a go and try it
itotallyrock TehMinecraftPoke RecoveryCraft DotDash I don't know if that would be possible because you would need one of these : - PlayerToggleRunEvent - Player.isRunning() - Player.getCurrentSpeed() And no one of these exists. I don't know how you could do that...
au2001 http://jd.bukkit.org/rb/doxygen/d5/...Player.html#a1cd82b989457a74395b3fb24b0bb6a73 http://jd.bukkit.org/rb/doxygen/d7/...ent_1_1player_1_1PlayerToggleSprintEvent.html
I've just had it testing to see if the players velocity is more than walking speed, than multiplying the velocity
timtower Well, looked for it and didn't find! Then it's pretty easy! DotDash Look at timtower's links, I think it will help you...
Looks like it will be done pretty soon timtower I need to repeat the speedup 3 times, but I need to delay each time. How would I go about doing that? EDIT by Moderator: merged posts, please use the edit button instead of double posting.
DotDash Use a try/catch : Code:java try { //Your code here} catch (Exception e) { e.printStackTrace(); }
DotDash http://jd.bukkit.org/rb/doxygen/d4/...nnable.html#a47a66a877a9f3969069dbcc681a4754e Is that not working?
timtower No it was giving a bunch of errors. This is the first time I've used BukkitRunnable or BukkitScheduler :/
timtower Code: Code:java package me.dragona397.speedboost; import org.bukkit.Bukkit;import org.bukkit.entity.Player;import org.bukkit.event.EventHandler;import org.bukkit.event.Listener;import org.bukkit.event.player.PlayerToggleSprintEvent; public class SpeedBoost implements Listener { Main plugin; public SpeedBoost(Main instance) { plugin = instance; } @EventHandler public void ontoggleSprint(PlayerToggleSprintEvent e) { final Player p = e.getPlayer(); if(p.isSprinting()) { Bukkit.getScheduler().runTaskTimer(plugin, new Runnable() { public void run() { for(int i = 0; i < 3; i++) { p.setVelocity(p.getVelocity().multiply(plugin.getConfig().getInt("SpeedUpAmount"))); } void org.bukkit.scheduler.BukkitScheduler.cancelTask(taskid) }, (20*plugin.getConfig().getInt("SpeedUpTime")), (20*plugin.getConfig().getInt("SpeedUpTime"))); } }}} Errors: https://www.dropbox.com/s/r5u3zo57vafgq9g/Screenshot 2014-05-14 16.21.59.png
DotDash Try this: Code:java public class SpeedBoost implements Listener { Main plugin; public SpeedBoost(Main instance) { plugin = instance; } @EventHandler public void ontoggleSprint(PlayerToggleSprintEvent e) { final Player p = e.getPlayer(); if(p.isSprinting()) { Bukkit.getScheduler().runTaskTimer(plugin, new Runnable() { public void run() { for(int i = 0; i < 3; i++) { p.setVelocity(p.getVelocity().multiply(plugin.getConfig().getInt("SpeedUpAmount"))); } Bukkit.getScheduler().cancelTask(taskid); }, (20*plugin.getConfig().getInt("SpeedUpTime")), (20*plugin.getConfig().getInt("SpeedUpTime"))); } } }} You was declaring a method in a method, your runner will run once while you loop within 1 server tick ( probably wanted to loop 3 times though )