More Spout tool stuff.

This commit is contained in:
GJ 2012-06-04 10:36:24 -04:00
parent 1e58c32a5f
commit 7ada587df3
3 changed files with 47 additions and 5 deletions

View File

@ -10,7 +10,7 @@ Key:
Version 1.3.09 Version 1.3.09
+ Added compatibility with AntiCheat (Which I highly recommend to prevent cheating) + 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 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 issue with NoCheatPlus and Serrated Strikes / Skull Splitter (fight.noswing)
= Fixed bug where you could receive Archery XP from Potions = Fixed bug where you could receive Archery XP from Potions
= Fixed bug with duping blocks via piston pushing = Fixed bug with duping blocks via piston pushing

View File

@ -5,17 +5,47 @@ import java.util.List;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.datatypes.ToolType;
public class SpoutToolsAPI { public class SpoutToolsAPI {
public static List<ItemStack> spoutSwords = new ArrayList<ItemStack>(); public static List<ItemStack> spoutSwords = new ArrayList<ItemStack>();
public static List<ItemStack> spoutAxes = new ArrayList<ItemStack>();
public static List<ItemStack> spoutPickaxes = new ArrayList<ItemStack>();
public static List<ItemStack> spoutHoes = new ArrayList<ItemStack>();
public static List<ItemStack> spoutShovels = new ArrayList<ItemStack>();
/** /**
* Add a custom Spout sword to mcMMO for XP gain & ability use. * Add a custom Spout tool to mcMMO for XP gain & ability use.
* </br> * </br>
* This function is designed for API usage. * 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) { public void addCustomTool(ItemStack spoutTool, ToolType type) {
spoutSwords.add(spoutSword); 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;
}
} }
} }

View File

@ -60,6 +60,9 @@ public class ItemChecks {
if (customToolsEnabled && CustomToolsConfig.getInstance().customHoeIDs.contains(is.getTypeId())) { if (customToolsEnabled && CustomToolsConfig.getInstance().customHoeIDs.contains(is.getTypeId())) {
return true; return true;
} }
else if (mcMMO.p.spoutEnabled && SpoutToolsAPI.spoutHoes.contains(is)) {
return true;
}
else { else {
return false; return false;
} }
@ -85,6 +88,9 @@ public class ItemChecks {
if (customToolsEnabled && CustomToolsConfig.getInstance().customShovelIDs.contains(is.getTypeId())) { if (customToolsEnabled && CustomToolsConfig.getInstance().customShovelIDs.contains(is.getTypeId())) {
return true; return true;
} }
else if (mcMMO.p.spoutEnabled && SpoutToolsAPI.spoutShovels.contains(is)) {
return true;
}
else { else {
return false; return false;
} }
@ -110,6 +116,9 @@ public class ItemChecks {
if (customToolsEnabled && CustomToolsConfig.getInstance().customAxeIDs.contains(is.getTypeId())) { if (customToolsEnabled && CustomToolsConfig.getInstance().customAxeIDs.contains(is.getTypeId())) {
return true; return true;
} }
else if (mcMMO.p.spoutEnabled && SpoutToolsAPI.spoutAxes.contains(is)) {
return true;
}
else { else {
return false; return false;
} }
@ -135,6 +144,9 @@ public class ItemChecks {
if (customToolsEnabled && CustomToolsConfig.getInstance().customPickaxeIDs.contains(is.getTypeId())) { if (customToolsEnabled && CustomToolsConfig.getInstance().customPickaxeIDs.contains(is.getTypeId())) {
return true; return true;
} }
else if (mcMMO.p.spoutEnabled && SpoutToolsAPI.spoutPickaxes.contains(is)) {
return true;
}
else { else {
return false; return false;
} }