mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-28 03:34:43 +02:00
Rework custom tool config.
** YOU WILL NEED TO UPDATE YOUR CONFIG TO THE NEW FORMAT **
This commit is contained in:
@ -21,7 +21,9 @@ public class ItemUtils {
|
||||
* @return true if the item is a sword, false otherwise
|
||||
*/
|
||||
public static boolean isSword(ItemStack item) {
|
||||
switch (item.getType()) {
|
||||
Material type = item.getType();
|
||||
|
||||
switch (type) {
|
||||
case DIAMOND_SWORD:
|
||||
case GOLD_SWORD:
|
||||
case IRON_SWORD:
|
||||
@ -30,7 +32,7 @@ public class ItemUtils {
|
||||
return true;
|
||||
|
||||
default:
|
||||
return (Config.getInstance().getToolModsEnabled() && CustomToolConfig.getInstance().customSwordIDs.contains(item.getTypeId()));
|
||||
return (Config.getInstance().getToolModsEnabled() && CustomToolConfig.getInstance().customSwords.contains(type));
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,7 +43,9 @@ public class ItemUtils {
|
||||
* @return true if the item is a hoe, false otherwise
|
||||
*/
|
||||
public static boolean isHoe(ItemStack item) {
|
||||
switch (item.getType()) {
|
||||
Material type = item.getType();
|
||||
|
||||
switch (type) {
|
||||
case DIAMOND_HOE:
|
||||
case GOLD_HOE:
|
||||
case IRON_HOE:
|
||||
@ -50,7 +54,7 @@ public class ItemUtils {
|
||||
return true;
|
||||
|
||||
default:
|
||||
return (Config.getInstance().getToolModsEnabled() && CustomToolConfig.getInstance().customHoeIDs.contains(item.getTypeId()));
|
||||
return (Config.getInstance().getToolModsEnabled() && CustomToolConfig.getInstance().customHoes.contains(type));
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,7 +65,9 @@ public class ItemUtils {
|
||||
* @return true if the item is a shovel, false otherwise
|
||||
*/
|
||||
public static boolean isShovel(ItemStack item) {
|
||||
switch (item.getType()) {
|
||||
Material type = item.getType();
|
||||
|
||||
switch (type) {
|
||||
case DIAMOND_SPADE:
|
||||
case GOLD_SPADE:
|
||||
case IRON_SPADE:
|
||||
@ -70,7 +76,7 @@ public class ItemUtils {
|
||||
return true;
|
||||
|
||||
default:
|
||||
return (Config.getInstance().getToolModsEnabled() && CustomToolConfig.getInstance().customShovelIDs.contains(item.getTypeId()));
|
||||
return (Config.getInstance().getToolModsEnabled() && CustomToolConfig.getInstance().customShovels.contains(type));
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,7 +87,9 @@ public class ItemUtils {
|
||||
* @return true if the item is an axe, false otherwise
|
||||
*/
|
||||
public static boolean isAxe(ItemStack item) {
|
||||
switch (item.getType()) {
|
||||
Material type = item.getType();
|
||||
|
||||
switch (type) {
|
||||
case DIAMOND_AXE:
|
||||
case GOLD_AXE:
|
||||
case IRON_AXE:
|
||||
@ -90,7 +98,7 @@ public class ItemUtils {
|
||||
return true;
|
||||
|
||||
default:
|
||||
return (Config.getInstance().getToolModsEnabled() && CustomToolConfig.getInstance().customAxeIDs.contains(item.getTypeId()));
|
||||
return (Config.getInstance().getToolModsEnabled() && CustomToolConfig.getInstance().customAxes.contains(type));
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,7 +109,9 @@ public class ItemUtils {
|
||||
* @return true if the item is a pickaxe, false otherwise
|
||||
*/
|
||||
public static boolean isPickaxe(ItemStack item) {
|
||||
switch (item.getType()) {
|
||||
Material type = item.getType();
|
||||
|
||||
switch (type) {
|
||||
case DIAMOND_PICKAXE:
|
||||
case GOLD_PICKAXE:
|
||||
case IRON_PICKAXE:
|
||||
@ -110,7 +120,7 @@ public class ItemUtils {
|
||||
return true;
|
||||
|
||||
default:
|
||||
return (Config.getInstance().getToolModsEnabled() && CustomToolConfig.getInstance().customPickaxeIDs.contains(item.getTypeId()));
|
||||
return (Config.getInstance().getToolModsEnabled() && CustomToolConfig.getInstance().customPickaxes.contains(type));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ public final class ModUtils {
|
||||
* @return the tool if it exists, null otherwise
|
||||
*/
|
||||
public static CustomTool getToolFromItemStack(ItemStack item) {
|
||||
return CustomToolConfig.getInstance().customTools.get(item.getTypeId());
|
||||
return CustomToolConfig.getInstance().customToolMap.get(item.getType());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -253,7 +253,7 @@ public final class ModUtils {
|
||||
* @return true if the item is a custom tool, false otherwise
|
||||
*/
|
||||
public static boolean isCustomTool(ItemStack item) {
|
||||
if (customToolsEnabled && CustomToolConfig.getInstance().customTools.containsKey(item.getTypeId())) {
|
||||
if (customToolsEnabled && CustomToolConfig.getInstance().customTool.contains(item.getType())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user