No getTypeId?

Discussion in 'Plugin Development' started by Alkerti, Feb 23, 2014.

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

    Alkerti

    Hello, a while back (not sure what Minecraft version) getTypeId worked on my old plugin now it comes up with an error and a strike through it using the latest beta build. Any help?

    Code:
        @EventHandler
        public void onBlockPlace (BlockPlaceEvent e) {
     
            Block block = e.getBlockPlaced();
            if (block.getType().getId() == 90) {
                e.setCancelled(true);
            }
        }
      
    getId and getTypeId no longer works.

    Thanks.

    EDIT* How could I make it so I could get the material instead of getTypeId ect..

    Code:
    p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.PORTAL, 1) });
    like that.
     
  2. Offline

    L33m4n123

    .getType() will return the Material
     
  3. Offline

    mazentheamazin

    Alkerti
    Both of those methods are deprecated
     
  4. Offline

    Alkerti


    Code:
        @EventHandler
        public void onBlockPlace (BlockPlaceEvent e) {
         
            Block block = e.getBlockPlaced();
            if (block.getType().PORTAL) {
                e.setCancelled(true);
            }
        }
    Like this? still get an error.

    mazentheamazin
    L33m4n123
    Figured it out! thanks!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 6, 2016
Thread Status:
Not open for further replies.

Share This Page