WIP - Spout custom tool support

This commit is contained in:
GJ 2012-05-31 16:02:11 -04:00
parent c2d1909379
commit 41e9bd3cb5
3 changed files with 28 additions and 0 deletions

View File

@ -9,6 +9,7 @@ Key:
Version 1.3.09 Version 1.3.09
+ 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
= 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

@ -0,0 +1,21 @@
package com.gmail.nossr50.api;
import java.util.ArrayList;
import java.util.List;
import org.getspout.spoutapi.inventory.SpoutItemStack;
public class SpoutToolsAPI {
public static List<SpoutItemStack> spoutSwords = new ArrayList<SpoutItemStack>();
/**
* Add a custom Spout sword to mcMMO for XP gain & ability use.
* </br>
* This function is designed for API usage.
*
* @param spoutSword The sword to add
*/
public void addCustomSword(SpoutItemStack spoutSword) {
spoutSwords.add(spoutSword);
}
}

View File

@ -1,7 +1,10 @@
package com.gmail.nossr50.util; package com.gmail.nossr50.util;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.getspout.spoutapi.inventory.SpoutItemStack;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.api.SpoutToolsAPI;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.mods.CustomArmorConfig; import com.gmail.nossr50.config.mods.CustomArmorConfig;
import com.gmail.nossr50.config.mods.CustomToolsConfig; import com.gmail.nossr50.config.mods.CustomToolsConfig;
@ -30,6 +33,9 @@ public class ItemChecks {
if (customToolsEnabled && CustomToolsConfig.getInstance().customSwordIDs.contains(is.getTypeId())) { if (customToolsEnabled && CustomToolsConfig.getInstance().customSwordIDs.contains(is.getTypeId())) {
return true; return true;
} }
else if (mcMMO.p.spoutEnabled && is instanceof SpoutItemStack && SpoutToolsAPI.spoutSwords.contains((SpoutItemStack) is)) {
return true;
}
else { else {
return false; return false;
} }