Add ItemStack with meta data
This commit is contained in:
parent
d18c504825
commit
0797d0f9eb
|
@ -0,0 +1,28 @@
|
||||||
|
package gg.wildfrontier.goldpanning;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
public class PanItem extends ItemStack{
|
||||||
|
int chance, adddelaymin, adddelaymax, removedelaymin, removedelaymax;
|
||||||
|
public PanItem(String material, int chance, int adddelaymin, int adddelaymax, int removedelaymin, int removedelaymax) {
|
||||||
|
super(Material.getMaterial(material), 1);
|
||||||
|
this.chance = chance;
|
||||||
|
this.adddelaymin = adddelaymin;
|
||||||
|
this.adddelaymax = adddelaymax;
|
||||||
|
this.removedelaymin = removedelaymin;
|
||||||
|
this.removedelaymax = removedelaymax;
|
||||||
|
|
||||||
|
}
|
||||||
|
public Boolean spawn() {
|
||||||
|
return (Math.random()*100)<chance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAddDelay() {
|
||||||
|
return (int) (Math.random()*adddelaymax+adddelaymin);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRemoveDelay() {
|
||||||
|
return (int) (Math.random()*removedelaymax+removedelaymin);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue