mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Use doubles in config.yml where appropriate. Change item IDs to item names
in light of upcoming Minecraft changes that will remove access to item IDs.
This commit is contained in:
parent
800a452d62
commit
4eba33a1c6
@ -92,8 +92,8 @@ public class Config extends AutoUpdateConfigLoader {
|
|||||||
reason.add("Items.Chimaera_Wing.Recipe_Cost only accepts values from 1 to 64!");
|
reason.add("Items.Chimaera_Wing.Recipe_Cost only accepts values from 1 to 64!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getChimaeraItemId() < 1) {
|
if (getChimaeraItem() == null) {
|
||||||
reason.add("Items.Chimaera_Wing.Item_ID should be at least 1!");
|
reason.add("Items.Chimaera_Wing.Item_Name is invalid!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Particles */
|
/* Particles */
|
||||||
@ -135,21 +135,20 @@ public class Config extends AutoUpdateConfigLoader {
|
|||||||
reason.add("Abilities.Limits.Tree_Feller_Threshold should be greater than 0!");
|
reason.add("Abilities.Limits.Tree_Feller_Threshold should be greater than 0!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (getDetonatorItem() == null) {
|
||||||
if (getDetonatorItemID() < 1) {
|
reason.add("Skills.Mining.Detonator_Item is invalid!");
|
||||||
reason.add("Skills.Mining.Detonator_ID should be at least 1!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getRepairAnvilId() < 1) {
|
if (getRepairAnvilMaterial() == null) {
|
||||||
reason.add("Skills.Repair.Anvil_ID should be at least 1!");
|
reason.add("Skills.Repair.Anvil_Type is invalid!!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getSalvageAnvilId() < 1) {
|
if (getSalvageAnvilMaterial() == null) {
|
||||||
reason.add("Skills.Repair.Salvage_Anvil_ID should be at least 1!");
|
reason.add("Skills.Repair.Salvage_Anvil_Type is invalid!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getRepairAnvilId() == getSalvageAnvilId()) {
|
if (getRepairAnvilMaterial() == getSalvageAnvilMaterial()) {
|
||||||
reason.add("Cannot use the same item ID for Repair and Salvage anvils!");
|
reason.add("Cannot use the same item for Repair and Salvage anvils!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getTamingCOTWWolfCost() < 1) {
|
if (getTamingCOTWWolfCost() < 1) {
|
||||||
@ -265,13 +264,13 @@ public class Config extends AutoUpdateConfigLoader {
|
|||||||
public boolean getHardcoreStatLossEnabled(SkillType skillType) { return config.getBoolean("Hardcore.Death_Stat_Loss.Enabled." + StringUtils.getCapitalized(skillType.toString()), false); }
|
public boolean getHardcoreStatLossEnabled(SkillType skillType) { return config.getBoolean("Hardcore.Death_Stat_Loss.Enabled." + StringUtils.getCapitalized(skillType.toString()), false); }
|
||||||
public void setHardcoreStatLossEnabled(SkillType skillType, boolean enabled) { config.set("Hardcore.Death_Stat_Loss.Enabled." + StringUtils.getCapitalized(skillType.toString()), enabled); }
|
public void setHardcoreStatLossEnabled(SkillType skillType, boolean enabled) { config.set("Hardcore.Death_Stat_Loss.Enabled." + StringUtils.getCapitalized(skillType.toString()), enabled); }
|
||||||
|
|
||||||
public double getHardcoreDeathStatPenaltyPercentage() { return config.getDouble("Hardcore.Death_Stat_Loss.Penalty_Percentage", 75.0); }
|
public double getHardcoreDeathStatPenaltyPercentage() { return config.getDouble("Hardcore.Death_Stat_Loss.Penalty_Percentage", 75.0D); }
|
||||||
public void setHardcoreDeathStatPenaltyPercentage(double value) { config.set("Hardcore.Death_Stat_Loss.Penalty_Percentage", value); }
|
public void setHardcoreDeathStatPenaltyPercentage(double value) { config.set("Hardcore.Death_Stat_Loss.Penalty_Percentage", value); }
|
||||||
|
|
||||||
public boolean getHardcoreVampirismEnabled(SkillType skillType) { return config.getBoolean("Hardcore.Vampirism.Enabled." + StringUtils.getCapitalized(skillType.toString()), false); }
|
public boolean getHardcoreVampirismEnabled(SkillType skillType) { return config.getBoolean("Hardcore.Vampirism.Enabled." + StringUtils.getCapitalized(skillType.toString()), false); }
|
||||||
public void setHardcoreVampirismEnabled(SkillType skillType, boolean enabled) { config.set("Hardcore.Vampirism.Enabled." + StringUtils.getCapitalized(skillType.toString()), enabled); }
|
public void setHardcoreVampirismEnabled(SkillType skillType, boolean enabled) { config.set("Hardcore.Vampirism.Enabled." + StringUtils.getCapitalized(skillType.toString()), enabled); }
|
||||||
|
|
||||||
public double getHardcoreVampirismStatLeechPercentage() { return config.getDouble("Hardcore.Vampirism.Leech_Percentage", 5.0); }
|
public double getHardcoreVampirismStatLeechPercentage() { return config.getDouble("Hardcore.Vampirism.Leech_Percentage", 5.0D); }
|
||||||
public void setHardcoreVampirismStatLeechPercentage(double value) { config.set("Hardcore.Vampirism.Leech_Percentage", value); }
|
public void setHardcoreVampirismStatLeechPercentage(double value) { config.set("Hardcore.Vampirism.Leech_Percentage", value); }
|
||||||
|
|
||||||
/* SMP Mods */
|
/* SMP Mods */
|
||||||
@ -283,7 +282,7 @@ public class Config extends AutoUpdateConfigLoader {
|
|||||||
/* Items */
|
/* Items */
|
||||||
public int getChimaeraUseCost() { return config.getInt("Items.Chimaera_Wing.Use_Cost", 1); }
|
public int getChimaeraUseCost() { return config.getInt("Items.Chimaera_Wing.Use_Cost", 1); }
|
||||||
public int getChimaeraRecipeCost() { return config.getInt("Items.Chimaera_Wing.Recipe_Cost", 5); }
|
public int getChimaeraRecipeCost() { return config.getInt("Items.Chimaera_Wing.Recipe_Cost", 5); }
|
||||||
public int getChimaeraItemId() { return config.getInt("Items.Chimaera_Wing.Item_ID", 288); }
|
public Material getChimaeraItem() { return Material.matchMaterial(config.getString("Items.Chimaera_Wing.Item_Name", "Feather")); }
|
||||||
public boolean getChimaeraEnabled() { return config.getBoolean("Items.Chimaera_Wing.Enabled", true); }
|
public boolean getChimaeraEnabled() { return config.getBoolean("Items.Chimaera_Wing.Enabled", true); }
|
||||||
public boolean getChimaeraPreventUseUnderground() { return config.getBoolean("Items.Chimaera_Wing.Prevent_Use_Underground", true); }
|
public boolean getChimaeraPreventUseUnderground() { return config.getBoolean("Items.Chimaera_Wing.Prevent_Use_Underground", true); }
|
||||||
public int getChimaeraCooldown() { return config.getInt("Items.Chimaera_Wing.Cooldown", 240); }
|
public int getChimaeraCooldown() { return config.getInt("Items.Chimaera_Wing.Cooldown", 240); }
|
||||||
@ -304,11 +303,11 @@ public class Config extends AutoUpdateConfigLoader {
|
|||||||
public int getAutoPartyKickInterval() { return config.getInt("Party.AutoKick_Interval", 12); }
|
public int getAutoPartyKickInterval() { return config.getInt("Party.AutoKick_Interval", 12); }
|
||||||
public int getAutoPartyKickTime() { return config.getInt("Party.Old_Party_Member_Cutoff", 7); }
|
public int getAutoPartyKickTime() { return config.getInt("Party.Old_Party_Member_Cutoff", 7); }
|
||||||
public boolean getExpShareEnabled() { return config.getBoolean("Party.Sharing.ExpShare_enabled", true); }
|
public boolean getExpShareEnabled() { return config.getBoolean("Party.Sharing.ExpShare_enabled", true); }
|
||||||
public double getPartyShareBonusBase() { return config.getDouble("Party.Sharing.ExpShare_bonus_base", 1.1); }
|
public double getPartyShareBonusBase() { return config.getDouble("Party.Sharing.ExpShare_bonus_base", 1.1D); }
|
||||||
public double getPartyShareBonusIncrease() { return config.getDouble("Party.Sharing.ExpShare_bonus_increase", 0.05); }
|
public double getPartyShareBonusIncrease() { return config.getDouble("Party.Sharing.ExpShare_bonus_increase", 0.05D); }
|
||||||
public double getPartyShareBonusCap() { return config.getDouble("Party.Sharing.ExpShare_bonus_cap", 1.5); }
|
public double getPartyShareBonusCap() { return config.getDouble("Party.Sharing.ExpShare_bonus_cap", 1.5D); }
|
||||||
public boolean getItemShareEnabled() { return config.getBoolean("Party.Sharing.ItemShare_enabled", true); }
|
public boolean getItemShareEnabled() { return config.getBoolean("Party.Sharing.ItemShare_enabled", true); }
|
||||||
public double getPartyShareRange() { return config.getDouble("Party.Sharing.Range", 75.0); }
|
public double getPartyShareRange() { return config.getDouble("Party.Sharing.Range", 75.0D); }
|
||||||
|
|
||||||
/* Party Teleport Settings */
|
/* Party Teleport Settings */
|
||||||
public int getPTPCommandCooldown() { return config.getInt("Commands.ptp.Cooldown", 120); }
|
public int getPTPCommandCooldown() { return config.getInt("Commands.ptp.Cooldown", 120); }
|
||||||
@ -319,7 +318,7 @@ public class Config extends AutoUpdateConfigLoader {
|
|||||||
public boolean getPTPCommandWorldPermissions() { return config.getBoolean("Commands.ptp.World_Based_Permissions", false); }
|
public boolean getPTPCommandWorldPermissions() { return config.getBoolean("Commands.ptp.World_Based_Permissions", false); }
|
||||||
|
|
||||||
/* Inspect command distance */
|
/* Inspect command distance */
|
||||||
public double getInspectDistance() { return config.getDouble("Commands.inspect.Max_Distance", 30); }
|
public double getInspectDistance() { return config.getDouble("Commands.inspect.Max_Distance", 30.0D); }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ABILITY SETTINGS
|
* ABILITY SETTINGS
|
||||||
@ -368,12 +367,12 @@ public class Config extends AutoUpdateConfigLoader {
|
|||||||
public boolean getFishingDropsEnabled() { return config.getBoolean("Skills.Fishing.Drops_Enabled", true); }
|
public boolean getFishingDropsEnabled() { return config.getBoolean("Skills.Fishing.Drops_Enabled", true); }
|
||||||
|
|
||||||
/* Mining */
|
/* Mining */
|
||||||
public int getDetonatorItemID() { return config.getInt("Skills.Mining.Detonator_ID", 259); }
|
public Material getDetonatorItem() { return Material.matchMaterial(config.getString("Skills.Mining.Detonator_Name", "FLINT_AND_STEEL")); }
|
||||||
|
|
||||||
/* Repair */
|
/* Repair */
|
||||||
public boolean getRepairAnvilMessagesEnabled() { return config.getBoolean("Skills.Repair.Anvil_Messages", true); }
|
public boolean getRepairAnvilMessagesEnabled() { return config.getBoolean("Skills.Repair.Anvil_Messages", true); }
|
||||||
public int getRepairAnvilId() { return config.getInt("Skills.Repair.Anvil_ID", 42); }
|
public Material getRepairAnvilMaterial() { return Material.matchMaterial(config.getString("Skills.Repair.Anvil_Material", "IRON_BLOCK")); }
|
||||||
public int getSalvageAnvilId() { return config.getInt("Skills.Repair.Salvage_Anvil_ID", 41); }
|
public Material getSalvageAnvilMaterial() { return Material.matchMaterial(config.getString("Skills.Repair.Salvage_Anvil_ID", "GOLD_BLOCK")); }
|
||||||
public boolean getSalvageTools() { return config.getBoolean("Skills.Repair.Salvage_tools", true); }
|
public boolean getSalvageTools() { return config.getBoolean("Skills.Repair.Salvage_tools", true); }
|
||||||
public boolean getSalvageArmor() { return config.getBoolean("Skills.Repair.Salvage_armor", true); }
|
public boolean getSalvageArmor() { return config.getBoolean("Skills.Repair.Salvage_armor", true); }
|
||||||
public boolean getRepairConfirmRequired() { return config.getBoolean("Skills.Repair.Confirm_Required", true); }
|
public boolean getRepairConfirmRequired() { return config.getBoolean("Skills.Repair.Confirm_Required", true); }
|
||||||
@ -385,7 +384,7 @@ public class Config extends AutoUpdateConfigLoader {
|
|||||||
public int getTamingCOTWHorseCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Apples_Required", 10); }
|
public int getTamingCOTWHorseCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Apples_Required", 10); }
|
||||||
public int getTamingCOTWWolfCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Bones_Required", 10); }
|
public int getTamingCOTWWolfCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Bones_Required", 10); }
|
||||||
public int getTamingCOTWOcelotCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Fish_Required", 10); }
|
public int getTamingCOTWOcelotCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Fish_Required", 10); }
|
||||||
public double getTamingCOTWRange() { return config.getDouble("Skills.Taming.Call_Of_The_Wild.Range", 40); }
|
public double getTamingCOTWRange() { return config.getDouble("Skills.Taming.Call_Of_The_Wild.Range", 40.0D); }
|
||||||
public int getTamingCOTWAmount(EntityType type) { return config.getInt("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type)+ "_Amount"); }
|
public int getTamingCOTWAmount(EntityType type) { return config.getInt("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type)+ "_Amount"); }
|
||||||
|
|
||||||
/* Woodcutting */
|
/* Woodcutting */
|
||||||
|
@ -6,6 +6,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
@ -358,24 +359,24 @@ public class McMMOPlayer {
|
|||||||
* Repair Anvil Placement
|
* Repair Anvil Placement
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public boolean getPlacedAnvil(int anvilId) {
|
public boolean getPlacedAnvil(Material anvilType) {
|
||||||
if (anvilId == Repair.repairAnvilId) {
|
if (anvilType == Repair.repairAnvilMaterial) {
|
||||||
return placedRepairAnvil;
|
return placedRepairAnvil;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (anvilId == Repair.salvageAnvilId) {
|
if (anvilType == Repair.salvageAnvilMaterial) {
|
||||||
return placedSalvageAnvil;
|
return placedSalvageAnvil;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void togglePlacedAnvil(int anvilId) {
|
public void togglePlacedAnvil(Material anvilType) {
|
||||||
if (anvilId == Repair.repairAnvilId) {
|
if (anvilType == Repair.repairAnvilMaterial) {
|
||||||
placedRepairAnvil = !placedRepairAnvil;
|
placedRepairAnvil = !placedRepairAnvil;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (anvilId == Repair.salvageAnvilId) {
|
if (anvilType == Repair.salvageAnvilMaterial) {
|
||||||
placedSalvageAnvil = !placedSalvageAnvil;
|
placedSalvageAnvil = !placedSalvageAnvil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -384,34 +385,34 @@ public class McMMOPlayer {
|
|||||||
* Repair Anvil Usage
|
* Repair Anvil Usage
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public int getLastAnvilUse(int anvilId) {
|
public int getLastAnvilUse(Material anvilType) {
|
||||||
if (anvilId == Repair.repairAnvilId) {
|
if (anvilType == Repair.repairAnvilMaterial) {
|
||||||
return lastRepairClick;
|
return lastRepairClick;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (anvilId == Repair.salvageAnvilId) {
|
if (anvilType == Repair.salvageAnvilMaterial) {
|
||||||
return lastSalvageClick;
|
return lastSalvageClick;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLastAnvilUse(int anvilId, int value) {
|
public void setLastAnvilUse(Material anvilType, int value) {
|
||||||
if (anvilId == Repair.repairAnvilId) {
|
if (anvilType == Repair.repairAnvilMaterial) {
|
||||||
lastRepairClick = value;
|
lastRepairClick = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (anvilId == Repair.salvageAnvilId) {
|
if (anvilType == Repair.salvageAnvilMaterial) {
|
||||||
lastSalvageClick = value;
|
lastSalvageClick = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void actualizeLastAnvilUse(int anvilId) {
|
public void actualizeLastAnvilUse(Material anvilType) {
|
||||||
if (anvilId == Repair.repairAnvilId) {
|
if (anvilType == Repair.repairAnvilMaterial) {
|
||||||
lastRepairClick = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
lastRepairClick = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (anvilId == Repair.salvageAnvilId) {
|
if (anvilType == Repair.salvageAnvilMaterial) {
|
||||||
lastSalvageClick = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
lastSalvageClick = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ public class BlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Repair.anvilMessagesEnabled && BlockUtils.isMcMMOAnvil(blockState)) {
|
if (Repair.anvilMessagesEnabled && BlockUtils.isMcMMOAnvil(blockState)) {
|
||||||
UserManager.getPlayer(player).getRepairManager().placedAnvilCheck(blockState.getTypeId());
|
UserManager.getPlayer(player).getRepairManager().placedAnvilCheck(blockState.getType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -418,27 +418,27 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
switch (event.getAction()) {
|
switch (event.getAction()) {
|
||||||
case RIGHT_CLICK_BLOCK:
|
case RIGHT_CLICK_BLOCK:
|
||||||
int blockID = block.getTypeId();
|
Material type = block.getType();
|
||||||
|
|
||||||
if (!Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() || player.isSneaking()) {
|
if (!Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() || player.isSneaking()) {
|
||||||
/* REPAIR CHECKS */
|
/* REPAIR CHECKS */
|
||||||
if (blockID == Repair.repairAnvilId && Permissions.skillEnabled(player, SkillType.REPAIR) && mcMMO.getRepairableManager().isRepairable(heldItem)) {
|
if (type == Repair.repairAnvilMaterial && Permissions.skillEnabled(player, SkillType.REPAIR) && mcMMO.getRepairableManager().isRepairable(heldItem)) {
|
||||||
RepairManager repairManager = mcMMOPlayer.getRepairManager();
|
RepairManager repairManager = mcMMOPlayer.getRepairManager();
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
// Make sure the player knows what he's doing when trying to repair an enchanted item
|
// Make sure the player knows what he's doing when trying to repair an enchanted item
|
||||||
if (!(heldItem.getEnchantments().size() > 0) || repairManager.checkConfirmation(blockID, true)) {
|
if (!(heldItem.getEnchantments().size() > 0) || repairManager.checkConfirmation(type, true)) {
|
||||||
repairManager.handleRepair(heldItem);
|
repairManager.handleRepair(heldItem);
|
||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* SALVAGE CHECKS */
|
/* SALVAGE CHECKS */
|
||||||
else if (blockID == Repair.salvageAnvilId && Permissions.salvage(player) && Repair.isSalvageable(heldItem)) {
|
else if (type == Repair.salvageAnvilMaterial && Permissions.salvage(player) && Repair.isSalvageable(heldItem)) {
|
||||||
RepairManager repairManager = mcMMOPlayer.getRepairManager();
|
RepairManager repairManager = mcMMOPlayer.getRepairManager();
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
// Make sure the player knows what he's doing when trying to salvage an enchanted item
|
// Make sure the player knows what he's doing when trying to salvage an enchanted item
|
||||||
if (!(heldItem.getEnchantments().size() > 0) || repairManager.checkConfirmation(blockID, true)) {
|
if (!(heldItem.getEnchantments().size() > 0) || repairManager.checkConfirmation(type, true)) {
|
||||||
repairManager.handleSalvage(block.getLocation(), heldItem);
|
repairManager.handleSalvage(block.getLocation(), heldItem);
|
||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
}
|
}
|
||||||
@ -446,7 +446,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
/* BLAST MINING CHECK */
|
/* BLAST MINING CHECK */
|
||||||
else if (miningManager.canDetonate()) {
|
else if (miningManager.canDetonate()) {
|
||||||
if (block.getType() == Material.TNT) {
|
if (type == Material.TNT) {
|
||||||
event.setCancelled(true); // Don't detonate the TNT if they're too close
|
event.setCancelled(true); // Don't detonate the TNT if they're too close
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -457,26 +457,26 @@ public class PlayerListener implements Listener {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LEFT_CLICK_BLOCK:
|
case LEFT_CLICK_BLOCK:
|
||||||
blockID = block.getTypeId();
|
type = block.getType();
|
||||||
|
|
||||||
if ((Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() && player.isSneaking()) || !Config.getInstance().getAbilitiesOnlyActivateWhenSneaking()) {
|
if ((Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() && player.isSneaking()) || !Config.getInstance().getAbilitiesOnlyActivateWhenSneaking()) {
|
||||||
/* REPAIR CHECKS */
|
/* REPAIR CHECKS */
|
||||||
if (blockID == Repair.repairAnvilId && Permissions.skillEnabled(player, SkillType.REPAIR) && mcMMO.getRepairableManager().isRepairable(heldItem)) {
|
if (type == Repair.repairAnvilMaterial && Permissions.skillEnabled(player, SkillType.REPAIR) && mcMMO.getRepairableManager().isRepairable(heldItem)) {
|
||||||
RepairManager repairManager = mcMMOPlayer.getRepairManager();
|
RepairManager repairManager = mcMMOPlayer.getRepairManager();
|
||||||
|
|
||||||
// Cancel repairing an enchanted item
|
// Cancel repairing an enchanted item
|
||||||
if (repairManager.checkConfirmation(blockID, false) && Config.getInstance().getRepairConfirmRequired()) {
|
if (repairManager.checkConfirmation(type, false) && Config.getInstance().getRepairConfirmRequired()) {
|
||||||
mcMMOPlayer.setLastAnvilUse(Repair.repairAnvilId, 0);
|
mcMMOPlayer.setLastAnvilUse(Repair.repairAnvilMaterial, 0);
|
||||||
player.sendMessage(LocaleLoader.getString("Skills.Cancelled", LocaleLoader.getString("Repair.Pretty.Name")));
|
player.sendMessage(LocaleLoader.getString("Skills.Cancelled", LocaleLoader.getString("Repair.Pretty.Name")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* SALVAGE CHECKS */
|
/* SALVAGE CHECKS */
|
||||||
else if (blockID == Repair.salvageAnvilId && Permissions.salvage(player) && Repair.isSalvageable(heldItem)) {
|
else if (type == Repair.salvageAnvilMaterial && Permissions.salvage(player) && Repair.isSalvageable(heldItem)) {
|
||||||
RepairManager repairManager = mcMMOPlayer.getRepairManager();
|
RepairManager repairManager = mcMMOPlayer.getRepairManager();
|
||||||
|
|
||||||
// Cancel salvaging an enchanted item
|
// Cancel salvaging an enchanted item
|
||||||
if (repairManager.checkConfirmation(blockID, false) && Config.getInstance().getRepairConfirmRequired()) {
|
if (repairManager.checkConfirmation(type, false) && Config.getInstance().getRepairConfirmRequired()) {
|
||||||
mcMMOPlayer.setLastAnvilUse(Repair.salvageAnvilId, 0);
|
mcMMOPlayer.setLastAnvilUse(Repair.salvageAnvilMaterial, 0);
|
||||||
player.sendMessage(LocaleLoader.getString("Skills.Cancelled", LocaleLoader.getString("Salvage.Pretty.Name")));
|
player.sendMessage(LocaleLoader.getString("Skills.Cancelled", LocaleLoader.getString("Salvage.Pretty.Name")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.gmail.nossr50.skills.mining;
|
package com.gmail.nossr50.skills.mining;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
|
|
||||||
@ -81,7 +83,7 @@ public class BlastMining {
|
|||||||
abstract protected int getDropMultiplier();
|
abstract protected int getDropMultiplier();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int detonatorID = Config.getInstance().getDetonatorItemID();
|
public static Material detonator = Config.getInstance().getDetonatorItem();
|
||||||
|
|
||||||
public final static int MAXIMUM_REMOTE_DETONATION_DISTANCE = 100;
|
public final static int MAXIMUM_REMOTE_DETONATION_DISTANCE = 100;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ public class MiningManager extends SkillManager {
|
|||||||
public boolean canDetonate() {
|
public boolean canDetonate() {
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
|
|
||||||
return canUseBlastMining() && player.isSneaking() && player.getItemInHand().getTypeId() == BlastMining.detonatorID && Permissions.remoteDetonation(player);
|
return canUseBlastMining() && player.isSneaking() && player.getItemInHand().getType() == BlastMining.detonator && Permissions.remoteDetonation(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUseBlastMining() {
|
public boolean canUseBlastMining() {
|
||||||
|
@ -19,9 +19,9 @@ public class Repair {
|
|||||||
|
|
||||||
public static int salvageUnlockLevel = AdvancedConfig.getInstance().getSalvageUnlockLevel();
|
public static int salvageUnlockLevel = AdvancedConfig.getInstance().getSalvageUnlockLevel();
|
||||||
|
|
||||||
public static int salvageAnvilId = Config.getInstance().getSalvageAnvilId();
|
public static Material salvageAnvilMaterial = Config.getInstance().getSalvageAnvilMaterial();
|
||||||
public static int repairAnvilId = Config.getInstance().getRepairAnvilId();
|
public static Material repairAnvilMaterial = Config.getInstance().getRepairAnvilMaterial();
|
||||||
public static boolean anvilMessagesEnabled = Config.getInstance().getRepairAnvilMessagesEnabled();
|
public static boolean anvilMessagesEnabled = Config.getInstance().getRepairAnvilMessagesEnabled();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the item is salvageable.
|
* Checks if the item is salvageable.
|
||||||
@ -41,25 +41,25 @@ public class Repair {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getAnvilMessage(int blockId) {
|
public static String getAnvilMessage(Material type) {
|
||||||
if (blockId == repairAnvilId) {
|
if (type == repairAnvilMaterial) {
|
||||||
return LocaleLoader.getString("Repair.Listener.Anvil");
|
return LocaleLoader.getString("Repair.Listener.Anvil");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blockId == salvageAnvilId) {
|
if (type == salvageAnvilMaterial) {
|
||||||
return LocaleLoader.getString("Repair.Listener.Anvil2");
|
return LocaleLoader.getString("Repair.Listener.Anvil2");
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String[] getSpoutAnvilMessages(int blockId) {
|
public static String[] getSpoutAnvilMessages(Material type) {
|
||||||
if (blockId == repairAnvilId) {
|
if (type == repairAnvilMaterial) {
|
||||||
return new String[] {LocaleLoader.getString("Repair.AnvilPlaced.Spout1"), LocaleLoader.getString("Repair.AnvilPlaced.Spout2")};
|
return new String[] {LocaleLoader.getString("Repair.AnvilPlaced.Spout1"), LocaleLoader.getString("Repair.AnvilPlaced.Spout2")};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blockId == salvageAnvilId) {
|
if (type == salvageAnvilMaterial) {
|
||||||
return new String[] {"[mcMMO] Anvil Placed", "Right click to salvage!"};
|
return new String[] {"[mcMMO] Anvil Placed", "Right click to salvage!"}; //TODO: Localize
|
||||||
}
|
}
|
||||||
|
|
||||||
return new String[] {"", ""};
|
return new String[] {"", ""};
|
||||||
|
@ -37,22 +37,22 @@ public class RepairManager extends SkillManager {
|
|||||||
*
|
*
|
||||||
* @param anvilId The item ID of the anvil block
|
* @param anvilId The item ID of the anvil block
|
||||||
*/
|
*/
|
||||||
public void placedAnvilCheck(int anvilId) {
|
public void placedAnvilCheck(Material anvilType) {
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
|
|
||||||
if (mcMMOPlayer.getPlacedAnvil(anvilId)) {
|
if (mcMMOPlayer.getPlacedAnvil(anvilType)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mcMMO.isSpoutEnabled()) {
|
if (mcMMO.isSpoutEnabled()) {
|
||||||
SpoutUtils.sendRepairNotifications(player, anvilId);
|
SpoutUtils.sendRepairNotifications(player, anvilType);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
player.sendMessage(Repair.getAnvilMessage(anvilId));
|
player.sendMessage(Repair.getAnvilMessage(anvilType));
|
||||||
}
|
}
|
||||||
|
|
||||||
player.playSound(player.getLocation(), Sound.ANVIL_LAND, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
|
player.playSound(player.getLocation(), Sound.ANVIL_LAND, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
|
||||||
mcMMOPlayer.togglePlacedAnvil(anvilId);
|
mcMMOPlayer.togglePlacedAnvil(anvilType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleRepair(ItemStack item) {
|
public void handleRepair(ItemStack item) {
|
||||||
@ -196,10 +196,10 @@ public class RepairManager extends SkillManager {
|
|||||||
*
|
*
|
||||||
* @return true if the player has confirmed using an Anvil
|
* @return true if the player has confirmed using an Anvil
|
||||||
*/
|
*/
|
||||||
public boolean checkConfirmation(int anvilId, boolean actualize) {
|
public boolean checkConfirmation(Material anvilType, boolean actualize) {
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
long lastUse = mcMMOPlayer.getLastAnvilUse(anvilId);
|
long lastUse = mcMMOPlayer.getLastAnvilUse(anvilType);
|
||||||
|
|
||||||
// Don't use SkillUtils.cooldownOver() here since that also accounts for the cooldown perks
|
// Don't use SkillUtils.cooldownOver() here since that also accounts for the cooldown perks
|
||||||
if ((((lastUse + 3) * Misc.TIME_CONVERSION_FACTOR) >= System.currentTimeMillis()) || !Config.getInstance().getRepairConfirmRequired()) {
|
if ((((lastUse + 3) * Misc.TIME_CONVERSION_FACTOR) >= System.currentTimeMillis()) || !Config.getInstance().getRepairConfirmRequired()) {
|
||||||
@ -210,12 +210,12 @@ public class RepairManager extends SkillManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMOPlayer.actualizeLastAnvilUse(anvilId);
|
mcMMOPlayer.actualizeLastAnvilUse(anvilType);
|
||||||
|
|
||||||
if (anvilId == Repair.repairAnvilId) {
|
if (anvilType == Repair.repairAnvilMaterial) {
|
||||||
player.sendMessage(LocaleLoader.getString("Skills.ConfirmOrCancel", LocaleLoader.getString("Repair.Pretty.Name")));
|
player.sendMessage(LocaleLoader.getString("Skills.ConfirmOrCancel", LocaleLoader.getString("Repair.Pretty.Name")));
|
||||||
}
|
}
|
||||||
else if (anvilId == Repair.salvageAnvilId) {
|
else if (anvilType == Repair.salvageAnvilMaterial) {
|
||||||
player.sendMessage(LocaleLoader.getString("Skills.ConfirmOrCancel", LocaleLoader.getString("Salvage.Pretty.Name")));
|
player.sendMessage(LocaleLoader.getString("Skills.ConfirmOrCancel", LocaleLoader.getString("Salvage.Pretty.Name")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,9 +318,9 @@ public final class BlockUtils {
|
|||||||
* @return true if the block is an mcMMO anvil, false otherwise
|
* @return true if the block is an mcMMO anvil, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean isMcMMOAnvil(BlockState blockState) {
|
public static boolean isMcMMOAnvil(BlockState blockState) {
|
||||||
int blockId = blockState.getTypeId();
|
Material type = blockState.getType();
|
||||||
|
|
||||||
return blockId == Repair.repairAnvilId || blockId == Repair.salvageAnvilId;
|
return type == Repair.repairAnvilMaterial || type == Repair.salvageAnvilMaterial;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -142,7 +142,7 @@ public final class ChimaeraWing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack getChimaeraWing(int amount) {
|
public static ItemStack getChimaeraWing(int amount) {
|
||||||
ItemStack itemStack = new ItemStack(Config.getInstance().getChimaeraItemId(), amount);
|
ItemStack itemStack = new ItemStack(Config.getInstance().getChimaeraItem(), amount);
|
||||||
|
|
||||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||||
itemMeta.setDisplayName(ChatColor.GOLD + LocaleLoader.getString("Item.ChimaeraWing.Name"));
|
itemMeta.setDisplayName(ChatColor.GOLD + LocaleLoader.getString("Item.ChimaeraWing.Name"));
|
||||||
@ -157,7 +157,7 @@ public final class ChimaeraWing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ShapelessRecipe getChimaeraWingRecipe() {
|
public static ShapelessRecipe getChimaeraWingRecipe() {
|
||||||
Material ingredient = Material.getMaterial(Config.getInstance().getChimaeraItemId());
|
Material ingredient = Config.getInstance().getChimaeraItem();
|
||||||
int amount = Config.getInstance().getChimaeraRecipeCost();
|
int amount = Config.getInstance().getChimaeraRecipeCost();
|
||||||
if (amount < 1 || amount > 9) {
|
if (amount < 1 || amount > 9) {
|
||||||
amount = 9;
|
amount = 9;
|
||||||
|
@ -449,15 +449,15 @@ public class SpoutUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendRepairNotifications(Player player, int anvilId) {
|
public static void sendRepairNotifications(Player player, Material anvilType) {
|
||||||
SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player);
|
SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player);
|
||||||
|
|
||||||
if (spoutPlayer.isSpoutCraftEnabled()) {
|
if (spoutPlayer.isSpoutCraftEnabled()) {
|
||||||
String[] spoutMessages = Repair.getSpoutAnvilMessages(anvilId);
|
String[] spoutMessages = Repair.getSpoutAnvilMessages(anvilType);
|
||||||
spoutPlayer.sendNotification(spoutMessages[0], spoutMessages[1], Material.getMaterial(anvilId));
|
spoutPlayer.sendNotification(spoutMessages[0], spoutMessages[1], anvilType);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
player.sendMessage(Repair.getAnvilMessage(anvilId));
|
player.sendMessage(Repair.getAnvilMessage(anvilType));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ MySQL:
|
|||||||
###
|
###
|
||||||
Hardcore:
|
Hardcore:
|
||||||
Death_Stat_Loss:
|
Death_Stat_Loss:
|
||||||
Penalty_Percentage: 75
|
Penalty_Percentage: 75.0
|
||||||
Enabled:
|
Enabled:
|
||||||
Acrobatics: false
|
Acrobatics: false
|
||||||
Archery: false
|
Archery: false
|
||||||
@ -105,7 +105,7 @@ Hardcore:
|
|||||||
Unarmed: false
|
Unarmed: false
|
||||||
Woodcutting: false
|
Woodcutting: false
|
||||||
Vampirism:
|
Vampirism:
|
||||||
Leech_Percentage: 5
|
Leech_Percentage: 5.0
|
||||||
Enabled:
|
Enabled:
|
||||||
Acrobatics: false
|
Acrobatics: false
|
||||||
Archery: false
|
Archery: false
|
||||||
@ -140,7 +140,7 @@ Items:
|
|||||||
Prevent_Use_Underground: true
|
Prevent_Use_Underground: true
|
||||||
Use_Cost: 1
|
Use_Cost: 1
|
||||||
Recipe_Cost: 5
|
Recipe_Cost: 5
|
||||||
Item_ID: 288
|
Item_Name: FEATHER
|
||||||
|
|
||||||
#
|
#
|
||||||
# Settings for Parties
|
# Settings for Parties
|
||||||
@ -223,12 +223,12 @@ Skills:
|
|||||||
Prevent_AFK_Leveling: true
|
Prevent_AFK_Leveling: true
|
||||||
Mining:
|
Mining:
|
||||||
Level_Cap: 0
|
Level_Cap: 0
|
||||||
Detonator_ID: 259
|
Detonator_Name: FLINT_AND_STEEL
|
||||||
Repair:
|
Repair:
|
||||||
Level_Cap: 0
|
Level_Cap: 0
|
||||||
Anvil_Messages: true
|
Anvil_Messages: true
|
||||||
Anvil_ID: 42
|
Anvil_Material: IRON_BLOCK
|
||||||
Salvage_Anvil_ID: 41
|
Salvage_Anvil_Material: GOLD_BLOCK
|
||||||
Salvage_tools: true
|
Salvage_tools: true
|
||||||
Salvage_armor: true
|
Salvage_armor: true
|
||||||
# Ask for a confirmation when a player tries to repair an enchanted item
|
# Ask for a confirmation when a player tries to repair an enchanted item
|
||||||
@ -249,7 +249,7 @@ Skills:
|
|||||||
Apples_Required: 10
|
Apples_Required: 10
|
||||||
|
|
||||||
# Range to check for nearby pets when using Call Of The Wild, 0 will disable the check
|
# Range to check for nearby pets when using Call Of The Wild, 0 will disable the check
|
||||||
Range: 40
|
Range: 40.0
|
||||||
# Amount of pets to summon when using Call Of The Wild
|
# Amount of pets to summon when using Call Of The Wild
|
||||||
Wolf_Amount: 1
|
Wolf_Amount: 1
|
||||||
Ocelot_Amount: 1
|
Ocelot_Amount: 1
|
||||||
@ -312,7 +312,7 @@ Commands:
|
|||||||
mcmmo:
|
mcmmo:
|
||||||
Donate_Message: true
|
Donate_Message: true
|
||||||
inspect:
|
inspect:
|
||||||
Max_Distance: 30
|
Max_Distance: 30.0
|
||||||
ptp:
|
ptp:
|
||||||
Cooldown: 120
|
Cooldown: 120
|
||||||
Warmup: 5
|
Warmup: 5
|
||||||
|
Loading…
Reference in New Issue
Block a user