diff --git a/Changelog.txt b/Changelog.txt index 75bee4dd8..366547bb1 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -10,7 +10,7 @@ Key: Version 1.3.09 + Added compatibility with AntiCheat (Which I highly recommend to prevent cheating) + Added several permission nodes to give individual users special perks (Double/Triple/Quadruple XP) - + Added API for plugins to add custom tools directly via Spout + + Added API for plugins to add custom tools directly via Spout - repair / abilities do not work ATM = Fixed issue with NoCheatPlus and Serrated Strikes / Skull Splitter (fight.noswing) = Fixed bug where you could receive Archery XP from Potions = Fixed bug with duping blocks via piston pushing diff --git a/src/main/java/com/gmail/nossr50/api/SpoutToolsAPI.java b/src/main/java/com/gmail/nossr50/api/SpoutToolsAPI.java index b15653a55..69af239a9 100644 --- a/src/main/java/com/gmail/nossr50/api/SpoutToolsAPI.java +++ b/src/main/java/com/gmail/nossr50/api/SpoutToolsAPI.java @@ -5,17 +5,47 @@ import java.util.List; import org.bukkit.inventory.ItemStack; +import com.gmail.nossr50.datatypes.ToolType; + public class SpoutToolsAPI { public static List spoutSwords = new ArrayList(); + public static List spoutAxes = new ArrayList(); + public static List spoutPickaxes = new ArrayList(); + public static List spoutHoes = new ArrayList(); + public static List spoutShovels = new ArrayList(); /** - * Add a custom Spout sword to mcMMO for XP gain & ability use. + * Add a custom Spout tool to mcMMO for XP gain & ability use. *
* This function is designed for API usage. * - * @param spoutSword The sword to add + * @param spoutTool The tool to add + * @param type The type of tool to add */ - public void addCustomSword(ItemStack spoutSword) { - spoutSwords.add(spoutSword); + public void addCustomTool(ItemStack spoutTool, ToolType type) { + switch (type) { + case AXE: + spoutAxes.add(spoutTool); + break; + + case HOE: + spoutHoes.add(spoutTool); + break; + + case PICKAXE: + spoutPickaxes.add(spoutTool); + break; + + case SHOVEL: + spoutShovels.add(spoutTool); + break; + + case SWORD: + spoutSwords.add(spoutTool); + break; + + default: + break; + } } } diff --git a/src/main/java/com/gmail/nossr50/util/ItemChecks.java b/src/main/java/com/gmail/nossr50/util/ItemChecks.java index e0f2fcc3e..54116e536 100644 --- a/src/main/java/com/gmail/nossr50/util/ItemChecks.java +++ b/src/main/java/com/gmail/nossr50/util/ItemChecks.java @@ -60,6 +60,9 @@ public class ItemChecks { if (customToolsEnabled && CustomToolsConfig.getInstance().customHoeIDs.contains(is.getTypeId())) { return true; } + else if (mcMMO.p.spoutEnabled && SpoutToolsAPI.spoutHoes.contains(is)) { + return true; + } else { return false; } @@ -85,6 +88,9 @@ public class ItemChecks { if (customToolsEnabled && CustomToolsConfig.getInstance().customShovelIDs.contains(is.getTypeId())) { return true; } + else if (mcMMO.p.spoutEnabled && SpoutToolsAPI.spoutShovels.contains(is)) { + return true; + } else { return false; } @@ -110,6 +116,9 @@ public class ItemChecks { if (customToolsEnabled && CustomToolsConfig.getInstance().customAxeIDs.contains(is.getTypeId())) { return true; } + else if (mcMMO.p.spoutEnabled && SpoutToolsAPI.spoutAxes.contains(is)) { + return true; + } else { return false; } @@ -135,6 +144,9 @@ public class ItemChecks { if (customToolsEnabled && CustomToolsConfig.getInstance().customPickaxeIDs.contains(is.getTypeId())) { return true; } + else if (mcMMO.p.spoutEnabled && SpoutToolsAPI.spoutPickaxes.contains(is)) { + return true; + } else { return false; }