Help with PlayerListener and events based on armor

Discussion in 'Resources' started by Poe, Aug 2, 2011.

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


    Hello. Im new to plugins and im trying to make a plugin that lets you walk faster when you sneak and are wearing boots (leather improves a little and so on). Im currently working on the playerlistener class and this is what it looks like so far:
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
    package me.poe.plugins.runningshoes;
    import org.bukkit.event.player.PlayerListener;
    import org.bukkit.event.player.PlayerMoveEvent;
    import org.bukkit.event.player.PlayerToggleSneakEvent;
     * @author Poe
    public class RunningShoesPlayerListener extends PlayerListener {
        public void onPlayerToggleSneak(PlayerToggleSneakEvent event) {
    does anyone know how i would make it read what boots the player is wearing if they are? ive watched tons of tutorials and gone through all the events and i cant find one that looks right. please help :)
  2. Offline


    Well I'm not claiming to be an expert as I've just looked into bukkit and java for the first time an hour ago, but here's my opinion:

    org.bukkit.inventory PlayerInventory interface. This contains getLeggings() which can detect the type of boots that are being worn. Then in your onPlayerToggleSneak, get the leggings and define a speed constant to each (maybe a hashmap or array to do KEY : SPEED). Then take the value of the hashmap/array to define the speed when sneaking. Then for player speed, maybe org.bukkit.event.player.PlayerListener onPlayerVelocity() while in the toggleSneak event and manipulate the speed using setVector functions.
  3. Offline


    Velocity changes are a bad thing when it comes to Minecraft. It will probably throw Illegal Move errors all over the log and may kick players from certain servers. Check the link in my signature Resources for a list of tutorials to help kick start your plugin development.
  4. Offline


    ok...ill design the plugin for something else
  5. Actually there are a few plugins that do exactly what you wrote up there so IF you really want to do it go ahead, they proved its possible so it should work and will probably not cause all those errors if you do it right :)
  6. Offline


    i would but i dont really know what playerlistener code to use for it
  7. You could use the PlayerMoveEvent, then detect which type of boots the player is using and set the speed.

    you would have to do something like if leggins = leather {increase speed} .
    You will have to get the players armor slot and get the value it has eg. leather boots then set the speed according to it.
  8. Offline


    do u think i should go through with it? would u download it? im gonna download urs! but u need permissions support
  9. Lol all my plugins are private for my server, I don't release them (atm). I'm not making one that increases speed.

    If you really want to make it go for it, but seeing as there are already plugins out there that do this AND the fact that you will probably not know how to finish it (the increase speed isn't too easy tbh) i'd say think of something easy, something unique. Don't recreate a plugin that is already there, think of something creative and easy, but not something that just requires 2 lines of code :p. It will probably help you and teach you the basics, after that you can go for harder stuff.

    Also this is the wrong forum. Don't use the Ressource forum for help questions :p
  10. Offline


    kk ill scrap this...any unique not super hard ideas?
  11. make a plugin that, on a command like /mount Creeper puts you either on a creeper or mount a creeper ontop of you :D and make that work for every mob ^^
  12. Offline


    it exists...mobrider but if u want i can do that
  13. I know the first part exists, tho the second doesn't. It was just an idea I pulled out of my hat. I probably wont install or use this as I don't need it :p But if you want some ideas look at the Plugin request forum :)
  14. Offline


    those are all hard but ill give it a shot! thanks
Thread Status:
Not open for further replies.

Share This Page