|
@@ -4,79 +4,124 @@ import com.gmail.nossr50.datatypes.permissions.PermissionWrapper;
|
|
|
import com.gmail.nossr50.skills.repair.RepairTransaction;
|
|
|
import com.gmail.nossr50.util.nbt.RawNBT;
|
|
|
import org.bukkit.Material;
|
|
|
+import org.bukkit.inventory.ItemStack;
|
|
|
|
|
|
public class Repairable {
|
|
|
- private final Material itemMaterial;
|
|
|
- private final int minimumLevel;
|
|
|
- private final short maximumDurability;
|
|
|
+ private final ItemStack item;
|
|
|
+ private int minimumLevel = 0;
|
|
|
+ private short maximumDurability;
|
|
|
private RepairTransaction repairTransaction;
|
|
|
- private boolean strictMatching;
|
|
|
- private int baseXP;
|
|
|
+ private boolean strictMatchingItem = false;
|
|
|
+ private boolean strictMatchingRepairTransaction = false;
|
|
|
+ private int baseXP = 0;
|
|
|
private RawNBT rawNBT;
|
|
|
- private int repairCount;
|
|
|
+ private int repairCount = 1;
|
|
|
private PermissionWrapper permissionWrapper;
|
|
|
+ private boolean hasPermission = false;
|
|
|
+ private boolean hasNBT = false;
|
|
|
|
|
|
- public Repairable(Material itemMaterial, RepairTransaction repairTransaction, int minimumLevel, int repairCount, int baseXP, RawNBT rawNBT) {
|
|
|
- this(itemMaterial.getKey().getKey(), repairTransaction, minimumLevel, repairCount, baseXP, false, rawNBT);
|
|
|
+ public Repairable(ItemStack item, int minimumLevel, short maximumDurability, RepairTransaction repairTransaction, boolean strictMatchingItem, boolean strictMatchingRepairTransaction, int baseXP, int repairCount) {
|
|
|
+ this.item = item;
|
|
|
+ this.minimumLevel = minimumLevel;
|
|
|
+ this.maximumDurability = maximumDurability;
|
|
|
+ this.repairTransaction = repairTransaction;
|
|
|
+ this.strictMatchingItem = strictMatchingItem;
|
|
|
+ this.strictMatchingRepairTransaction = strictMatchingRepairTransaction;
|
|
|
+ this.baseXP = baseXP;
|
|
|
+ this.repairCount = repairCount;
|
|
|
}
|
|
|
|
|
|
- public Repairable(Material itemMaterial, RepairTransaction repairTransaction, int minimumLevel, int repairCount, int baseXP) {
|
|
|
- this(itemMaterial.getKey().getKey(), repairTransaction, minimumLevel, repairCount, baseXP, false, null);
|
|
|
+ public ItemStack getItem() {
|
|
|
+ return item;
|
|
|
}
|
|
|
|
|
|
- public Repairable(String itemMaterial, RepairTransaction repairTransaction, int minimumLevel, int repairCount, int baseXP, boolean strictMatching, RawNBT rawNBT) {
|
|
|
- this.itemMaterial = Material.matchMaterial(itemMaterial);
|
|
|
- this.minimumLevel = Math.max(0, minimumLevel);
|
|
|
+ public int getMinimumLevel() {
|
|
|
+ return minimumLevel;
|
|
|
+ }
|
|
|
|
|
|
- this.maximumDurability = this.itemMaterial.getMaxDurability();
|
|
|
- this.repairCount = repairCount;
|
|
|
+ public void setMinimumLevel(int minimumLevel) {
|
|
|
+ this.minimumLevel = minimumLevel;
|
|
|
+ }
|
|
|
+
|
|
|
+ public short getMaximumDurability() {
|
|
|
+ return maximumDurability;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setMaximumDurability(short maximumDurability) {
|
|
|
+ this.maximumDurability = maximumDurability;
|
|
|
+ }
|
|
|
+
|
|
|
+ public RepairTransaction getRepairTransaction() {
|
|
|
+ return repairTransaction;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setRepairTransaction(RepairTransaction repairTransaction) {
|
|
|
this.repairTransaction = repairTransaction;
|
|
|
- this.strictMatching = strictMatching;
|
|
|
- this.baseXP = baseXP;
|
|
|
- this.rawNBT = rawNBT;
|
|
|
}
|
|
|
|
|
|
- public PermissionWrapper getPermissionWrapper() {
|
|
|
- return permissionWrapper;
|
|
|
+ public boolean isStrictMatchingItem() {
|
|
|
+ return strictMatchingItem;
|
|
|
}
|
|
|
|
|
|
- public void setPermissionWrapper(PermissionWrapper permissionWrapper) {
|
|
|
- this.permissionWrapper = permissionWrapper;
|
|
|
+ public void setStrictMatchingItem(boolean strictMatchingItem) {
|
|
|
+ this.strictMatchingItem = strictMatchingItem;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean isStrictMatchingRepairTransaction() {
|
|
|
+ return strictMatchingRepairTransaction;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setStrictMatchingRepairTransaction(boolean strictMatchingRepairTransaction) {
|
|
|
+ this.strictMatchingRepairTransaction = strictMatchingRepairTransaction;
|
|
|
+ }
|
|
|
+
|
|
|
+ public int getBaseXP() {
|
|
|
+ return baseXP;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setBaseXP(int baseXP) {
|
|
|
+ this.baseXP = baseXP;
|
|
|
}
|
|
|
|
|
|
public RawNBT getRawNBT() {
|
|
|
return rawNBT;
|
|
|
}
|
|
|
|
|
|
+ public void setRawNBT(RawNBT rawNBT) {
|
|
|
+ this.rawNBT = rawNBT;
|
|
|
+ hasNBT = true;
|
|
|
+ }
|
|
|
+
|
|
|
public int getRepairCount() {
|
|
|
return repairCount;
|
|
|
}
|
|
|
|
|
|
- public Material getItemMaterial() {
|
|
|
- return itemMaterial;
|
|
|
+ public void setRepairCount(int repairCount) {
|
|
|
+ this.repairCount = repairCount;
|
|
|
}
|
|
|
|
|
|
- public RepairTransaction getRepairTransaction() {
|
|
|
- return repairTransaction;
|
|
|
+ public PermissionWrapper getPermissionWrapper() {
|
|
|
+ return permissionWrapper;
|
|
|
}
|
|
|
|
|
|
- public boolean useStrictMatching() {
|
|
|
- return strictMatching;
|
|
|
+ public void setPermissionWrapper(PermissionWrapper permissionWrapper) {
|
|
|
+ this.permissionWrapper = permissionWrapper;
|
|
|
+ hasPermission = true;
|
|
|
}
|
|
|
|
|
|
- public int getBaseXP() {
|
|
|
- return baseXP;
|
|
|
+ public boolean hasPermission() {
|
|
|
+ return hasPermission;
|
|
|
}
|
|
|
|
|
|
- public short getMaximumDurability() {
|
|
|
- return maximumDurability;
|
|
|
+ public void setHasPermission(boolean hasPermission) {
|
|
|
+ this.hasPermission = hasPermission;
|
|
|
}
|
|
|
|
|
|
- public short getBaseRepairDurability() {
|
|
|
- return (short) (maximumDurability / repairCount);
|
|
|
+ public boolean hasNBT() {
|
|
|
+ return hasNBT;
|
|
|
}
|
|
|
|
|
|
- public int getMinimumLevel() {
|
|
|
- return minimumLevel;
|
|
|
+ public void setHasNBT(boolean hasNBT) {
|
|
|
+ this.hasNBT = hasNBT;
|
|
|
}
|
|
|
}
|