Jumping twice?

Discussion in 'Plugin Development' started by IonMame, Mar 24, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    IonMame

    Is it possible to make a plugin where anyone who has permission to jump in mid air?

    The only way that I could think of doing this is spawning a block underneath their feet is there another way?

    Thanks,
    Mame
     
  2. Offline

    Technius

    There are a couple of thread about this. I suggest searching for "double jump" in the search bar.
     
  3. Offline

    teunie75

    Add some Y-Velocity when they do something.
     
  4. Offline

    TheChinski

  5. Offline

    chasechocolate

  6. Offline

    IonMame

    Thanks, this has really help from all the replies ;)
    I have got some code, but I didn't like the fact that they had to be in creative so I've opted for a different way to do it (Right-clicking with an item)


    Thread Solved
    ~Mame

    Thread not so solved :/

    Here's the code I've compiled, but when I seem to run it it gives me a java.lang.ClassNotFoundException, Does anyone know why this is?

    Code:
    package com.gmail.ionmame.animalabilities;
     
     
    import org.bukkit.Color;
    import org.bukkit.FireworkEffect;
    import org.bukkit.FireworkEffect.Type;
    import org.bukkit.Material;
    import org.bukkit.entity.Player;
    import org.bukkit.event.player.PlayerInteractEvent;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.util.Vector;
     
     
     
     
    public final class test extends JavaPlugin{
     
     
     
     
     
     
     
    /**
    * The firework launching code is courtesy of
    * @author codename_B
    * 
    * 
    * 
    * 
    */
     
    public void onPlayerUse(PlayerInteractEvent event){
    Player p = event.getPlayer();
     
    if(p.getItemInHand().getType() == Material.FEATHER);
    p.setVelocity(new Vector(0,0.25,0));
    FireworkEffect.builder().with(Type.BALL_LARGE).withColor(Color.YELLOW).build();
    }
     
     
    }
    
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  7. Offline

    Zarius

    I'd suggest posting the full error so people have more information to help you with.
     
  8. Offline

    IonMame

    Here's the full error log
    Show Spoiler

    2013-03-25 14:55:01 [INFO] Starting minecraft server version 1.5.1
    2013-03-25 14:55:01 [INFO] Loading properties
    2013-03-25 14:55:01 [INFO] Default game type: SURVIVAL
    2013-03-25 14:55:01 [INFO] Generating keypair
    2013-03-25 14:55:02 [INFO] Starting Minecraft server on *:25565
    2013-03-25 14:55:02 [INFO] This server is running CraftBukkit version git-Bukkit-1.4.7-R1.0-69-gd9f4d57-b2710jnks (MC: 1.5.1) (Implementing API version 1.5.1-R0.1-SNAPSHOT)
    2013-03-25 14:55:02 [SEVERE] Could not load 'plugins\animalabilities.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.ClassNotFoundException: com/gmail/ionmame/animalabilities;
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:184)
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:305)
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:230)
    at org.bukkit.craftbukkit.v1_5_R2.CraftServer.loadPlugins(CraftServer.java:239)
    at org.bukkit.craftbukkit.v1_5_R2.CraftServer.<init>(CraftServer.java:217)
    at net.minecraft.server.v1_5_R2.PlayerList.<init>(PlayerList.java:55)
    at net.minecraft.server.v1_5_R2.DedicatedPlayerList.<init>(SourceFile:11)
    at net.minecraft.server.v1_5_R2.DedicatedServer.init(DedicatedServer.java:105)
    at net.minecraft.server.v1_5_R2.MinecraftServer.run(MinecraftServer.java:379)
    at net.minecraft.server.v1_5_R2.ThreadServerApplication.run(SourceFile:573)
    Caused by: java.lang.ClassNotFoundException: com/gmail/ionmame/animalabilities;
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:173)
    ... 9 more
    2013-03-25 14:55:02 [INFO] Preparing level "world"
    2013-03-25 14:55:02 [INFO] Preparing start region for level 0 (Seed: 2163941854512449494)
    2013-03-25 14:55:02 [INFO] ----- Bukkit Auto Updater -----
    2013-03-25 14:55:02 [INFO] It appears that you're running a Development Build, when you've specified in bukkit.yml that you prefer to run Recommended Builds.
    2013-03-25 14:55:02 [INFO] If you would like to be kept informed about new Development Build releases, it is recommended that you change 'preferred-channel' in your bukkit.yml to 'dev'.
    2013-03-25 14:55:02 [INFO] With that set, you will be told whenever a new version is available for download, so that you can always keep up to date and secure with the latest fixes.
    2013-03-25 14:55:02 [INFO] If you would like to disable this warning, simply set 'suggest-channels' to false in bukkit.yml.
    2013-03-25 14:55:02 [INFO] ----- ------------------- -----
    2013-03-25 14:55:03 [INFO] Preparing start region for level 1 (Seed: 2163941854512449494)
    2013-03-25 14:55:03 [INFO] Preparing spawn area: 49%
    2013-03-25 14:55:03 [INFO] Preparing start region for level 2 (Seed: 2163941854512449494)
    2013-03-25 14:55:04 [INFO] Server permissions file permissions.yml is empty, ignoring it
    2013-03-25 14:55:04 [INFO] Done (1.641s)! For help, type "help" or "?"
     
  9. Offline

    Shinxs

    Is that the main class and if so you don't have the onEnable() and onDisable()
     
  10. Offline

    IonMame

    I've tried putting those in, I gives me an error saying that the resources don't have the javaplugin.class
     
  11. Offline

    Shinxs

    can you give me the code with the onEnable() and onDisable()
     
  12. Offline

    IonMame

    here
    Show Spoiler

    package com.gmail.ionmame.animalabilities;


    import org.bukkit.Color;
    import org.bukkit.FireworkEffect;
    import org.bukkit.FireworkEffect.Type;
    import org.bukkit.Material;
    import org.bukkit.entity.Player;
    import org.bukkit.event.player.PlayerInteractEvent;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.potion.PotionEffect;
    import org.bukkit.potion.PotionEffectType;
    import org.bukkit.util.Vector;




    public final class test extends JavaPlugin{

    public void onEnable(){


    }

    public void onDisable(){



    }


    /**
    * The firework launching code is courtesy of
    * @author codename_B
    *
    *
    *
    *
    */

    public void onPlayerUse(PlayerInteractEvent event){
    Player p = event.getPlayer();

    if(p.getItemInHand().getType() == Material.FEATHER);
    p.setVelocity(new Vector(0,0.25,0));
    FireworkEffect.builder().with(Type.BALL_LARGE).withColor(Color.YELLOW).build();





    if(p.getItemInHand().getType() == Material.BONE);
    p.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY,0,200));



    }


    }
     
  13. Offline

    Shinxs

    do you have ab plugin.yml?
     
  14. Offline

    IonMame

    yes, all that's on there is what the main class is.
    I haven't added commands to the code yet.
     
  15. Offline

    Shinxs

    can i see that?
     
  16. Offline

    IonMame

    fine :/
    Show Spoiler

    name: animalabilities
    main: com.gmail.ionmame.animalabilities;
    version: 0.1 beta
    author: IonMame(Matt)

    commands:
     
  17. Offline

    Shinxs

    you need to do main: com.gmail.ionmame.animalabilities.test
     
  18. Offline

    IonMame

    That would help....
    Thanks :)
    EDIT::
    Didn't make a difference :'(
     
  19. Offline

    CreeperShift

    You have an event in there but no eventlistener, wont work without it anyways.
     
  20. Offline

    IonMame

  21. Offline

    Shinxs

    and dont have ";" after it
     
  22. Offline

    CreeperShift

  23. Offline

    IonMame

    I have read the Developer Portal and Plugin Tutorial before posting, I didn't realize there was one specificly for events, Thank you for this I will be having a more in depth look at the wiki.

    Thanks Shinxs, don't know which on it was but the combination of your answer and CreeperShift's fixed it

    Thanks to both of you
     
    CreeperShift likes this.
  24. Offline

    CreeperShift

    It used to be included in the general plugin tutorial, but somewhat recently they changed how events are registered (it's much better and easier now ;) ) so it had to be rewritten and is now on it's own.
     
  25. Offline

    IonMame

    That's disappointing.
    Tried adding commands, they wont do whats in the curly brackets :(
     
  26. Offline

    CreeperShift

    Don't forget to add them to the plugin.yml :p

    Also if you post the code I could probably tell you why it's not working ;)
     
  27. Offline

    IonMame

    Code for the command:

    Code:
    public void onCommand1(CommandSender sender, Command cmd, String label, String[] args){
    Player p = (Player) sender;
    if(cmd.getName().equalsIgnoreCase("jump")){
    p.sendMessage("You tried to jump");
    p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,10,200));
     
     
    }
    }
    
     
  28. Offline

    CreeperShift

    Try to post it using the "code" button (next to the video button), makes it look nicer and keeps formatting.

    Are you sure you added the command to your plugin.yml?
     
  29. Offline

    IonMame

    Yeah, and other ideas?

    Code:
    commands:
      jump:
        description: Make you jump
        usage: /jump
     
  30. Offline

    CreeperShift

    Weird :/
    Your code seems correct.

    Try sending the player a message when he does the command so you can see if the potion part isn't working or the whole command isn't working.
     
Thread Status:
Not open for further replies.

Share This Page