问题描述:

How do I change the event.getPlayer().getEquipment().getHelmet().getTypeId() on event.getPlayer().getEquipment().getHelmet().getType() if the boolean variable = true.

public void PickupItem(PlayerPickupItemEvent event) {

Player p = event.getPlayer();

if (UraniumProtectMain.blocked.contains(event.getItem().getItemStack().getTypeId())) {

if (p.getEquipment().getHelmet() != null && p.getEquipment().getHelmet().getTypeId() == 123) {

event.setCancelled(false);

} else {

event.setCancelled(true);

}

}

}

网友答案:

i think that you are trying to change type ID boolean event.getItem().getItemStack().getTypeId() to get Type object by event.getPlayer().getEquipment().getHelmet().getType().

as i thought you trying to get type object by type ID then you can just check if type object is not equal to null that will solve your problem.

相关阅读:
Top