Speed boost plugin.

Discussion in 'Archived: Plugin Requests' started by RecoveryCraft, May 4, 2014.

  1. Offline

    RecoveryCraft

    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.
     
  2. Offline

    DotDash

    I'll give it a try ;).
     
    RecoveryCraft likes this.
  3. Offline

    RecoveryCraft

    Are you still developing it? My hopes are high right now :)
     
  4. Offline

    DotDash

  5. Offline

    RecoveryCraft

    :D, 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. :D

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 8, 2016
  6. itotallyrock I do not that that's what he is looking for.
     
  7. Offline

    itotallyrock

    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
     
  8. Offline

    au2001

    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...
     
  9. Online

    timtower Administrator Administrator Moderator

  10. Offline

    DotDash

    I've just had it testing to see if the players velocity is more than walking speed, than multiplying the velocity
     
  11. Offline

    au2001

    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...
     
    timtower likes this.
  12. Offline

    DotDash

    Looks like it will be done pretty soon :p

    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.
     
    Last edited by a moderator: Jun 8, 2016
  13. Online

    timtower Administrator Administrator Moderator

    runTaskLater on a bukkitRunnable
     
    au2001 likes this.
  14. Offline

    DotDash

    That's done, but when ever i use cancelTask, it throws a bunch of errors :/
     
  15. Offline

    au2001

    DotDash Use a try/catch :
    Code:java
    1. try {
    2. //Your code here
    3. } catch (Exception e) { e.printStackTrace(); }
     
  16. Offline

    DotDash

    I'm wanting to cancel after 3 times, i thought there was a method for that?
     
  17. Online

    timtower Administrator Administrator Moderator

  18. Offline

    DotDash

    timtower No it was giving a bunch of errors.

    This is the first time I've used BukkitRunnable or BukkitScheduler :/
     
  19. Online

    timtower Administrator Administrator Moderator

    What are the errors?
     
  20. Offline

    DotDash

  21. Online

    timtower Administrator Administrator Moderator

    Full error log?
     
  22. Offline

    DotDash

    It gives me an error when I add the cancelTask at the end of the BukkitRunnable.
     
  23. Online

    timtower Administrator Administrator Moderator

    Full error log?
     
    RecoveryCraft and au2001 like this.
  24. Offline

    RecoveryCraft

    DotDash Yo, how's development?
     
  25. Offline

    DotDash

    RecoveryCraft Basically finished, only need a way to cancel the task.
     
  26. Online

    timtower Administrator Administrator Moderator

    Trying to help you on that:
     
  27. Offline

    RecoveryCraft

    DotDash timtower Yeah, Timtower is trying to help you. I don't know if you knew that :p
     
  28. Offline

    DotDash

    timtower
    Code:
    Code:java
    1. package me.dragona397.speedboost;
    2.  
    3. import org.bukkit.Bukkit;
    4. import org.bukkit.entity.Player;
    5. import org.bukkit.event.EventHandler;
    6. import org.bukkit.event.Listener;
    7. import org.bukkit.event.player.PlayerToggleSprintEvent;
    8.  
    9. public class SpeedBoost implements Listener {
    10. Main plugin;
    11. public SpeedBoost(Main instance) {
    12. plugin = instance;
    13. }
    14. @EventHandler
    15. public void ontoggleSprint(PlayerToggleSprintEvent e) {
    16. final Player p = e.getPlayer();
    17. if(p.isSprinting()) {
    18. Bukkit.getScheduler().runTaskTimer(plugin, new Runnable() {
    19. public void run() {
    20. for(int i = 0; i < 3; i++) {
    21. p.setVelocity(p.getVelocity().multiply(plugin.getConfig().getInt("SpeedUpAmount")));
    22. }
    23. void org.bukkit.scheduler.BukkitScheduler.cancelTask(taskid)
    24. }, (20*plugin.getConfig().getInt("SpeedUpTime")), (20*plugin.getConfig().getInt("SpeedUpTime")));
    25. }
    26. }
    27. }
    28. }
    29.  

    Errors:
    https://www.dropbox.com/s/r5u3zo57vafgq9g/Screenshot 2014-05-14 16.21.59.png
     
  29. Online

    timtower Administrator Administrator Moderator

    DotDash Try this:
    Code:java
    1. public class SpeedBoost implements Listener {
    2. Main plugin;
    3. public SpeedBoost(Main instance) {
    4. plugin = instance;
    5. }
    6. @EventHandler
    7. public void ontoggleSprint(PlayerToggleSprintEvent e) {
    8. final Player p = e.getPlayer();
    9. if(p.isSprinting()) {
    10. Bukkit.getScheduler().runTaskTimer(plugin, new Runnable() {
    11. public void run() {
    12. for(int i = 0; i < 3; i++) {
    13. p.setVelocity(p.getVelocity().multiply(plugin.getConfig().getInt("SpeedUpAmount")));
    14. }
    15. Bukkit.getScheduler().cancelTask(taskid);
    16. }, (20*plugin.getConfig().getInt("SpeedUpTime")), (20*plugin.getConfig().getInt("SpeedUpTime")));
    17. }
    18. }
    19. }
    20. }
    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 )
     
  30. Offline

    RecoveryCraft

    DotDash ay yo, not to annoy or anything but you haven't given us a update yet! :D
     

Share This Page