mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-03 21:15:28 +02:00
A whole bunch of more work to convert Salvage to a child skill
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
package com.gmail.nossr50.skills.repair.repairables;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
public enum RepairItemType {
|
||||
ARMOR,
|
||||
TOOL,
|
||||
OTHER;
|
||||
|
||||
/**
|
||||
* Get the base permissions associated with this RepairItemType.
|
||||
*
|
||||
* @param player The player to check the permissions for
|
||||
* @return true if the player has permissions, false otherwise
|
||||
*/
|
||||
public boolean getPermissions(Player player) {
|
||||
switch (this) {
|
||||
case ARMOR:
|
||||
return Permissions.repairArmor(player);
|
||||
|
||||
case TOOL:
|
||||
return Permissions.repairTools(player);
|
||||
|
||||
case OTHER:
|
||||
return Permissions.repairOtherItems(player);
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,84 +0,0 @@
|
||||
package com.gmail.nossr50.skills.repair.repairables;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
public enum RepairMaterialType {
|
||||
STRING,
|
||||
LEATHER,
|
||||
WOOD,
|
||||
STONE,
|
||||
IRON,
|
||||
GOLD,
|
||||
DIAMOND,
|
||||
OTHER;
|
||||
|
||||
/**
|
||||
* Get the base permissions associated with this RepairMaterialType.
|
||||
*
|
||||
* @param player The player to check the permissions for
|
||||
*
|
||||
* @return true if the player has permissions, false otherwise
|
||||
*/
|
||||
public boolean getPermissions(Player player) {
|
||||
switch (this) {
|
||||
case STRING:
|
||||
return Permissions.repairString(player);
|
||||
|
||||
case LEATHER:
|
||||
return Permissions.repairLeather(player);
|
||||
|
||||
case WOOD:
|
||||
return Permissions.repairWood(player);
|
||||
|
||||
case STONE:
|
||||
return Permissions.repairStone(player);
|
||||
|
||||
case IRON:
|
||||
return Permissions.repairIron(player);
|
||||
|
||||
case GOLD:
|
||||
return Permissions.repairGold(player);
|
||||
|
||||
case DIAMOND:
|
||||
return Permissions.repairDiamond(player);
|
||||
|
||||
case OTHER:
|
||||
return Permissions.repairOtherMaterials(player);
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public Material getDefaultRepairMaterial() {
|
||||
switch (this) {
|
||||
case STRING:
|
||||
return Material.STRING;
|
||||
|
||||
case LEATHER:
|
||||
return Material.LEATHER;
|
||||
|
||||
case WOOD:
|
||||
return Material.WOOD;
|
||||
|
||||
case STONE:
|
||||
return Material.COBBLESTONE;
|
||||
|
||||
case IRON:
|
||||
return Material.IRON_INGOT;
|
||||
|
||||
case GOLD:
|
||||
return Material.GOLD_INGOT;
|
||||
|
||||
case DIAMOND:
|
||||
return Material.DIAMOND;
|
||||
|
||||
case OTHER:
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@@ -2,6 +2,9 @@ package com.gmail.nossr50.skills.repair.repairables;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
|
||||
|
||||
public interface Repairable {
|
||||
/**
|
||||
@@ -30,14 +33,14 @@ public interface Repairable {
|
||||
*
|
||||
* @return the RepairItemType for this repairable
|
||||
*/
|
||||
public RepairItemType getRepairItemType();
|
||||
public ItemType getRepairItemType();
|
||||
|
||||
/**
|
||||
* Gets the RepairMaterialType value for this repairable item
|
||||
*
|
||||
* @return the RepairMaterialType for this repairable
|
||||
*/
|
||||
public RepairMaterialType getRepairMaterialType();
|
||||
public MaterialType getRepairMaterialType();
|
||||
|
||||
/**
|
||||
* Gets the minimum quantity of repair materials ignoring all other repair bonuses
|
||||
|
@@ -2,13 +2,16 @@ package com.gmail.nossr50.skills.repair.repairables;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
|
||||
|
||||
public class RepairableFactory {
|
||||
public static Repairable getRepairable(Material itemMaterial, Material repairMaterial, byte repairMetadata, int minimumQuantity, short maximumDurability) {
|
||||
return getRepairable(itemMaterial, repairMaterial, repairMetadata, 0, minimumQuantity, maximumDurability, RepairItemType.OTHER, RepairMaterialType.OTHER, 1);
|
||||
return getRepairable(itemMaterial, repairMaterial, repairMetadata, 0, minimumQuantity, maximumDurability, ItemType.OTHER, MaterialType.OTHER, 1);
|
||||
}
|
||||
|
||||
public static Repairable getRepairable(Material itemMaterial, Material repairMaterial, byte repairMetadata, int minimumLevel, int minimumQuantity, short maximumDurability, RepairItemType repairItemType, RepairMaterialType repairMaterialType, double xpMultiplier) {
|
||||
public static Repairable getRepairable(Material itemMaterial, Material repairMaterial, byte repairMetadata, int minimumLevel, int minimumQuantity, short maximumDurability, ItemType repairItemType, MaterialType repairMaterialType, double xpMultiplier) {
|
||||
// TODO: Add in loading from config what type of repairable we want.
|
||||
return new SimpleRepairable(itemMaterial, repairMaterial, repairMetadata, minimumLevel, minimumQuantity, maximumDurability, repairItemType, repairMaterialType, xpMultiplier);
|
||||
}
|
||||
|
@@ -2,17 +2,20 @@ package com.gmail.nossr50.skills.repair.repairables;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
|
||||
|
||||
public class SimpleRepairable implements Repairable {
|
||||
private final Material itemMaterial, repairMaterial;
|
||||
private final int minimumQuantity, minimumLevel;
|
||||
private final short maximumDurability, baseRepairDurability;
|
||||
private final byte repairMetadata;
|
||||
private final RepairItemType repairItemType;
|
||||
private final RepairMaterialType repairMaterialType;
|
||||
private final ItemType repairItemType;
|
||||
private final MaterialType repairMaterialType;
|
||||
private final double xpMultiplier;
|
||||
|
||||
protected SimpleRepairable(Material type, Material repairMaterial, byte repairMetadata, int minimumLevel, int minimumQuantity, short maximumDurability, RepairItemType repairItemType, RepairMaterialType repairMaterialType, double xpMultiplier) {
|
||||
protected SimpleRepairable(Material type, Material repairMaterial, byte repairMetadata, int minimumLevel, int minimumQuantity, short maximumDurability, ItemType repairItemType, MaterialType repairMaterialType, double xpMultiplier) {
|
||||
this.itemMaterial = type;
|
||||
this.repairMaterial = repairMaterial;
|
||||
this.repairMetadata = repairMetadata;
|
||||
@@ -41,12 +44,12 @@ public class SimpleRepairable implements Repairable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public RepairItemType getRepairItemType() {
|
||||
public ItemType getRepairItemType() {
|
||||
return repairItemType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RepairMaterialType getRepairMaterialType() {
|
||||
public MaterialType getRepairMaterialType() {
|
||||
return repairMaterialType;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user