Incompatible operand types Item and Material?

Discussion in 'Plugin Development' started by Minecraft93, Jul 8, 2011.

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

    Minecraft93

    Im trying to return the item drop. what am i doing wrong?


    Code:
          public void onPlayerDropItem(PlayerDropItemEvent event){
    if (event.getPlayer() != null){
                      Player player = event.getPlayer();
                      player.sendMessage(ChatColor.RED + "No Littering!It Makes Lag");
                  }
    if (event.getPlayer().getItemDrop()==Material.BEDROCK){
        Player player = event.getPlayer();
        player.sendMessage(ChatColor.RED + "Illegal Items! Punishment!");
        player.isOp();player.sendMessage(player.getName() + "Dropped Illegal" + .getItemDrop());
     
  2. Offline

    DrAgonmoray

    Try this:

    if (event.getPlayer().getItemDrop().equals(Material.BEDROCK)){

    Edit: I was being stupid, go Kaikz!
     
  3. Offline

    Kaikz

    if (event.getPlayer().getItemDrop().getItemStack().getType() == Material.BEDROCK)
     
  4. Offline

    Minecraft93

    awesome thanks. so why would you need to get itemstack if your only dropping 1 block? just for reference, doesnt hurt to ask :p

    Btw .getItemDrop() is telling me its undefined for the type player
     
  5. Offline

    captainawesome7

  6. Offline

    Minecraft93

    wow cpt. im sorry im not as adept when it comes to coding. im trying to learn this and how to use the javadocs. -_-
     
  7. Offline

    DreadKyller

    getItemDrop should be event.getItemDrop()

    @captainawesome7 that was a bit extreme I'd say.
     
  8. Offline

    captainawesome7

    I would agree, but he pmed me a while ago asking why his plugin didn't work. The reason why:
    He pulled imaginary methods out of his "bum"
     
  9. Offline

    Kaikz

    An ItemStack just represents a stack of items, regardless of amount. You could make its amount -1 for infinite if you wanted.
     
Thread Status:
Not open for further replies.

Share This Page