Revert removing Chimaera wing.

We've decided to keep it, for now.
This commit is contained in:
TfT_02
2013-02-15 16:36:14 +01:00
parent 3d3a1abf7b
commit bc9e946618
18 changed files with 128 additions and 5 deletions

View File

@ -88,6 +88,11 @@ public class Config extends ConfigLoader {
public boolean getBlockModsEnabled() { return config.getBoolean("Mods.Block_Mods_Enabled", false); }
public boolean getEntityModsEnabled() { return config.getBoolean("Mods.Entity_Mods_Enabled", false); }
/* Items */
public int getChimaeraCost() { return config.getInt("Items.Chimaera_Wing.Feather_Cost", 10); }
public int getChimaeraItemId() { return config.getInt("Items.Chimaera_Wing.Item_ID", 288); }
public boolean getChimaeraEnabled() { return config.getBoolean("Items.Chimaera_Wing.Enabled", true); }
/* PARTY SETTINGS */
public int getAutoPartyKickInterval() { return config.getInt("Party.AutoKick_Interval", 12); }
public int getAutoPartyKickTime() { return config.getInt("Party.Old_Party_Member_Cutoff", 7); }

View File

@ -43,6 +43,7 @@ import com.gmail.nossr50.skills.utilities.AbilityType;
import com.gmail.nossr50.skills.utilities.SkillTools;
import com.gmail.nossr50.skills.utilities.SkillType;
import com.gmail.nossr50.util.BlockChecks;
import com.gmail.nossr50.util.ChimaeraWing;
import com.gmail.nossr50.util.Hardcore;
import com.gmail.nossr50.util.ItemChecks;
import com.gmail.nossr50.util.Misc;
@ -351,6 +352,8 @@ public class PlayerListener implements Listener {
SkillTools.activationCheck(player, SkillType.UNARMED);
SkillTools.activationCheck(player, SkillType.WOODCUTTING);
}
ChimaeraWing.activationCheck(player);
}
/* GREEN THUMB CHECK */
@ -373,6 +376,9 @@ public class PlayerListener implements Listener {
SkillTools.activationCheck(player, SkillType.WOODCUTTING);
}
/* ITEM CHECKS */
ChimaeraWing.activationCheck(player);
break;
case LEFT_CLICK_AIR:

View File

@ -0,0 +1,62 @@
package com.gmail.nossr50.util;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.utilities.SkillTools;
public final class ChimaeraWing {
private ChimaeraWing() {}
/**
* Check for item usage.
*
* @param player Player whose item usage to check
*/
public static void activationCheck(Player player) {
ItemStack inHand = player.getItemInHand();
if (!Config.getInstance().getChimaeraEnabled() || inHand.getTypeId() != Config.getInstance().getChimaeraItemId()) {
return;
}
PlayerProfile profile = Users.getPlayer(player).getProfile();
Block block = player.getLocation().getBlock();
int amount = inHand.getAmount();
long recentlyHurt = profile.getRecentlyHurt();
if (Permissions.chimaeraWing(player) && inHand.getTypeId() == Config.getInstance().getChimaeraItemId()) {
if (SkillTools.cooldownOver(recentlyHurt, 60, player) && amount >= Config.getInstance().getChimaeraCost()) {
player.setItemInHand(new ItemStack(Config.getInstance().getChimaeraItemId(), amount - Config.getInstance().getChimaeraCost()));
for (int y = 1; block.getY() + y < player.getWorld().getMaxHeight(); y++) {
if (!(block.getRelative(0, y, 0).getType() == Material.AIR)) {
player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Fail"));
player.teleport(block.getRelative(0, y - 1, 0).getLocation());
return;
}
}
if (player.getBedSpawnLocation() != null && player.getBedSpawnLocation().getBlock().getType() == Material.BED_BLOCK) {
player.teleport(player.getBedSpawnLocation());
}
else {
player.teleport(player.getWorld().getSpawnLocation());
}
player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Pass"));
}
else if (!SkillTools.cooldownOver(recentlyHurt, 60, player) && amount >= Config.getInstance().getChimaeraCost()) {
player.sendMessage(LocaleLoader.getString("Item.Injured.Wait", SkillTools.calculateTimeLeft(recentlyHurt, 60, player)));
}
else if (amount <= Config.getInstance().getChimaeraCost()) {
player.sendMessage(LocaleLoader.getString("Skills.NeedMore", StringUtils.getPrettyItemString(Config.getInstance().getChimaeraItemId())));
}
}
}
}

View File

@ -570,6 +570,14 @@ public final class Permissions {
return player.hasPermission("mcmmo.ability.smelting.vanillaxpboost");
}
/*
* MCMMO.ITEM.*
*/
public static boolean chimaeraWing(Player player) {
return hasPermission(player, "mcmmo.item.chimaerawing");
}
/*
* MCMMO.COMMANDS.*
*/