how would I replace items in an inventory with another item? say I wanted to replace all fire blocks with water blocks etc. On and whhats with the inventory events? non are supported?
this should work: PHP: public void replaceInv(Player player, Material mat1, Material mat2){ ItemStack[] items = player.getInventory().getContents(); ItemStack[] blank={}; for(ItemStack stack: items){ if(stack.getType()==mat1){ stack.setType(mat2); } blank[blank.length]=stack; } player.getInventory().setContents(blank);}