Solved I Need Help With Item Stuff.

Discussion in 'Plugin Development' started by JigokuSaru, Apr 9, 2015.

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

    JigokuSaru

    I want to know how to change item usage and stuff like if i have a stick named Test (Just for this), so after the item is named that It gets the enchantment glow to it and when I uses it it... lets say spawns a cow where i right clicked while holding the stick, Is this posible or not thanks for helping me :3
     
  2. Offline

    pie_flavor

    @JigokuSaru The former requires either using custom packets, which is difficult, or just adding a pointless enchantment (such as Power) to the item. You can hide the enchantment in 1.8 by setting hide flags to 1.
    The latter can be done with events. Just listen for a PlayerInteractEvent and create a cow where the player is looking if they are right clicking a block while holding a stick.
     
  3. Offline

    Msrules123

    It is very possible. I'm assuming you don't know how to do it, so I'll help you out some.

    1. Create the stick, add desired effects to it
    2. Give the stick to the player
    3. Listen for right click with your custom stick
    4. Spawn the cow where the player is looking

    If you need additional help, feel free to Tahg me. Try it by yourself first, with an IDE you should easily be able to find and use the methods.

    EDIT: Ninja'd
     
  4. Offline

    JigokuSaru

    @Msrules123
    Ok i just need to know what you mean by IDE
     
  5. Offline

    pie_flavor

    @JigokuSaru Integrated Development Environment
    like Eclipse or IntelliJ or such
     
  6. Offline

    JigokuSaru

    @pie_flavor
    Ah ok I have Eclipse, Im very new at this im use to programing Python.
     
  7. Offline

    sgavster

    I would suggest learning Java first..
    <Edit by Moderator: Redacted bit url>
     
    Last edited by a moderator: Feb 10, 2017
  8. Offline

    pie_flavor

    @sgavster That was kinda rude. He's inexperienced with Bukkit, not Java. Being new at this doesn't mean you haven't learned it at all.
    @JigokuSaru If you are having difficulty with Java, might I recommend Scala? It compiles to .class files, so you can still use it with Bukkit, but it has syntax much more similar to Python. The only downside is that to run scala code, you need the scala libs, so other people won't be able to use your plugin.
     
  9. Offline

    vhbob

    @JigokuSaru Heres a sample code i wrote for you
    Code:
    @EventHandler(priority=EventPriority.HIGH)
        public void onPlayerUse(PlayerInteractEvent event) {                   
            Player p = event.getPlayer();
                     ItemStack itemInHand = p.getItemInHand();
            if(itemInHand.getType() == Material.REDSTONE_TORCH_ON && itemInHand.hasItemMeta() && itemInHand.getItemMeta().getDisplayName().equals(ChatColor.RED + "" + ChatColor.BOLD + "Fire wand")) {
                 Fireball fire = p.getWorld().spawn(event.getPlayer().getLocation().add(new Vector(0.0D, 1.0D, 0.0D)), Fireball.class);
                    fire.setFireTicks(0);
                    fire.setShooter(p); }
            }         
    it means that if you click wit hthe item Fire Wand you will shoot a fireball
     
  10. @vhbob Please do not spoonfeed. Especially code that has bad syntax and could be done better.
     
  11. Offline

    vhbob

  12. Offline

    JigokuSaru

    I figured some stuff out but now i need to figure out if i have a spawn egg(cow) with the name of baby, it spawns a baby cow or a villager egg with the name of um Tommy(idk) it spawns a villager of the butcher profession and has slowness to stop it from moving , unless theres a better method , and damage protection to make it so it cant be hurt and so on
     
Thread Status:
Not open for further replies.

Share This Page