how to change the spawner type?

Discussion in 'Plugin Development' started by Roelyboely12, Aug 6, 2014.

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

    Roelyboely12

    this is my code:
    import org.bukkit.Material;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.player.PlayerInteractEvent;

    public class ChangeSpawnerType {

    @SuppressWarnings("deprecation")
    @EventHandler
    public void onClick(PlayerInteractEvent event)
    {
    Player p = event.getPlayer();
    if (p.getTargetBlock(null, 5).getType() == Material.MOB_SPAWNER);
    {
    if (p.getItemInHand().getType() == Material.MONSTER_EGG);
    {
    int spawnnegg_type = p.getItemInHand().getDurability();
    if (spawnegg_type=90) {
    //change the spawner type
    }

    }}}}
    i don't know how to change the spawner type
    any help?
     
  2. Offline

    RawCode

    provide valid code with nullchecks and debug trace.
     
  3. Offline

    Roelyboely12

    oh srry
    spawnegg_type cannot be resolved to a variable

    at line: if (spawnegg_type=90)
    (there is a red line under spawnegg_type)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  4. Offline

    yupie_123

    You probably need to change the following: if(spawnegg_type == 90)
    And I'm not sure if durability is an int either, can't check atm.

    If you want to compare something, use == and not =
     
Thread Status:
Not open for further replies.

Share This Page