2023-07-26 17:56:09 +02:00
|
|
|
package com.craftaro.ultimatetimber.tree;
|
2019-03-28 05:22:13 +01:00
|
|
|
|
|
|
|
import org.bukkit.inventory.ItemStack;
|
|
|
|
|
|
|
|
public class TreeLoot {
|
|
|
|
private final TreeBlockType treeBlockType;
|
|
|
|
private final ItemStack item;
|
|
|
|
private final String command;
|
|
|
|
private final double chance;
|
|
|
|
|
|
|
|
public TreeLoot(TreeBlockType treeBlockType, ItemStack item, String command, double chance) {
|
|
|
|
this.treeBlockType = treeBlockType;
|
|
|
|
this.item = item;
|
|
|
|
this.command = command;
|
|
|
|
this.chance = chance;
|
|
|
|
}
|
|
|
|
|
2019-03-28 09:30:33 +01:00
|
|
|
/**
|
|
|
|
* Gets the tree block type this loot is for
|
|
|
|
*
|
|
|
|
* @return The tree block type this loot is for
|
|
|
|
*/
|
|
|
|
public TreeBlockType getTreeBlockType() {
|
|
|
|
return this.treeBlockType;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks if this TreeLoot has an item to drop
|
|
|
|
*
|
|
|
|
* @return True if an item exists, otherwise false
|
|
|
|
*/
|
|
|
|
public boolean hasItem() {
|
|
|
|
return this.item != null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the item that this tree loot can drop
|
|
|
|
*
|
|
|
|
* @return An ItemStack this tree loot can drop
|
|
|
|
*/
|
|
|
|
public ItemStack getItem() {
|
|
|
|
return this.item;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks if this TreeLoot has a command to run
|
|
|
|
*
|
|
|
|
* @return True if a command exists, otherwise false
|
|
|
|
*/
|
|
|
|
public boolean hasCommand() {
|
|
|
|
return this.command != null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the command that this tree loot can run
|
|
|
|
*
|
|
|
|
* @return The command that this tree loot can run
|
|
|
|
*/
|
|
|
|
public String getCommand() {
|
2019-03-29 23:52:17 +01:00
|
|
|
return this.command;
|
2019-03-28 09:30:33 +01:00
|
|
|
}
|
2019-03-28 05:22:13 +01:00
|
|
|
|
2019-03-28 09:30:33 +01:00
|
|
|
/**
|
|
|
|
* Gets the percent chance this tree loot will drop
|
|
|
|
*
|
|
|
|
* @return The percent chance this tree loot can drop
|
|
|
|
*/
|
|
|
|
public double getChance() {
|
|
|
|
return this.chance;
|
2019-03-28 05:22:13 +01:00
|
|
|
}
|
|
|
|
|
2020-10-30 21:00:23 +01:00
|
|
|
@Override
|
|
|
|
public String toString() {
|
|
|
|
return "TreeLoot{" +
|
2023-06-29 14:31:22 +02:00
|
|
|
"treeBlockType=" + this.treeBlockType +
|
|
|
|
", item=" + this.item +
|
|
|
|
", command='" + this.command + '\'' +
|
|
|
|
", chance=" + this.chance +
|
2020-10-30 21:00:23 +01:00
|
|
|
'}';
|
|
|
|
}
|
2019-03-28 05:22:13 +01:00
|
|
|
}
|