Banner Shields (My Free Version)

Discussion in 'Plugin Development' started by Mudentmouse, Sep 2, 2015.

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

    Mudentmouse

    Hello I'm new to making bukkit plugins. Im only 15 years old and I didn't want to spend money on ANY of the things with banner shields the paid version on spigot, so I decided I was going to make my own. There is three mane parts to this plugin. 1:The player listener if he or she has a banner in there inventory it will be found and used[Done but I did it and I'm noob] 2:The Resistance effect that plays when you have a banner in your inventory [Need help with] 3:The display of the banner. I want it to appear on the back of your left arm, if thats possible. And I would like it to appear on your left when your in first person. Thanks so much!!!!!! My Player Listener:
    package me.Mudentmouse;



    import org.bukkit.Material;

    import org.bukkit.entity.Player;

    import org.bukkit.event.EventHandler;

    import org.bukkit.event.Listener;

    import org.bukkit.event.player.PlayerInventoryEvent;

    import org.bukkit.event.player.PlayerItemHeldEvent;

    import org.bukkit.inventory.ItemStack;

    import org.bukkit.inventory.meta.ItemMeta;

    import org.bukkit.material.Banner;



    public class PlayerListener implements Listener {



    public PlayerListener(Basic plugin) {

    plugin.getServer().getPluginManager().registerEvents(this, plugin);

    }



    @EventHandler

    public void Banner(PlayerItemHeldEvent event) {



    Player player = event.getPlayer();





    if (!event.getPlayer().getInventory().getType()

    .equals(Material.BANNER));



    }



    }
     
  2. Offline

    meguy26

    @Mudentmouse
    I'm 15 too.... But even I know bow to
    Code:
    Format code like this
    Its virtually unreadable otherwise
     
  3. Offline

    AcePilot10

    I don't really get the point of this thread... You should at least test it out before posting it. Also please put your code in your posts with this button http://prntscr.com/8c3p8o . As for your goal, this is very easy to make. Just make a boolean to check if the players current item in hand is a banner. Then listen for when the player takes damage and if the boolean returns true set the damage to whatever. For your third goal modifying things such as adding something into your left hand with this current API version is impossible. (You will be able to do it with mods though). If you need any help with plugins just pm me. Also in your "Banner" method when you say
    Code:
    if(!event.getPlayer().getInventory().getType().equals(Material.BANNER));
    you have two MASSIVE problems. Firstly and most importantly that won't even work because you have to use a bracket "{" after every if statement. (Although with java you don't always need to lets not stray too far from basic java). Secondly when you a put a "!" in front of the statement it looks to see if the statement is FALSE. So basically your saying if the player DOESN'T have a banner in their hand. ALSO I don't get what the point of your "playerListener" method is. Typically you would register your events in onEnable.

    @meguy26 everybody learns at their own pace. + i'm 14 :p
     
    Last edited: Sep 3, 2015
  4. Offline

    timtower Administrator Administrator Moderator

    Removed poll
     
  5. Offline

    Mudentmouse

    ............to be honest I'm only 11 i thought there was an age thingy on bukkit but theres not. Im just starting to learn java and bukkit. But anyways thanks AcePilot10 for your help.
     
  6. Offline

    ChipDev

    Lets get off the ages, but I can relate to @Mudentmouse ;)
    Lets just start by learning the basics of Java... It takes a while and some perseverance but it is very worth it.
    Second, I don't want to spoon-feed you code (just give you copy paste code), and some good practice is when comparing enums (An enum is for an example getItem().getType().. etc) you compare with =='s, unlike Strings which use .equals (Because of data storage, but enums stay the same!)
     
  7. Offline

    Mudentmouse

    Im working on this plugin and I need help with the line of code to reduce damage. I built the path on spigot 1.8 and I'm looking at a javadocs for 1.8.8 snapshot. Is setDamage in 1.8?????
     
Thread Status:
Not open for further replies.

Share This Page