Solved Material.

Discussion in 'Plugin Development' started by icedmoca, Mar 8, 2016.

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

    icedmoca

    for cobblestone it's material.cobblestone

    What's for mossy cobblestone?
     
  2. Took about 10 seconds in my IDE to find out. It is "Material.MOSSY_COBBLESTONE"
     
  3. Offline

    icedmoca

    i love you, I'm retarded xD
     
  4. Please set this thread to solved. :)
     
  5. Offline

    icedmoca

    Wait how about the Stone Brick Monster Egg block?
     
  6. Offline

    Konato_K

    @Kyleyocats MONSTER_EGGS, be careful to not type MONSTER_EGG (that's the spawn egg item)
     
  7. Offline

    icedmoca

    What if i wanted the stone brick monster egg..
     
  8. Offline

    Corndogoz

    you wanna uhh mark this as solved?
     
  9. Offline

    icedmoca

    No, what Material.<ID> is for stone brick monster egg?
     
  10. Offline

    Corndogoz

    i think you have to use some kind of data tag like ItemStack stonebricks = new ItemStack( Material.STONE_BRICKS, 1, (byte)1); im not positive, and you may have to change this a bit
     
  11. Offline

    icedmoca

    This is my code, how do i change it to stone brick monster egg?
    Code:
        if (p.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.SLIME_BLOCK)
     
  12. Offline

    Corndogoz

    ik setdata is deprecated, but this may work:
    b.setType(Material.MONSTER_EGG);
    b.setData((byte)2);
     
  13. Offline

    icedmoca

    Omg everything I've tried doesn't work, can you just implement it into my code? Change the slime block to the stone brick monster egg..
    Code:
    package me.star.poisontouch;
    
    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.block.BlockFace;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerMoveEvent;
    import org.bukkit.potion.PotionEffect;
    import org.bukkit.potion.PotionEffectType;
    
    public class MoveListener
      implements Listener
    {
      public MoveListener() {}
    
      @EventHandler
      public void onMove(PlayerMoveEvent e)
      {
        Player p = e.getPlayer();
        if ((e.getTo().getX() == e.getFrom().getX()) || (e.getTo().getZ() == e.getFrom().getZ())) {
          return;
        }
        if (p.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.SLIME_BLOCK)
        {
          if ((p.getInventory().getHelmet() != null) && (p.getInventory().getHelmet().getType().equals(Material.CHAINMAIL_HELMET))) {
            return;
          }
          p.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 24000, 0), true);
          p.sendMessage(ChatColor.LIGHT_PURPLE + ">> " + ChatColor.WHITE + "Get Your Gas Mask!");
        }
      }
    }
    
     
  14. Offline

    StarRocket

    @Kyleyocats Here you go.
    Code:
    public class MoveListener implements Listener {
    
        @EventHandler
        public void onMove(PlayerMoveEvent e) {
            Player p = e.getPlayer();
            if (e.getTo().getX() == e.getFrom().getX() || e.getTo().getZ() == e.getFrom().getZ()) return;
            Block b = p.getLocation().getBlock().getRelative(BlockFace.DOWN);
            if(b.getType().equals(Material.MONSTER_EGGS)) {
                if (b.getData() != (byte) 2) return;
                if (p.getInventory().getHelmet() != null && p.getInventory().getHelmet().getType().equals(Material.CHAINMAIL_HELMET)) return;
                p.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 20*1200, 0), true);
            }
        }
    }
     
  15. Offline

    icedmoca

    Dude thanks!
     
Thread Status:
Not open for further replies.

Share This Page