mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 22:26:46 +01:00
Static Abuse Removal - BlockUtils -> BlockTools
This commit is contained in:
parent
c5a7c88e0c
commit
05f289e6e6
@ -23,7 +23,7 @@ public class ConvertDatabaseCommand implements CommandExecutor {
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
DatabaseType previousType = DatabaseType.getDatabaseType(args[1]);
|
||||
DatabaseType previousType = getDatabaseType(args[1]);
|
||||
DatabaseType newType = pluginRef.getDatabaseManager().getDatabaseType();
|
||||
|
||||
if (previousType == newType || (newType == DatabaseType.CUSTOM && pluginRef.getDatabaseManagerFactory().getCustomDatabaseManagerClass().getSimpleName().equalsIgnoreCase(args[1]))) {
|
||||
@ -64,14 +64,30 @@ public class ConvertDatabaseCommand implements CommandExecutor {
|
||||
pluginRef.getDatabaseManager().saveUser(profile);
|
||||
}
|
||||
|
||||
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(pluginRef, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
||||
new PlayerProfileLoadingTask(pluginRef, player).runTaskLaterAsynchronously(pluginRef, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
||||
}
|
||||
|
||||
new DatabaseConversionTask(oldDatabase, sender, previousType.toString(), newType.toString()).runTaskAsynchronously(pluginRef);
|
||||
new DatabaseConversionTask(pluginRef, oldDatabase, sender, previousType.toString(), newType.toString()).runTaskAsynchronously(pluginRef);
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public DatabaseType getDatabaseType(String typeName) {
|
||||
for (DatabaseType type : DatabaseType.values()) {
|
||||
if (type.name().equalsIgnoreCase(typeName)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
if (typeName.equalsIgnoreCase("file")) {
|
||||
return DatabaseType.FLATFILE;
|
||||
} else if (typeName.equalsIgnoreCase("mysql")) {
|
||||
return DatabaseType.SQL;
|
||||
}
|
||||
|
||||
return DatabaseType.CUSTOM;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.axes.Axes;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -59,7 +58,7 @@ public class AxesCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canSkullSplitter = Permissions.skullSplitter(player) && RankUtils.hasUnlockedSubskill(player, SubSkillType.AXES_SKULL_SPLITTER);
|
||||
canSkullSplitter = Permissions.skullSplitter(player) && pluginRef.getRankTools().hasUnlockedSubskill(player, SubSkillType.AXES_SKULL_SPLITTER);
|
||||
canCritical = canUseSubskill(player, SubSkillType.AXES_CRITICAL_STRIKES);
|
||||
canAxeMastery = canUseSubskill(player, SubSkillType.AXES_AXE_MASTERY);
|
||||
canImpact = canUseSubskill(player, SubSkillType.AXES_ARMOR_IMPACT);
|
||||
|
@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.excavation.ExcavationManager;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -35,7 +34,7 @@ public class ExcavationCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canGigaDrill = Permissions.gigaDrillBreaker(player) && RankUtils.hasUnlockedSubskill(player, SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER);
|
||||
canGigaDrill = Permissions.gigaDrillBreaker(player) && pluginRef.getRankTools().hasUnlockedSubskill(player, SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER);
|
||||
canTreasureHunt = canUseSubskill(player, SubSkillType.EXCAVATION_ARCHAEOLOGY);
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,6 @@ import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.fishing.Fishing;
|
||||
import com.gmail.nossr50.skills.fishing.FishingManager;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@ -87,7 +86,7 @@ public class FishingCommand extends SkillCommand {
|
||||
|
||||
// FISHERMAN'S DIET
|
||||
if (canFishermansDiet) {
|
||||
fishermansDietRank = RankUtils.getRank(player, SubSkillType.FISHING_FISHERMANS_DIET);
|
||||
fishermansDietRank = pluginRef.getRankTools().getRank(player, SubSkillType.FISHING_FISHERMANS_DIET);
|
||||
}
|
||||
|
||||
// MASTER ANGLER
|
||||
@ -156,7 +155,7 @@ public class FishingCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
if (canTreasureHunt) {
|
||||
messages.add(getStatMessage(false, true, SubSkillType.FISHING_TREASURE_HUNTER, String.valueOf(lootTier), String.valueOf(RankUtils.getHighestRank(SubSkillType.FISHING_TREASURE_HUNTER))));
|
||||
messages.add(getStatMessage(false, true, SubSkillType.FISHING_TREASURE_HUNTER, String.valueOf(lootTier), String.valueOf(pluginRef.getRankTools().getHighestRank(SubSkillType.FISHING_TREASURE_HUNTER))));
|
||||
messages.add(getStatMessage(true, true, SubSkillType.FISHING_TREASURE_HUNTER,
|
||||
String.valueOf(commonTreasure),
|
||||
String.valueOf(uncommonTreasure),
|
||||
|
@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -50,7 +49,7 @@ public class HerbalismCommand extends SkillCommand {
|
||||
|
||||
// FARMERS DIET
|
||||
if (canFarmersDiet) {
|
||||
farmersDietRank = RankUtils.getRank(player, SubSkillType.HERBALISM_FARMERS_DIET);
|
||||
farmersDietRank = pluginRef.getRankTools().getRank(player, SubSkillType.HERBALISM_FARMERS_DIET);
|
||||
}
|
||||
|
||||
// GREEN TERRA
|
||||
@ -62,7 +61,7 @@ public class HerbalismCommand extends SkillCommand {
|
||||
|
||||
// GREEN THUMB
|
||||
if (canGreenThumbBlocks || canGreenThumbPlants) {
|
||||
greenThumbStage = RankUtils.getRank(player, SubSkillType.HERBALISM_GREEN_THUMB);
|
||||
greenThumbStage = pluginRef.getRankTools().getRank(player, SubSkillType.HERBALISM_GREEN_THUMB);
|
||||
|
||||
String[] greenThumbStrings = getAbilityDisplayValues(player, SubSkillType.HERBALISM_GREEN_THUMB);
|
||||
greenThumbChance = greenThumbStrings[0];
|
||||
@ -88,8 +87,8 @@ public class HerbalismCommand extends SkillCommand {
|
||||
protected void permissionsCheck(Player player) {
|
||||
hasHylianLuck = canUseSubskill(player, SubSkillType.HERBALISM_HYLIAN_LUCK);
|
||||
canGreenTerra = Permissions.greenTerra(player);
|
||||
canGreenThumbPlants = RankUtils.hasUnlockedSubskill(player, SubSkillType.HERBALISM_GREEN_THUMB) && (Permissions.greenThumbPlant(player, Material.WHEAT) || Permissions.greenThumbPlant(player, Material.CARROT) || Permissions.greenThumbPlant(player, Material.POTATO) || Permissions.greenThumbPlant(player, Material.BEETROOT) || Permissions.greenThumbPlant(player, Material.NETHER_WART) || Permissions.greenThumbPlant(player, Material.COCOA));
|
||||
canGreenThumbBlocks = RankUtils.hasUnlockedSubskill(player, SubSkillType.HERBALISM_GREEN_THUMB) && (Permissions.greenThumbBlock(player, Material.DIRT) || Permissions.greenThumbBlock(player, Material.COBBLESTONE) || Permissions.greenThumbBlock(player, Material.COBBLESTONE_WALL) || Permissions.greenThumbBlock(player, Material.STONE_BRICKS));
|
||||
canGreenThumbPlants = pluginRef.getRankTools().hasUnlockedSubskill(player, SubSkillType.HERBALISM_GREEN_THUMB) && (Permissions.greenThumbPlant(player, Material.WHEAT) || Permissions.greenThumbPlant(player, Material.CARROT) || Permissions.greenThumbPlant(player, Material.POTATO) || Permissions.greenThumbPlant(player, Material.BEETROOT) || Permissions.greenThumbPlant(player, Material.NETHER_WART) || Permissions.greenThumbPlant(player, Material.COCOA));
|
||||
canGreenThumbBlocks = pluginRef.getRankTools().hasUnlockedSubskill(player, SubSkillType.HERBALISM_GREEN_THUMB) && (Permissions.greenThumbBlock(player, Material.DIRT) || Permissions.greenThumbBlock(player, Material.COBBLESTONE) || Permissions.greenThumbBlock(player, Material.COBBLESTONE_WALL) || Permissions.greenThumbBlock(player, Material.STONE_BRICKS));
|
||||
canFarmersDiet = canUseSubskill(player, SubSkillType.HERBALISM_FARMERS_DIET);
|
||||
canDoubleDrop = canUseSubskill(player, SubSkillType.HERBALISM_DOUBLE_DROPS);
|
||||
canShroomThumb = canUseSubskill(player, SubSkillType.HERBALISM_SHROOM_THUMB);
|
||||
|
@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -66,11 +65,11 @@ public class MiningCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canBiggerBombs = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_BIGGER_BOMBS) && Permissions.biggerBombs(player);
|
||||
canBlast = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_BLAST_MINING) && Permissions.remoteDetonation(player);
|
||||
canDemoExpert = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_DEMOLITIONS_EXPERTISE) && Permissions.demolitionsExpertise(player);
|
||||
canBiggerBombs = pluginRef.getRankTools().hasUnlockedSubskill(player, SubSkillType.MINING_BIGGER_BOMBS) && Permissions.biggerBombs(player);
|
||||
canBlast = pluginRef.getRankTools().hasUnlockedSubskill(player, SubSkillType.MINING_BLAST_MINING) && Permissions.remoteDetonation(player);
|
||||
canDemoExpert = pluginRef.getRankTools().hasUnlockedSubskill(player, SubSkillType.MINING_DEMOLITIONS_EXPERTISE) && Permissions.demolitionsExpertise(player);
|
||||
canDoubleDrop = canUseSubskill(player, SubSkillType.MINING_DOUBLE_DROPS);
|
||||
canSuperBreaker = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_SUPER_BREAKER) && Permissions.superBreaker(player);
|
||||
canSuperBreaker = pluginRef.getRankTools().hasUnlockedSubskill(player, SubSkillType.MINING_SUPER_BREAKER) && Permissions.superBreaker(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -83,7 +82,7 @@ public class MiningCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
if (canBlast) {
|
||||
messages.add(getStatMessage(false, true, SubSkillType.MINING_BLAST_MINING, String.valueOf(blastMiningRank), String.valueOf(RankUtils.getHighestRank(SubSkillType.MINING_BLAST_MINING)), pluginRef.getLocaleManager().getString("Mining.Blast.Effect", oreBonus, debrisReduction, bonusTNTDrops)));
|
||||
messages.add(getStatMessage(false, true, SubSkillType.MINING_BLAST_MINING, String.valueOf(blastMiningRank), String.valueOf(pluginRef.getRankTools().getHighestRank(SubSkillType.MINING_BLAST_MINING)), pluginRef.getLocaleManager().getString("Mining.Blast.Effect", oreBonus, debrisReduction, bonusTNTDrops)));
|
||||
//messages.add(pluginRef.getLocaleManager().getString("Mining.Blast.Rank", blastMiningRank, RankUtils.getHighestRank(SubSkillType.MINING_BLAST_MINING), pluginRef.getLocaleManager().getString("Mining.Blast.Effect", oreBonus, debrisReduction, bonusTNTDrops)));
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,6 @@ import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.repair.RepairManager;
|
||||
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -94,8 +93,8 @@ public class RepairCommand extends SkillCommand {
|
||||
|
||||
messages.add(getStatMessage(false, true,
|
||||
SubSkillType.REPAIR_ARCANE_FORGING,
|
||||
String.valueOf(RankUtils.getRank(player, SubSkillType.REPAIR_ARCANE_FORGING)),
|
||||
RankUtils.getHighestRankStr(SubSkillType.REPAIR_ARCANE_FORGING)));
|
||||
String.valueOf(pluginRef.getRankTools().getRank(player, SubSkillType.REPAIR_ARCANE_FORGING)),
|
||||
pluginRef.getRankTools().getHighestRankStr(SubSkillType.REPAIR_ARCANE_FORGING)));
|
||||
|
||||
if (pluginRef.getConfigManager().getConfigRepair().getArcaneForging().isDowngradesEnabled() || pluginRef.getConfigManager().getConfigRepair().getArcaneForging().isMayLoseEnchants()) {
|
||||
messages.add(getStatMessage(true, true, SubSkillType.REPAIR_ARCANE_FORGING,
|
||||
|
@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.salvage.Salvage;
|
||||
import com.gmail.nossr50.skills.salvage.SalvageManager;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -40,14 +39,14 @@ public class SalvageCommand extends SkillCommand {
|
||||
if (canScrapCollector) {
|
||||
messages.add(getStatMessage(false, true,
|
||||
SubSkillType.SALVAGE_SCRAP_COLLECTOR,
|
||||
String.valueOf(RankUtils.getRank(player, SubSkillType.SALVAGE_SCRAP_COLLECTOR)),
|
||||
RankUtils.getHighestRankStr(SubSkillType.SALVAGE_SCRAP_COLLECTOR)));
|
||||
String.valueOf(pluginRef.getRankTools().getRank(player, SubSkillType.SALVAGE_SCRAP_COLLECTOR)),
|
||||
pluginRef.getRankTools().getHighestRankStr(SubSkillType.SALVAGE_SCRAP_COLLECTOR)));
|
||||
}
|
||||
|
||||
if (canArcaneSalvage) {
|
||||
messages.add(getStatMessage(false, true, SubSkillType.SALVAGE_ARCANE_SALVAGE,
|
||||
String.valueOf(salvageManager.getArcaneSalvageRank()),
|
||||
String.valueOf(RankUtils.getHighestRank(SubSkillType.SALVAGE_ARCANE_SALVAGE))));
|
||||
String.valueOf(pluginRef.getRankTools().getHighestRank(SubSkillType.SALVAGE_ARCANE_SALVAGE))));
|
||||
|
||||
if (Salvage.arcaneSalvageEnchantLoss) {
|
||||
messages.add(pluginRef.getLocaleManager().getString("Ability.Generic.Template", pluginRef.getLocaleManager().getString("Salvage.Arcane.ExtractFull"), percent.format(salvageManager.getExtractFullEnchantChance() / 100)));
|
||||
|
@ -7,7 +7,6 @@ import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.child.FamilyTree;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
@ -250,6 +249,6 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
* @return true if the player has permission and has the skill unlocked
|
||||
*/
|
||||
protected boolean canUseSubskill(Player player, SubSkillType subSkillType) {
|
||||
return Permissions.isSubSkillEnabled(player, subSkillType) && RankUtils.hasUnlockedSubskill(player, subSkillType);
|
||||
return Permissions.isSubSkillEnabled(player, subSkillType) && pluginRef.getRankTools().hasUnlockedSubskill(player, subSkillType);
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -54,7 +53,7 @@ public class SmeltingCommand extends SkillCommand {
|
||||
canFuelEfficiency = canUseSubskill(player, SubSkillType.SMELTING_FUEL_EFFICIENCY);
|
||||
canSecondSmelt = canUseSubskill(player, SubSkillType.SMELTING_SECOND_SMELT);
|
||||
//canFluxMine = canUseSubskill(player, SubSkillType.SMELTING_FLUX_MINING);
|
||||
canUnderstandTheArt = Permissions.vanillaXpBoost(player, skill) && RankUtils.hasUnlockedSubskill(player, SubSkillType.SMELTING_UNDERSTANDING_THE_ART);
|
||||
canUnderstandTheArt = Permissions.vanillaXpBoost(player, skill) && pluginRef.getRankTools().hasUnlockedSubskill(player, SubSkillType.SMELTING_UNDERSTANDING_THE_ART);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -58,7 +57,7 @@ public class SwordsCommand extends SkillCommand {
|
||||
protected void permissionsCheck(Player player) {
|
||||
canBleed = canUseSubskill(player, SubSkillType.SWORDS_RUPTURE);
|
||||
canCounter = canUseSubskill(player, SubSkillType.SWORDS_COUNTER_ATTACK);
|
||||
canSerratedStrike = RankUtils.hasUnlockedSubskill(player, SubSkillType.SWORDS_SERRATED_STRIKES) && Permissions.serratedStrikes(player);
|
||||
canSerratedStrike = pluginRef.getRankTools().hasUnlockedSubskill(player, SubSkillType.SWORDS_SERRATED_STRIKES) && Permissions.serratedStrikes(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -69,8 +68,8 @@ public class SwordsCommand extends SkillCommand {
|
||||
double ruptureDamagePlayer = pluginRef.getConfigManager().getConfigSwords().getRuptureDamagePlayer();
|
||||
double pveRupture = pluginRef.getConfigManager().getConfigSwords().getRuptureDamageMobs();
|
||||
|
||||
double pvpDamageRupture = RankUtils.getRank(player, SubSkillType.SWORDS_RUPTURE) >= 3 ? ruptureDamagePlayer * 1.5D : ruptureDamagePlayer;
|
||||
double ruptureDamageMobs = RankUtils.getRank(player, SubSkillType.SWORDS_RUPTURE) >= 3 ? pveRupture * 1.5D : pveRupture;
|
||||
double pvpDamageRupture = pluginRef.getRankTools().getRank(player, SubSkillType.SWORDS_RUPTURE) >= 3 ? ruptureDamagePlayer * 1.5D : ruptureDamagePlayer;
|
||||
double ruptureDamageMobs = pluginRef.getRankTools().getRank(player, SubSkillType.SWORDS_RUPTURE) >= 3 ? pveRupture * 1.5D : pveRupture;
|
||||
|
||||
if (canCounter) {
|
||||
messages.add(getStatMessage(SubSkillType.SWORDS_COUNTER_ATTACK, counterChance)
|
||||
|
@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -70,7 +69,7 @@ public class UnarmedCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canBerserk = RankUtils.hasUnlockedSubskill(player, SubSkillType.UNARMED_BERSERK) && Permissions.berserk(player);
|
||||
canBerserk = pluginRef.getRankTools().hasUnlockedSubskill(player, SubSkillType.UNARMED_BERSERK) && Permissions.berserk(player);
|
||||
canIronArm = canUseSubskill(player, SubSkillType.UNARMED_IRON_ARM_STYLE);
|
||||
canDeflect = canUseSubskill(player, SubSkillType.UNARMED_ARROW_DEFLECT);
|
||||
canDisarm = canUseSubskill(player, SubSkillType.UNARMED_DISARM);
|
||||
|
@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -51,8 +50,8 @@ public class WoodcuttingCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canTreeFell = RankUtils.hasUnlockedSubskill(player, SubSkillType.WOODCUTTING_TREE_FELLER) && Permissions.treeFeller(player);
|
||||
canDoubleDrop = canUseSubskill(player, SubSkillType.WOODCUTTING_HARVEST_LUMBER) && RankUtils.getRank(player, SubSkillType.WOODCUTTING_HARVEST_LUMBER) >= 1;
|
||||
canTreeFell = pluginRef.getRankTools().hasUnlockedSubskill(player, SubSkillType.WOODCUTTING_TREE_FELLER) && Permissions.treeFeller(player);
|
||||
canDoubleDrop = canUseSubskill(player, SubSkillType.WOODCUTTING_HARVEST_LUMBER) && pluginRef.getRankTools().getRank(player, SubSkillType.WOODCUTTING_HARVEST_LUMBER) >= 1;
|
||||
canLeafBlow = canUseSubskill(player, SubSkillType.WOODCUTTING_LEAF_BLOWER);
|
||||
/*canSplinter = canUseSubskill(player, SubSkillType.WOODCUTTING_SPLINTER);
|
||||
canBarkSurgeon = canUseSubskill(player, SubSkillType.WOODCUTTING_BARK_SURGEON);
|
||||
|
@ -80,7 +80,7 @@ public class DatabaseManagerFactory {
|
||||
return customManager.getConstructor().newInstance();
|
||||
}
|
||||
|
||||
public static DatabaseManager createCustomDatabaseManager(Class<? extends DatabaseManager> clazz) throws Throwable {
|
||||
public DatabaseManager createCustomDatabaseManager(Class<? extends DatabaseManager> clazz) throws Throwable {
|
||||
return clazz.getConstructor().newInstance();
|
||||
}
|
||||
}
|
||||
|
@ -4,20 +4,4 @@ public enum DatabaseType {
|
||||
FLATFILE,
|
||||
SQL,
|
||||
CUSTOM;
|
||||
|
||||
public static DatabaseType getDatabaseType(String typeName) {
|
||||
for (DatabaseType type : values()) {
|
||||
if (type.name().equalsIgnoreCase(typeName)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
if (typeName.equalsIgnoreCase("file")) {
|
||||
return FLATFILE;
|
||||
} else if (typeName.equalsIgnoreCase("mysql")) {
|
||||
return SQL;
|
||||
}
|
||||
|
||||
return CUSTOM;
|
||||
}
|
||||
}
|
||||
|
@ -5,19 +5,22 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import java.util.concurrent.Delayed;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
//TODO: Hmm, not sure this is working correctly.
|
||||
public class SkillXpGain implements Delayed {
|
||||
private final long expiryTime;
|
||||
private final double xp;
|
||||
private final PrimarySkillType type;
|
||||
private final int interval;
|
||||
|
||||
public SkillXpGain(PrimarySkillType type, double xp) {
|
||||
public SkillXpGain(PrimarySkillType type, double xp, int interval) {
|
||||
this.expiryTime = System.currentTimeMillis() + getDuration();
|
||||
this.xp = xp;
|
||||
this.type = type;
|
||||
this.interval = interval;
|
||||
}
|
||||
|
||||
private static long getDuration() {
|
||||
return TimeUnit.MINUTES.toMillis(pluginRef.getConfigManager().getConfigLeveling().getDimishedReturnTimeInterval());
|
||||
private long getDuration() {
|
||||
return TimeUnit.MINUTES.toMillis(interval);
|
||||
}
|
||||
|
||||
public PrimarySkillType getSkill() {
|
||||
|
@ -34,7 +34,6 @@ import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.experience.ExperienceBarManager;
|
||||
import com.gmail.nossr50.util.skills.PerksUtils;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
import org.apache.commons.lang.Validate;
|
||||
@ -232,8 +231,8 @@ public class McMMOPlayer {
|
||||
updateXPBar(primarySkillType, plugin);
|
||||
}
|
||||
|
||||
public void processUnlockNotifications(mcMMO plugin, PrimarySkillType primarySkillType, int skillLevel) {
|
||||
RankUtils.executeSkillUnlockNotifications(plugin, this, primarySkillType, skillLevel);
|
||||
public void processUnlockNotifications(PrimarySkillType primarySkillType, int skillLevel) {
|
||||
pluginRef.getRankTools().executeSkillUnlockNotifications( this, primarySkillType, skillLevel);
|
||||
}
|
||||
|
||||
public void updateXPBar(PrimarySkillType primarySkillType, Plugin plugin) {
|
||||
@ -895,7 +894,7 @@ public class McMMOPlayer {
|
||||
//TODO: This is hacky and temporary solution until skills are moved to the new system
|
||||
//Potential problems with this include skills with two super abilities (ie mining)
|
||||
if (!pluginRef.getSkillTools().isSuperAbilityUnlocked(primarySkillType, getPlayer())) {
|
||||
int diff = RankUtils.getSuperAbilityUnlockRequirement(pluginRef.getSkillTools().getSuperAbility(primarySkillType)) - getSkillLevel(primarySkillType);
|
||||
int diff = pluginRef.getRankTools().getSuperAbilityUnlockRequirement(pluginRef.getSkillTools().getSuperAbility(primarySkillType)) - getSkillLevel(primarySkillType);
|
||||
|
||||
//Inform the player they are not yet skilled enough
|
||||
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.ABILITY_COOLDOWN, "Skills.AbilityGateRequirementFail", String.valueOf(diff), pluginRef.getSkillTools().getLocalizedSkillName(primarySkillType));
|
||||
|
@ -389,7 +389,7 @@ public class PlayerProfile {
|
||||
* @param xp Experience amount to add
|
||||
*/
|
||||
public void registerXpGain(PrimarySkillType primarySkillType, double xp) {
|
||||
gainedSkillsXp.add(new SkillXpGain(primarySkillType, xp));
|
||||
gainedSkillsXp.add(new SkillXpGain(primarySkillType, xp, pluginRef.getConfigManager().getConfigLeveling().getDimishedReturnTimeInterval()));
|
||||
rollingSkillsXp.put(primarySkillType, getRegisteredXpGain(primarySkillType) + xp);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.gmail.nossr50.datatypes.skills;
|
||||
|
||||
import com.gmail.nossr50.util.BlockUtils;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import org.bukkit.Material;
|
||||
@ -197,19 +196,19 @@ public enum SuperAbilityType {
|
||||
public boolean blockCheck(BlockState blockState) {
|
||||
switch (this) {
|
||||
case BERSERK:
|
||||
return (BlockUtils.affectedByGigaDrillBreaker(blockState) || blockState.getType() == Material.SNOW);
|
||||
return (pluginRef.getBlockTools().affectedByGigaDrillBreaker(blockState) || blockState.getType() == Material.SNOW);
|
||||
|
||||
case GIGA_DRILL_BREAKER:
|
||||
return BlockUtils.affectedByGigaDrillBreaker(blockState);
|
||||
return pluginRef.getBlockTools().affectedByGigaDrillBreaker(blockState);
|
||||
|
||||
case GREEN_TERRA:
|
||||
return BlockUtils.canMakeMossy(blockState);
|
||||
return pluginRef.getBlockTools().canMakeMossy(blockState);
|
||||
|
||||
case SUPER_BREAKER:
|
||||
return BlockUtils.affectedBySuperBreaker(blockState);
|
||||
return pluginRef.getBlockTools().affectedBySuperBreaker(blockState);
|
||||
|
||||
case TREE_FELLER:
|
||||
return BlockUtils.isLog(blockState);
|
||||
return pluginRef.getBlockTools().isLog(blockState);
|
||||
|
||||
default:
|
||||
return false;
|
||||
|
@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.meta.TrackedArrowMeta;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -54,7 +53,7 @@ public class ArcheryBehaviour {
|
||||
}
|
||||
|
||||
public double getDamageBonusPercent(Player player) {
|
||||
return ((RankUtils.getRank(player, SubSkillType.ARCHERY_SKILL_SHOT)) * pluginRef.getConfigManager().getConfigArchery().getSkillShotDamageMultiplier()) / 100.0D;
|
||||
return ((pluginRef.getRankTools().getRank(player, SubSkillType.ARCHERY_SKILL_SHOT)) * pluginRef.getConfigManager().getConfigArchery().getSkillShotDamageMultiplier()) / 100.0D;
|
||||
}
|
||||
|
||||
public double getSkillShotDamageCap() {
|
||||
|
@ -3,7 +3,6 @@ package com.gmail.nossr50.datatypes.skills.behaviours;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -40,6 +39,6 @@ public class AxesBehaviour {
|
||||
* @return The axe mastery bonus damage which will be added to their attack
|
||||
*/
|
||||
public double getAxeMasteryBonusDamage(Player player) {
|
||||
return RankUtils.getRank(player, SubSkillType.AXES_AXE_MASTERY) * pluginRef.getConfigManager().getConfigAxes().getAxeMasteryMultiplier();
|
||||
return pluginRef.getRankTools().getRank(player, SubSkillType.AXES_AXE_MASTERY) * pluginRef.getConfigManager().getConfigAxes().getAxeMasteryMultiplier();
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ package com.gmail.nossr50.datatypes.skills.behaviours;
|
||||
import com.gmail.nossr50.core.MetadataConstants;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.herbalism.HerbalismManager;
|
||||
import com.gmail.nossr50.util.BlockUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
@ -79,7 +78,7 @@ public class HerbalismBehaviour {
|
||||
dropAmount++;
|
||||
|
||||
if (herbalismManager.checkDoubleDrop(target.getState()))
|
||||
BlockUtils.markDropsAsBonus(target.getState(), triple);
|
||||
pluginRef.getBlockTools().markDropsAsBonus(target.getState(), triple);
|
||||
}
|
||||
|
||||
for (BlockFace blockFace : new BlockFace[]{BlockFace.UP, BlockFace.NORTH, BlockFace.SOUTH, BlockFace.EAST, BlockFace.WEST})
|
||||
@ -139,7 +138,7 @@ public class HerbalismBehaviour {
|
||||
}
|
||||
|
||||
//Mark the original block for bonus drops
|
||||
BlockUtils.markDropsAsBonus(blockState, bonusDropAmount);
|
||||
pluginRef.getBlockTools().markDropsAsBonus(blockState, bonusDropAmount);
|
||||
|
||||
return dropAmount;
|
||||
}
|
||||
@ -167,7 +166,7 @@ public class HerbalismBehaviour {
|
||||
amount += 1;
|
||||
|
||||
if (herbalismManager.checkDoubleDrop(relativeUpBlock.getState()))
|
||||
BlockUtils.markDropsAsBonus(relativeUpBlock.getState(), triple);
|
||||
pluginRef.getBlockTools().markDropsAsBonus(relativeUpBlock.getState(), triple);
|
||||
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,6 @@ import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -49,7 +48,7 @@ public class MiningBehaviour {
|
||||
|
||||
for (int i = 0; i < SubSkillType.MINING_BLAST_MINING.getNumRanks() - 1; i++) {
|
||||
if (getBlastDamageDecrease(i + 1) > 0)
|
||||
return RankUtils.getRankUnlockLevel(SubSkillType.MINING_BLAST_MINING, i + 1);
|
||||
return pluginRef.getRankTools().getRankUnlockLevel(SubSkillType.MINING_BLAST_MINING, i + 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -59,7 +58,7 @@ public class MiningBehaviour {
|
||||
|
||||
for (int i = 0; i < SubSkillType.MINING_BLAST_MINING.getNumRanks() - 1; i++) {
|
||||
if (getBlastRadiusModifier(i + 1) > 0)
|
||||
return RankUtils.getRankUnlockLevel(SubSkillType.MINING_BLAST_MINING, i + 1);
|
||||
return pluginRef.getRankTools().getRankUnlockLevel(SubSkillType.MINING_BLAST_MINING, i + 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -9,7 +9,6 @@ import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.random.RandomChanceSkill;
|
||||
import com.gmail.nossr50.util.skills.PerksUtils;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
@ -181,7 +180,7 @@ public class Roll extends AcrobaticsSubSkill {
|
||||
}
|
||||
|
||||
private boolean canRoll(Player player) {
|
||||
return RankUtils.hasUnlockedSubskill(player, SubSkillType.ACROBATICS_ROLL) && Permissions.isSubSkillEnabled(player, SubSkillType.ACROBATICS_ROLL);
|
||||
return pluginRef.getRankTools().hasUnlockedSubskill(player, SubSkillType.ACROBATICS_ROLL) && Permissions.isSubSkillEnabled(player, SubSkillType.ACROBATICS_ROLL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -13,7 +13,6 @@ import com.gmail.nossr50.skills.excavation.ExcavationManager;
|
||||
import com.gmail.nossr50.skills.herbalism.HerbalismManager;
|
||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||
import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
|
||||
import com.gmail.nossr50.util.BlockUtils;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
@ -85,7 +84,7 @@ public class BlockListener implements Listener {
|
||||
// movedBlock = movedBlock.getRelative(direction, 2);
|
||||
|
||||
for (Block b : event.getBlocks()) {
|
||||
if (BlockUtils.shouldBeWatched(b.getState())) {
|
||||
if (pluginRef.getBlockTools().shouldBeWatched(b.getState())) {
|
||||
movedBlock = b.getRelative(direction);
|
||||
|
||||
if (pluginRef.getConfigManager().getConfigExploitPrevention().doPistonsMarkBlocksUnnatural())
|
||||
@ -127,7 +126,7 @@ public class BlockListener implements Listener {
|
||||
if (pluginRef.getDynamicSettingsManager().isWorldBlacklisted(event.getBlock().getWorld().getName()))
|
||||
return;
|
||||
|
||||
if (BlockUtils.shouldBeWatched(event.getBlock().getState())) {
|
||||
if (pluginRef.getBlockTools().shouldBeWatched(event.getBlock().getState())) {
|
||||
pluginRef.getPlaceStore().setTrue(event.getBlock());
|
||||
}
|
||||
}
|
||||
@ -143,7 +142,7 @@ public class BlockListener implements Listener {
|
||||
|
||||
if (pluginRef.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitSkills().isPreventCobblestoneStoneGeneratorXP()) {
|
||||
if (material != Material.OBSIDIAN
|
||||
&& BlockUtils.shouldBeWatched(material)
|
||||
&& pluginRef.getBlockTools().shouldBeWatched(material)
|
||||
&& pluginRef.getDynamicSettingsManager().getExperienceManager().hasMiningXp(material)) { //Hacky fix to prevent trees growing from being marked as unnatural
|
||||
pluginRef.getPlaceStore().setTrue(newBlock);
|
||||
}
|
||||
@ -166,7 +165,7 @@ public class BlockListener implements Listener {
|
||||
BlockState blockState = event.getBlock().getState();
|
||||
|
||||
/* Check if the blocks placed should be monitored so they do not give out XP in the future */
|
||||
if (BlockUtils.shouldBeWatched(blockState)) {
|
||||
if (pluginRef.getBlockTools().shouldBeWatched(blockState)) {
|
||||
// Don't count de-barking wood
|
||||
if (!Tag.LOGS.isTagged(event.getBlockReplacedState().getType()) || !Tag.LOGS.isTagged(event.getBlockPlaced().getType()))
|
||||
pluginRef.getPlaceStore().setTrue(blockState);
|
||||
@ -212,7 +211,7 @@ public class BlockListener implements Listener {
|
||||
BlockState blockState = replacedBlockState.getBlock().getState();
|
||||
|
||||
/* Check if the blocks placed should be monitored so they do not give out XP in the future */
|
||||
if (BlockUtils.shouldBeWatched(blockState)) {
|
||||
if (pluginRef.getBlockTools().shouldBeWatched(blockState)) {
|
||||
pluginRef.getPlaceStore().setTrue(blockState);
|
||||
}
|
||||
}
|
||||
@ -226,7 +225,7 @@ public class BlockListener implements Listener {
|
||||
|
||||
BlockState blockState = event.getBlock().getState();
|
||||
|
||||
if (!BlockUtils.shouldBeWatched(blockState)) {
|
||||
if (!pluginRef.getBlockTools().shouldBeWatched(blockState)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -256,7 +255,7 @@ public class BlockListener implements Listener {
|
||||
|
||||
BlockState blockState = event.getBlock().getState();
|
||||
|
||||
if (!BlockUtils.shouldBeWatched(blockState)) {
|
||||
if (!pluginRef.getBlockTools().shouldBeWatched(blockState)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -280,7 +279,7 @@ public class BlockListener implements Listener {
|
||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||
|
||||
/* HERBALISM */
|
||||
if (BlockUtils.affectedByGreenTerra(blockState)) {
|
||||
if (pluginRef.getBlockTools().affectedByGreenTerra(blockState)) {
|
||||
HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager();
|
||||
|
||||
/* Green Terra */
|
||||
@ -298,13 +297,13 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
|
||||
/* MINING */
|
||||
else if (BlockUtils.affectedBySuperBreaker(blockState) && ItemUtils.isPickaxe(heldItem) && pluginRef.getSkillTools().doesPlayerHaveSkillPermission(PrimarySkillType.MINING, player) && !pluginRef.getPlaceStore().isTrue(blockState)) {
|
||||
else if (pluginRef.getBlockTools().affectedBySuperBreaker(blockState) && ItemUtils.isPickaxe(heldItem) && pluginRef.getSkillTools().doesPlayerHaveSkillPermission(PrimarySkillType.MINING, player) && !pluginRef.getPlaceStore().isTrue(blockState)) {
|
||||
MiningManager miningManager = mcMMOPlayer.getMiningManager();
|
||||
miningManager.miningBlockCheck(blockState);
|
||||
}
|
||||
|
||||
/* WOOD CUTTING */
|
||||
else if (BlockUtils.isLog(blockState) && ItemUtils.isAxe(heldItem) && pluginRef.getSkillTools().doesPlayerHaveSkillPermission(PrimarySkillType.WOODCUTTING, player) && !pluginRef.getPlaceStore().isTrue(blockState)) {
|
||||
else if (pluginRef.getBlockTools().isLog(blockState) && ItemUtils.isAxe(heldItem) && pluginRef.getSkillTools().doesPlayerHaveSkillPermission(PrimarySkillType.WOODCUTTING, player) && !pluginRef.getPlaceStore().isTrue(blockState)) {
|
||||
WoodcuttingManager woodcuttingManager = mcMMOPlayer.getWoodcuttingManager();
|
||||
if (woodcuttingManager.canUseTreeFeller(heldItem)) {
|
||||
woodcuttingManager.processTreeFeller(blockState);
|
||||
@ -314,7 +313,7 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
|
||||
/* EXCAVATION */
|
||||
else if (BlockUtils.affectedByGigaDrillBreaker(blockState) && ItemUtils.isShovel(heldItem) && pluginRef.getSkillTools().doesPlayerHaveSkillPermission(PrimarySkillType.EXCAVATION, player) && !pluginRef.getPlaceStore().isTrue(blockState)) {
|
||||
else if (pluginRef.getBlockTools().affectedByGigaDrillBreaker(blockState) && ItemUtils.isShovel(heldItem) && pluginRef.getSkillTools().doesPlayerHaveSkillPermission(PrimarySkillType.EXCAVATION, player) && !pluginRef.getPlaceStore().isTrue(blockState)) {
|
||||
ExcavationManager excavationManager = mcMMOPlayer.getExcavationManager();
|
||||
excavationManager.excavationBlockCheck(blockState);
|
||||
|
||||
@ -432,18 +431,18 @@ public class BlockListener implements Listener {
|
||||
*
|
||||
* We check permissions here before processing activation.
|
||||
*/
|
||||
if (BlockUtils.canActivateAbilities(blockState)) {
|
||||
if (pluginRef.getBlockTools().canActivateAbilities(blockState)) {
|
||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||
|
||||
if (mcMMOPlayer.getToolPreparationMode(ToolType.HOE) && ItemUtils.isHoe(heldItem) && (BlockUtils.affectedByGreenTerra(blockState) || BlockUtils.canMakeMossy(blockState)) && Permissions.greenTerra(player)) {
|
||||
if (mcMMOPlayer.getToolPreparationMode(ToolType.HOE) && ItemUtils.isHoe(heldItem) && (pluginRef.getBlockTools().affectedByGreenTerra(blockState) || pluginRef.getBlockTools().canMakeMossy(blockState)) && Permissions.greenTerra(player)) {
|
||||
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.HERBALISM);
|
||||
} else if (mcMMOPlayer.getToolPreparationMode(ToolType.AXE) && ItemUtils.isAxe(heldItem) && BlockUtils.isLog(blockState) && Permissions.treeFeller(player)) {
|
||||
} else if (mcMMOPlayer.getToolPreparationMode(ToolType.AXE) && ItemUtils.isAxe(heldItem) && pluginRef.getBlockTools().isLog(blockState) && Permissions.treeFeller(player)) {
|
||||
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.WOODCUTTING);
|
||||
} else if (mcMMOPlayer.getToolPreparationMode(ToolType.PICKAXE) && ItemUtils.isPickaxe(heldItem) && BlockUtils.affectedBySuperBreaker(blockState) && Permissions.superBreaker(player)) {
|
||||
} else if (mcMMOPlayer.getToolPreparationMode(ToolType.PICKAXE) && ItemUtils.isPickaxe(heldItem) && pluginRef.getBlockTools().affectedBySuperBreaker(blockState) && Permissions.superBreaker(player)) {
|
||||
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.MINING);
|
||||
} else if (mcMMOPlayer.getToolPreparationMode(ToolType.SHOVEL) && ItemUtils.isShovel(heldItem) && BlockUtils.affectedByGigaDrillBreaker(blockState) && Permissions.gigaDrillBreaker(player)) {
|
||||
} else if (mcMMOPlayer.getToolPreparationMode(ToolType.SHOVEL) && ItemUtils.isShovel(heldItem) && pluginRef.getBlockTools().affectedByGigaDrillBreaker(blockState) && Permissions.gigaDrillBreaker(player)) {
|
||||
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.EXCAVATION);
|
||||
} else if (mcMMOPlayer.getToolPreparationMode(ToolType.FISTS) && heldItem.getType() == Material.AIR && (BlockUtils.affectedByGigaDrillBreaker(blockState) || blockState.getType() == Material.SNOW || BlockUtils.affectedByBlockCracker(blockState) && Permissions.berserk(player))) {
|
||||
} else if (mcMMOPlayer.getToolPreparationMode(ToolType.FISTS) && heldItem.getType() == Material.AIR && (pluginRef.getBlockTools().affectedByGigaDrillBreaker(blockState) || blockState.getType() == Material.SNOW || pluginRef.getBlockTools().affectedByBlockCracker(blockState) && Permissions.berserk(player))) {
|
||||
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.UNARMED);
|
||||
}
|
||||
}
|
||||
@ -509,7 +508,7 @@ public class BlockListener implements Listener {
|
||||
*
|
||||
* We don't need to check permissions here because they've already been checked for the ability to even activate.
|
||||
*/
|
||||
if (mcMMOPlayer.getAbilityMode(SuperAbilityType.GREEN_TERRA) && BlockUtils.canMakeMossy(blockState)) {
|
||||
if (mcMMOPlayer.getAbilityMode(SuperAbilityType.GREEN_TERRA) && pluginRef.getBlockTools().canMakeMossy(blockState)) {
|
||||
if (mcMMOPlayer.getHerbalismManager().processGreenTerra(blockState)) {
|
||||
blockState.update(true);
|
||||
}
|
||||
@ -517,12 +516,12 @@ public class BlockListener implements Listener {
|
||||
if (SuperAbilityType.BERSERK.blockCheck(block.getState()) && pluginRef.getEventManager().simulateBlockBreak(block, player, true)) {
|
||||
event.setInstaBreak(true);
|
||||
SoundManager.sendSound(player, block.getLocation(), SoundType.POP);
|
||||
} else if (mcMMOPlayer.getUnarmedManager().canUseBlockCracker() && BlockUtils.affectedByBlockCracker(blockState) && pluginRef.getEventManager().simulateBlockBreak(block, player, true)) {
|
||||
} else if (mcMMOPlayer.getUnarmedManager().canUseBlockCracker() && pluginRef.getBlockTools().affectedByBlockCracker(blockState) && pluginRef.getEventManager().simulateBlockBreak(block, player, true)) {
|
||||
if (mcMMOPlayer.getUnarmedManager().blockCrackerCheck(blockState)) {
|
||||
blockState.update();
|
||||
}
|
||||
}
|
||||
} else if (mcMMOPlayer.getWoodcuttingManager().canUseLeafBlower(heldItem) && BlockUtils.isLeaves(blockState) && pluginRef.getEventManager().simulateBlockBreak(block, player, true)) {
|
||||
} else if (mcMMOPlayer.getWoodcuttingManager().canUseLeafBlower(heldItem) && pluginRef.getBlockTools().isLeaves(blockState) && pluginRef.getEventManager().simulateBlockBreak(block, player, true)) {
|
||||
event.setInstaBreak(true);
|
||||
SoundManager.sendSound(player, block.getLocation(), SoundType.POP);
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ import com.gmail.nossr50.skills.mining.MiningManager;
|
||||
import com.gmail.nossr50.skills.taming.Taming;
|
||||
import com.gmail.nossr50.skills.taming.TamingManager;
|
||||
import com.gmail.nossr50.skills.unarmed.UnarmedManager;
|
||||
import com.gmail.nossr50.util.BlockUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
@ -158,7 +157,7 @@ public class EntityListener implements Listener {
|
||||
// When the event is fired for the falling block that changes back to a
|
||||
// normal block
|
||||
// event.getBlock().getType() returns AIR
|
||||
if (!BlockUtils.shouldBeWatched(block.getState())
|
||||
if (!pluginRef.getBlockTools().shouldBeWatched(block.getState())
|
||||
&& block.getState().getType() != Material.WATER
|
||||
&& block.getType() != Material.AIR) {
|
||||
return;
|
||||
|
@ -18,7 +18,6 @@ import com.gmail.nossr50.skills.repair.RepairManager;
|
||||
import com.gmail.nossr50.skills.salvage.SalvageManager;
|
||||
import com.gmail.nossr50.skills.taming.TamingManager;
|
||||
import com.gmail.nossr50.util.*;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
||||
@ -606,7 +605,7 @@ public class PlayerListener implements Listener {
|
||||
/* SALVAGE CHECKS */
|
||||
else if (type == pluginRef.getDynamicSettingsManager().getSkillBehaviourManager().getSalvageBehaviour().getAnvilMaterial()
|
||||
&& pluginRef.getSkillTools().doesPlayerHaveSkillPermission(PrimarySkillType.SALVAGE, player)
|
||||
&& RankUtils.hasUnlockedSubskill(player, SubSkillType.SALVAGE_SCRAP_COLLECTOR)
|
||||
&& pluginRef.getRankTools().hasUnlockedSubskill(player, SubSkillType.SALVAGE_SCRAP_COLLECTOR)
|
||||
&& pluginRef.getSalvageableManager().isSalvageable(heldItem)
|
||||
&& heldItem.getAmount() <= 1) {
|
||||
SalvageManager salvageManager = pluginRef.getUserManager().getPlayer(player).getSalvageManager();
|
||||
@ -720,9 +719,9 @@ public class PlayerListener implements Listener {
|
||||
BlockState blockState = block.getState();
|
||||
|
||||
/* ACTIVATION & ITEM CHECKS */
|
||||
if (BlockUtils.canActivateTools(blockState)) {
|
||||
if (pluginRef.getBlockTools().canActivateTools(blockState)) {
|
||||
if (pluginRef.getConfigManager().getConfigSuperAbilities().isSuperAbilitiesEnabled()) {
|
||||
if (BlockUtils.canActivateHerbalism(blockState)) {
|
||||
if (pluginRef.getBlockTools().canActivateHerbalism(blockState)) {
|
||||
mcMMOPlayer.processAbilityActivation(PrimarySkillType.HERBALISM);
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,6 @@ import com.gmail.nossr50.events.experience.McMMOPlayerXpGainEvent;
|
||||
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.player.PlayerLevelTools;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -36,7 +35,7 @@ public class SelfListener implements Listener {
|
||||
}
|
||||
|
||||
//Reset the delay timer
|
||||
RankUtils.resetUnlockDelayTimer();
|
||||
pluginRef.getRankTools().resetUnlockDelayTimer();
|
||||
|
||||
if (pluginRef.getScoreboardSettings().getScoreboardsEnabled())
|
||||
pluginRef.getScoreboardManager().handleLevelUp(player, skill);
|
||||
|
@ -41,7 +41,7 @@ import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.random.RandomChanceTools;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
import com.gmail.nossr50.util.skills.CombatTools;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.RankTools;
|
||||
import com.gmail.nossr50.util.skills.SkillTools;
|
||||
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
||||
import net.shatteredlands.shatt.backup.ZipLibrary;
|
||||
@ -83,16 +83,18 @@ public class mcMMO extends JavaPlugin {
|
||||
private EventManager eventManager;
|
||||
private UserManager userManager;
|
||||
private ScoreboardManager scoreboardManager;
|
||||
private RandomChanceTools randomChanceTools;
|
||||
|
||||
/* Not-Managers but my naming scheme sucks */
|
||||
private DatabaseManagerFactory databaseManagerFactory;
|
||||
private CommandTools commandTools;
|
||||
private SkillTools skillTools; //TODO: Remove once a new skill system is in place
|
||||
private BlockTools blockTools;
|
||||
private CombatTools combatTools; //TODO: Rewrite this garbo
|
||||
private TextComponentFactory textComponentFactory;
|
||||
private PlayerLevelTools playerLevelTools;
|
||||
private MaterialMapStore materialMapStore;
|
||||
private RandomChanceTools randomChanceTools;
|
||||
private RankTools rankTools;
|
||||
|
||||
/* Never-Ending tasks */
|
||||
private BleedTimerTask bleedTimerTask;
|
||||
@ -190,8 +192,11 @@ public class mcMMO extends JavaPlugin {
|
||||
Permissions.generateWorldTeleportPermissions();
|
||||
}
|
||||
|
||||
//Init Rank Tools
|
||||
rankTools = new RankTools(this);
|
||||
|
||||
//Populate Ranked Skill Maps (DO THIS LAST)
|
||||
RankUtils.populateRanks();
|
||||
rankTools.populateRanks();
|
||||
}
|
||||
|
||||
//If anonymous statistics are enabled then use them
|
||||
@ -250,6 +255,9 @@ public class mcMMO extends JavaPlugin {
|
||||
|
||||
//Init Random Chance Tools
|
||||
randomChanceTools = new RandomChanceTools(this);
|
||||
|
||||
//Init Block Tools
|
||||
blockTools = new BlockTools(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -761,4 +769,12 @@ public class mcMMO extends JavaPlugin {
|
||||
public RandomChanceTools getRandomChanceTools() {
|
||||
return randomChanceTools;
|
||||
}
|
||||
|
||||
public RankTools getRankTools() {
|
||||
return rankTools;
|
||||
}
|
||||
|
||||
public BlockTools getBlockTools() {
|
||||
return blockTools;
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package com.gmail.nossr50.runnables;
|
||||
|
||||
import com.gmail.nossr50.core.MetadataConstants;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.BlockUtils;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
@ -25,7 +24,7 @@ public class PistonTrackerTask extends BukkitRunnable {
|
||||
@Override
|
||||
public void run() {
|
||||
// Check to see if futureEmptyBlock is empty - if it isn't; the blocks didn't move
|
||||
if (!BlockUtils.isPistonPiece(futureEmptyBlock.getState())) {
|
||||
if (!pluginRef.getBlockTools().isPistonPiece(futureEmptyBlock.getState())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.gmail.nossr50.runnables;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.BlockUtils;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
@ -25,7 +24,7 @@ public class StickyPistonTrackerTask extends BukkitRunnable {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!BlockUtils.isPistonPiece(movedBlock.getState())) {
|
||||
if (!pluginRef.getBlockTools().isPistonPiece(movedBlock.getState())) {
|
||||
// The block didn't move
|
||||
return;
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -62,7 +61,7 @@ public class AcrobaticsManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean canDodge(Entity damager) {
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.ACROBATICS_DODGE))
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.ACROBATICS_DODGE))
|
||||
return false;
|
||||
|
||||
if (Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.ACROBATICS_DODGE)) {
|
||||
|
@ -10,7 +10,6 @@ import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -32,21 +31,21 @@ public class ArcheryManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean canDaze(LivingEntity target) {
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.ARCHERY_DAZE))
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.ARCHERY_DAZE))
|
||||
return false;
|
||||
|
||||
return target instanceof Player && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.ARCHERY_DAZE);
|
||||
}
|
||||
|
||||
public boolean canSkillShot() {
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.ARCHERY_SKILL_SHOT))
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.ARCHERY_SKILL_SHOT))
|
||||
return false;
|
||||
|
||||
return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.ARCHERY_SKILL_SHOT);
|
||||
}
|
||||
|
||||
public boolean canRetrieveArrows() {
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.ARCHERY_ARROW_RETRIEVAL))
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.ARCHERY_ARROW_RETRIEVAL))
|
||||
return false;
|
||||
|
||||
return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.ARCHERY_ARROW_RETRIEVAL);
|
||||
|
@ -12,7 +12,6 @@ import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -31,35 +30,35 @@ public class AxesManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean canUseAxeMastery() {
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.AXES_AXE_MASTERY))
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.AXES_AXE_MASTERY))
|
||||
return false;
|
||||
|
||||
return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.AXES_AXE_MASTERY);
|
||||
}
|
||||
|
||||
public boolean canCriticalHit(LivingEntity target) {
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.AXES_CRITICAL_STRIKES))
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.AXES_CRITICAL_STRIKES))
|
||||
return false;
|
||||
|
||||
return target.isValid() && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.AXES_CRITICAL_STRIKES);
|
||||
}
|
||||
|
||||
public boolean canImpact(LivingEntity target) {
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.AXES_ARMOR_IMPACT))
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.AXES_ARMOR_IMPACT))
|
||||
return false;
|
||||
|
||||
return target.isValid() && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.AXES_ARMOR_IMPACT) && axesBehaviour.hasArmor(target);
|
||||
}
|
||||
|
||||
public boolean canGreaterImpact(LivingEntity target) {
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.AXES_GREATER_IMPACT))
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.AXES_GREATER_IMPACT))
|
||||
return false;
|
||||
|
||||
return target.isValid() && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.AXES_GREATER_IMPACT) && !axesBehaviour.hasArmor(target);
|
||||
}
|
||||
|
||||
public boolean canUseSkullSplitter(LivingEntity target) {
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.AXES_SKULL_SPLITTER))
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.AXES_SKULL_SPLITTER))
|
||||
return false;
|
||||
|
||||
return target.isValid() && mcMMOPlayer.getAbilityMode(SuperAbilityType.SKULL_SPLITTER) && Permissions.skullSplitter(getPlayer());
|
||||
@ -130,7 +129,7 @@ public class AxesManager extends SkillManager {
|
||||
}
|
||||
|
||||
public double getImpactDurabilityDamage() {
|
||||
return pluginRef.getConfigManager().getConfigAxes().getConfigAxesImpact().getImpactDurabilityDamageModifier() * RankUtils.getRank(getPlayer(), SubSkillType.AXES_ARMOR_IMPACT);
|
||||
return pluginRef.getConfigManager().getConfigAxes().getConfigAxesImpact().getImpactDurabilityDamageModifier() * pluginRef.getRankTools().getRank(getPlayer(), SubSkillType.AXES_ARMOR_IMPACT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -10,7 +10,6 @@ import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@ -72,7 +71,7 @@ public class ExcavationManager extends SkillManager {
|
||||
}
|
||||
|
||||
public int getArchaeologyRank() {
|
||||
return RankUtils.getRank(getPlayer(), SubSkillType.EXCAVATION_ARCHAEOLOGY);
|
||||
return pluginRef.getRankTools().getRank(getPlayer(), SubSkillType.EXCAVATION_ARCHAEOLOGY);
|
||||
}
|
||||
|
||||
public void printExcavationDebug(Player player, BlockState blockState)
|
||||
|
@ -17,12 +17,10 @@ import com.gmail.nossr50.events.skills.fishing.McMMOPlayerFishingTreasureEvent;
|
||||
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerShakeEvent;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.BlockUtils;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.random.RandomChanceSkillStatic;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -65,11 +63,11 @@ public class FishingManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean canShake(Entity target) {
|
||||
return target instanceof LivingEntity && RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.FISHING_SHAKE) && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.FISHING_SHAKE);
|
||||
return target instanceof LivingEntity && pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.FISHING_SHAKE) && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.FISHING_SHAKE);
|
||||
}
|
||||
|
||||
public boolean canMasterAngler() {
|
||||
return getSkillLevel() >= RankUtils.getUnlockLevel(SubSkillType.FISHING_MASTER_ANGLER) && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.FISHING_MASTER_ANGLER);
|
||||
return getSkillLevel() >= pluginRef.getRankTools().getUnlockLevel(SubSkillType.FISHING_MASTER_ANGLER) && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.FISHING_MASTER_ANGLER);
|
||||
}
|
||||
|
||||
public void setFishingRodCastTimestamp() {
|
||||
@ -164,11 +162,11 @@ public class FishingManager extends SkillManager {
|
||||
}
|
||||
|
||||
public void setFishingTarget() {
|
||||
getPlayer().getTargetBlock(BlockUtils.getTransparentBlocks(), 100);
|
||||
getPlayer().getTargetBlock(pluginRef.getBlockTools().getTransparentBlocks(), 100);
|
||||
}
|
||||
|
||||
public boolean canIceFish(Block block) {
|
||||
if (getSkillLevel() < RankUtils.getUnlockLevel(SubSkillType.FISHING_ICE_FISHING)) {
|
||||
if (getSkillLevel() < pluginRef.getRankTools().getUnlockLevel(SubSkillType.FISHING_ICE_FISHING)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -196,7 +194,7 @@ public class FishingManager extends SkillManager {
|
||||
* @return the loot tier
|
||||
*/
|
||||
public int getLootTier() {
|
||||
return RankUtils.getRank(getPlayer(), SubSkillType.FISHING_TREASURE_HUNTER);
|
||||
return pluginRef.getRankTools().getRank(getPlayer(), SubSkillType.FISHING_TREASURE_HUNTER);
|
||||
}
|
||||
|
||||
public double getShakeChance() {
|
||||
@ -204,7 +202,7 @@ public class FishingManager extends SkillManager {
|
||||
}
|
||||
|
||||
public int getInnerPeaceMultiplier() {
|
||||
return pluginRef.getConfigManager().getConfigFishing().getVanillaXPMultInnerPeace(RankUtils.getRank(getPlayer(), SubSkillType.FISHING_INNER_PEACE));
|
||||
return pluginRef.getConfigManager().getConfigFishing().getVanillaXPMultInnerPeace(pluginRef.getRankTools().getRank(getPlayer(), SubSkillType.FISHING_INNER_PEACE));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -263,8 +261,8 @@ public class FishingManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean isMagicHunterEnabled() {
|
||||
return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.FISHING_MAGIC_HUNTER)
|
||||
&& RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.FISHING_TREASURE_HUNTER)
|
||||
return pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.FISHING_MAGIC_HUNTER)
|
||||
&& pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.FISHING_TREASURE_HUNTER)
|
||||
&& Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.FISHING_TREASURE_HUNTER);
|
||||
}
|
||||
|
||||
|
@ -14,9 +14,11 @@ import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.runnables.skills.HerbalismBlockUpdaterTask;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.*;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.random.RandomChanceSkillStatic;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -43,35 +45,35 @@ public class HerbalismManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean canGreenThumbBlock(BlockState blockState) {
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.HERBALISM_GREEN_THUMB))
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.HERBALISM_GREEN_THUMB))
|
||||
return false;
|
||||
|
||||
Player player = getPlayer();
|
||||
ItemStack item = player.getInventory().getItemInMainHand();
|
||||
|
||||
return item.getAmount() > 0 && item.getType() == Material.WHEAT_SEEDS && BlockUtils.canMakeMossy(blockState) && Permissions.greenThumbBlock(player, blockState.getType());
|
||||
return item.getAmount() > 0 && item.getType() == Material.WHEAT_SEEDS && pluginRef.getBlockTools().canMakeMossy(blockState) && Permissions.greenThumbBlock(player, blockState.getType());
|
||||
}
|
||||
|
||||
public boolean canUseShroomThumb(BlockState blockState) {
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.HERBALISM_SHROOM_THUMB))
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.HERBALISM_SHROOM_THUMB))
|
||||
return false;
|
||||
|
||||
Player player = getPlayer();
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
Material itemType = inventory.getItemInMainHand().getType();
|
||||
|
||||
return (itemType == Material.BROWN_MUSHROOM || itemType == Material.RED_MUSHROOM) && inventory.contains(Material.BROWN_MUSHROOM, 1) && inventory.contains(Material.RED_MUSHROOM, 1) && BlockUtils.canMakeShroomy(blockState) && Permissions.isSubSkillEnabled(player, SubSkillType.HERBALISM_SHROOM_THUMB);
|
||||
return (itemType == Material.BROWN_MUSHROOM || itemType == Material.RED_MUSHROOM) && inventory.contains(Material.BROWN_MUSHROOM, 1) && inventory.contains(Material.RED_MUSHROOM, 1) && pluginRef.getBlockTools().canMakeShroomy(blockState) && Permissions.isSubSkillEnabled(player, SubSkillType.HERBALISM_SHROOM_THUMB);
|
||||
}
|
||||
|
||||
public boolean canUseHylianLuck() {
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.HERBALISM_HYLIAN_LUCK))
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.HERBALISM_HYLIAN_LUCK))
|
||||
return false;
|
||||
|
||||
return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.HERBALISM_HYLIAN_LUCK);
|
||||
}
|
||||
|
||||
public boolean canGreenTerraBlock(BlockState blockState) {
|
||||
return mcMMOPlayer.getAbilityMode(SuperAbilityType.GREEN_TERRA) && BlockUtils.canMakeMossy(blockState);
|
||||
return mcMMOPlayer.getAbilityMode(SuperAbilityType.GREEN_TERRA) && pluginRef.getBlockTools().canMakeMossy(blockState);
|
||||
}
|
||||
|
||||
public boolean canActivateAbility() {
|
||||
@ -163,7 +165,7 @@ public class HerbalismManager extends SkillManager {
|
||||
} else {
|
||||
/* MARK SINGLE BLOCK CROP FOR DOUBLE DROP */
|
||||
if (checkDoubleDrop(blockState))
|
||||
BlockUtils.markDropsAsBonus(blockState, greenTerra);
|
||||
pluginRef.getBlockTools().markDropsAsBonus(blockState, greenTerra);
|
||||
}
|
||||
|
||||
if (Permissions.greenThumbPlant(player, material)) {
|
||||
@ -185,7 +187,7 @@ public class HerbalismManager extends SkillManager {
|
||||
* @return true if double drop succeeds
|
||||
*/
|
||||
public boolean checkDoubleDrop(BlockState blockState) {
|
||||
return BlockUtils.checkDoubleDrops(getPlayer(), blockState, SubSkillType.HERBALISM_DOUBLE_DROPS);
|
||||
return pluginRef.getBlockTools().checkDoubleDrops(getPlayer(), blockState, SubSkillType.HERBALISM_DOUBLE_DROPS);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -281,7 +283,7 @@ public class HerbalismManager extends SkillManager {
|
||||
* @param greenTerra boolean to determine if greenTerra is active or not
|
||||
*/
|
||||
private void processGreenThumbPlants(BlockState blockState, boolean greenTerra) {
|
||||
if (!BlockUtils.isFullyGrown(blockState))
|
||||
if (!pluginRef.getBlockTools().isFullyGrown(blockState))
|
||||
return;
|
||||
|
||||
Player player = getPlayer();
|
||||
@ -387,6 +389,6 @@ public class HerbalismManager extends SkillManager {
|
||||
}
|
||||
|
||||
private int getGreenThumbStage() {
|
||||
return RankUtils.getRank(getPlayer(), SubSkillType.HERBALISM_GREEN_THUMB);
|
||||
return pluginRef.getRankTools().getRank(getPlayer(), SubSkillType.HERBALISM_GREEN_THUMB);
|
||||
}
|
||||
}
|
||||
|
@ -11,10 +11,8 @@ import com.gmail.nossr50.datatypes.skills.behaviours.MiningBehaviour;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.runnables.skills.AbilityCooldownTask;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.BlockUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
@ -50,7 +48,7 @@ public class MiningManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean canUseDemolitionsExpertise() {
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.MINING_DEMOLITIONS_EXPERTISE))
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.MINING_DEMOLITIONS_EXPERTISE))
|
||||
return false;
|
||||
|
||||
return getSkillLevel() >= miningBehaviour.getDemolitionExpertUnlockLevel() && Permissions.demolitionsExpertise(getPlayer());
|
||||
@ -66,18 +64,18 @@ public class MiningManager extends SkillManager {
|
||||
|
||||
public boolean canUseBlastMining() {
|
||||
//Not checking permissions?
|
||||
return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.MINING_BLAST_MINING);
|
||||
return pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.MINING_BLAST_MINING);
|
||||
}
|
||||
|
||||
public boolean canUseBiggerBombs() {
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.MINING_BIGGER_BOMBS))
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.MINING_BIGGER_BOMBS))
|
||||
return false;
|
||||
|
||||
return getSkillLevel() >= miningBehaviour.getBiggerBombsUnlockLevel() && Permissions.biggerBombs(getPlayer());
|
||||
}
|
||||
|
||||
public boolean canDoubleDrop() {
|
||||
return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.MINING_DOUBLE_DROPS) && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.MINING_DOUBLE_DROPS);
|
||||
return pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.MINING_DOUBLE_DROPS) && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.MINING_DOUBLE_DROPS);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -104,7 +102,7 @@ public class MiningManager extends SkillManager {
|
||||
|
||||
//TODO: Make this readable
|
||||
if (pluginRef.getRandomChanceTools().checkRandomChanceExecutionSuccess(getPlayer(), SubSkillType.MINING_DOUBLE_DROPS)) {
|
||||
BlockUtils.markDropsAsBonus(blockState, mcMMOPlayer.getAbilityMode(skill.getSuperAbility()));
|
||||
pluginRef.getBlockTools().markDropsAsBonus(blockState, mcMMOPlayer.getAbilityMode(skill.getSuperAbility()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -113,7 +111,7 @@ public class MiningManager extends SkillManager {
|
||||
*/
|
||||
public void remoteDetonation() {
|
||||
Player player = getPlayer();
|
||||
Block targetBlock = player.getTargetBlock(BlockUtils.getTransparentBlocks(), miningBehaviour.MAXIMUM_REMOTE_DETONATION_DISTANCE);
|
||||
Block targetBlock = player.getTargetBlock(pluginRef.getBlockTools().getTransparentBlocks(), miningBehaviour.MAXIMUM_REMOTE_DETONATION_DISTANCE);
|
||||
|
||||
//Blast mining cooldown check needs to be first so the player can be messaged
|
||||
if (!blastMiningCooldownOver() || targetBlock.getType() != Material.TNT || !pluginRef.getEventManager().simulateBlockBreak(targetBlock, player, true)) {
|
||||
@ -155,7 +153,7 @@ public class MiningManager extends SkillManager {
|
||||
for (Block block : blockList) {
|
||||
BlockState blockState = block.getState();
|
||||
|
||||
if (BlockUtils.isOre(blockState)) {
|
||||
if (pluginRef.getBlockTools().isOre(blockState)) {
|
||||
ores.add(blockState);
|
||||
} else {
|
||||
debris.add(blockState);
|
||||
@ -209,7 +207,7 @@ public class MiningManager extends SkillManager {
|
||||
* @return the Blast Mining tier
|
||||
*/
|
||||
public int getBlastMiningTier() {
|
||||
return RankUtils.getRank(getPlayer(), SubSkillType.MINING_BLAST_MINING);
|
||||
return pluginRef.getRankTools().getRank(getPlayer(), SubSkillType.MINING_BLAST_MINING);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -9,7 +9,6 @@ import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.random.RandomChanceSkillStatic;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
@ -203,7 +202,7 @@ public class RepairManager extends SkillManager {
|
||||
* @return the current Arcane Forging rank
|
||||
*/
|
||||
public int getArcaneForgingRank() {
|
||||
return RankUtils.getRank(getPlayer(), SubSkillType.REPAIR_ARCANE_FORGING);
|
||||
return pluginRef.getRankTools().getRank(getPlayer(), SubSkillType.REPAIR_ARCANE_FORGING);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -235,7 +234,7 @@ public class RepairManager extends SkillManager {
|
||||
Player player = getPlayer();
|
||||
|
||||
if (Permissions.isSubSkillEnabled(player, SubSkillType.REPAIR_REPAIR_MASTERY)
|
||||
&& RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.REPAIR_REPAIR_MASTERY)) {
|
||||
&& pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.REPAIR_REPAIR_MASTERY)) {
|
||||
|
||||
double maxBonusCalc = pluginRef.getDynamicSettingsManager().getSkillPropertiesManager().getMaxBonus(SubSkillType.REPAIR_REPAIR_MASTERY) / 100.0D;
|
||||
double skillLevelBonusCalc = (maxBonusCalc / pluginRef.getDynamicSettingsManager().getSkillPropertiesManager().getMaxBonusLevel(SubSkillType.REPAIR_REPAIR_MASTERY)) * (getSkillLevel() / 100.0D);
|
||||
@ -261,7 +260,7 @@ public class RepairManager extends SkillManager {
|
||||
* @return true if bonus granted, false otherwise
|
||||
*/
|
||||
private boolean checkPlayerProcRepair() {
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.REPAIR_SUPER_REPAIR))
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.REPAIR_SUPER_REPAIR))
|
||||
return false;
|
||||
|
||||
if (pluginRef.getRandomChanceTools().isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.REPAIR_SUPER_REPAIR, getPlayer())) {
|
||||
|
@ -12,7 +12,6 @@ import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.random.RandomChanceSkillStatic;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
import org.bukkit.Location;
|
||||
@ -81,8 +80,8 @@ public class SalvageManager extends SkillManager {
|
||||
int minimumSalvageableLevel = salvageable.getMinimumLevel();*/
|
||||
|
||||
// Level check
|
||||
if (!RankUtils.hasUnlockedSubskill(player, SubSkillType.SALVAGE_ARCANE_SALVAGE)) {
|
||||
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Salvage.Skills.Adept.Level", String.valueOf(RankUtils.getUnlockLevel(SubSkillType.SALVAGE_ARCANE_SALVAGE)), StringUtils.getPrettyItemString(item.getType()));
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(player, SubSkillType.SALVAGE_ARCANE_SALVAGE)) {
|
||||
pluginRef.getNotificationManager().sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Salvage.Skills.Adept.Level", String.valueOf(pluginRef.getRankTools().getUnlockLevel(SubSkillType.SALVAGE_ARCANE_SALVAGE)), StringUtils.getPrettyItemString(item.getType()));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -120,7 +119,7 @@ public class SalvageManager extends SkillManager {
|
||||
}
|
||||
}
|
||||
|
||||
if(lotteryResults == potentialSalvageYield && potentialSalvageYield != 1 && RankUtils.isPlayerMaxRankInSubSkill(player, SubSkillType.SALVAGE_ARCANE_SALVAGE)) {
|
||||
if(lotteryResults == potentialSalvageYield && potentialSalvageYield != 1 && pluginRef.getRankTools().isPlayerMaxRankInSubSkill(player, SubSkillType.SALVAGE_ARCANE_SALVAGE)) {
|
||||
pluginRef.getNotificationManager().sendPlayerInformationChatOnly(player, "Salvage.Skills.Lottery.Perfect", String.valueOf(lotteryResults), StringUtils.getPrettyItemString(item.getType()));
|
||||
} else if(salvageable.getMaximumQuantity() == 1 || getSalvageLimit() >= salvageable.getMaximumQuantity()) {
|
||||
pluginRef.getNotificationManager().sendPlayerInformationChatOnly(player, "Salvage.Skills.Lottery.Normal", String.valueOf(lotteryResults), StringUtils.getPrettyItemString(item.getType()));
|
||||
@ -167,7 +166,7 @@ public class SalvageManager extends SkillManager {
|
||||
}*/
|
||||
|
||||
public int getSalvageLimit() {
|
||||
return (RankUtils.getRank(getPlayer(), SubSkillType.SALVAGE_SCRAP_COLLECTOR));
|
||||
return (pluginRef.getRankTools().getRank(getPlayer(), SubSkillType.SALVAGE_SCRAP_COLLECTOR));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -176,7 +175,7 @@ public class SalvageManager extends SkillManager {
|
||||
* @return the current Arcane Salvage rank
|
||||
*/
|
||||
public int getArcaneSalvageRank() {
|
||||
return RankUtils.getRank(getPlayer(), SubSkillType.SALVAGE_ARCANE_SALVAGE);
|
||||
return pluginRef.getRankTools().getRank(getPlayer(), SubSkillType.SALVAGE_ARCANE_SALVAGE);
|
||||
}
|
||||
|
||||
/*public double getExtractFullEnchantChance() {
|
||||
@ -217,7 +216,7 @@ public class SalvageManager extends SkillManager {
|
||||
private ItemStack arcaneSalvageCheck(Map<Enchantment, Integer> enchants) {
|
||||
Player player = getPlayer();
|
||||
|
||||
if (!RankUtils.hasUnlockedSubskill(player, SubSkillType.SALVAGE_ARCANE_SALVAGE) || !Permissions.arcaneSalvage(player)) {
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(player, SubSkillType.SALVAGE_ARCANE_SALVAGE) || !Permissions.arcaneSalvage(player)) {
|
||||
pluginRef.getNotificationManager().sendPlayerInformationChatOnly(player, "Salvage.Skills.ArcaneFailed");
|
||||
return null;
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import org.bukkit.event.inventory.FurnaceBurnEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -33,7 +32,7 @@ public class SmeltingManager extends SkillManager {
|
||||
}
|
||||
|
||||
public int getFuelEfficiencyMultiplier() {
|
||||
switch (RankUtils.getRank(getPlayer(), SubSkillType.SMELTING_FUEL_EFFICIENCY)) {
|
||||
switch (pluginRef.getRankTools().getRank(getPlayer(), SubSkillType.SMELTING_FUEL_EFFICIENCY)) {
|
||||
case 1:
|
||||
return 2;
|
||||
case 2:
|
||||
@ -72,6 +71,6 @@ public class SmeltingManager extends SkillManager {
|
||||
* @return the vanilla XP multiplier
|
||||
*/
|
||||
public int getVanillaXpMultiplier() {
|
||||
return Math.max(1, RankUtils.getRank(getPlayer(), SubSkillType.SMELTING_UNDERSTANDING_THE_ART));
|
||||
return Math.max(1, pluginRef.getRankTools().getRank(getPlayer(), SubSkillType.SMELTING_UNDERSTANDING_THE_ART));
|
||||
}
|
||||
}
|
@ -10,7 +10,6 @@ import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -30,22 +29,22 @@ public class SwordsManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean canUseStab() {
|
||||
return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.SWORDS_STAB) && RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.SWORDS_STAB);
|
||||
return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.SWORDS_STAB) && pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.SWORDS_STAB);
|
||||
}
|
||||
|
||||
public boolean canUseRupture() {
|
||||
return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.SWORDS_RUPTURE) && RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.SWORDS_RUPTURE);
|
||||
return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.SWORDS_RUPTURE) && pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.SWORDS_RUPTURE);
|
||||
}
|
||||
|
||||
public boolean canUseCounterAttack(Entity target) {
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.SWORDS_COUNTER_ATTACK))
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.SWORDS_COUNTER_ATTACK))
|
||||
return false;
|
||||
|
||||
return target instanceof LivingEntity && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.SWORDS_COUNTER_ATTACK);
|
||||
}
|
||||
|
||||
public boolean canUseSerratedStrike() {
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.SWORDS_SERRATED_STRIKES))
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.SWORDS_SERRATED_STRIKES))
|
||||
return false;
|
||||
|
||||
return mcMMOPlayer.getAbilityMode(SuperAbilityType.SERRATED_STRIKES);
|
||||
@ -72,7 +71,7 @@ public class SwordsManager extends SkillManager {
|
||||
}
|
||||
}
|
||||
|
||||
pluginRef.getBleedTimerTask().add(target, getPlayer(), getRuptureBleedTicks(), RankUtils.getRank(getPlayer(), SubSkillType.SWORDS_RUPTURE), getToolTier(getPlayer().getInventory().getItemInMainHand()));
|
||||
pluginRef.getBleedTimerTask().add(target, getPlayer(), getRuptureBleedTicks(), pluginRef.getRankTools().getRank(getPlayer(), SubSkillType.SWORDS_RUPTURE), getToolTier(getPlayer().getInventory().getItemInMainHand()));
|
||||
|
||||
if (mcMMOPlayer.useChatNotifications()) {
|
||||
pluginRef.getNotificationManager().sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Bleeding");
|
||||
@ -81,7 +80,7 @@ public class SwordsManager extends SkillManager {
|
||||
}
|
||||
|
||||
public double getStabDamage() {
|
||||
int rank = RankUtils.getRank(getPlayer(), SubSkillType.SWORDS_STAB);
|
||||
int rank = pluginRef.getRankTools().getRank(getPlayer(), SubSkillType.SWORDS_STAB);
|
||||
|
||||
if (rank > 0) {
|
||||
double stabDamage = 1.0D + (rank * 1.5);
|
||||
@ -103,7 +102,7 @@ public class SwordsManager extends SkillManager {
|
||||
}
|
||||
|
||||
public int getRuptureBleedTicks() {
|
||||
int bleedTicks = pluginRef.getConfigManager().getConfigSwords().getRuptureBaseTicks() * RankUtils.getRank(getPlayer(), SubSkillType.SWORDS_RUPTURE);
|
||||
int bleedTicks = pluginRef.getConfigManager().getConfigSwords().getRuptureBaseTicks() * pluginRef.getRankTools().getRank(getPlayer(), SubSkillType.SWORDS_RUPTURE);
|
||||
|
||||
/*if (bleedTicks > AdvancedConfig.getInstance().getRuptureMaxTicks())
|
||||
bleedTicks = AdvancedConfig.getInstance().getRuptureMaxTicks();*/
|
||||
|
@ -1,7 +1,5 @@
|
||||
package com.gmail.nossr50.skills.taming;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.MainConfig;
|
||||
import com.gmail.nossr50.core.MetadataConstants;
|
||||
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||
@ -16,7 +14,6 @@ import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.random.RandomChanceSkillStatic;
|
||||
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
@ -28,13 +25,13 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class TamingManager extends SkillManager {
|
||||
private static HashMap<EntityType, List<TrackedTamingEntity>> summonedEntities = new HashMap<>();
|
||||
private HashMap<EntityType, List<TrackedTamingEntity>> summonedEntities = new HashMap<>();
|
||||
|
||||
public TamingManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer) {
|
||||
super(pluginRef, mcMMOPlayer, PrimarySkillType.TAMING);
|
||||
}
|
||||
|
||||
protected static void addToTracker(LivingEntity livingEntity) {
|
||||
protected void addToTracker(LivingEntity livingEntity) {
|
||||
TrackedTamingEntity trackedEntity = new TrackedTamingEntity(livingEntity);
|
||||
|
||||
if (!summonedEntities.containsKey(livingEntity.getType())) {
|
||||
@ -44,53 +41,53 @@ public class TamingManager extends SkillManager {
|
||||
summonedEntities.get(livingEntity.getType()).add(trackedEntity);
|
||||
}
|
||||
|
||||
protected static List<TrackedTamingEntity> getTrackedEntities(EntityType entityType) {
|
||||
protected List<TrackedTamingEntity> getTrackedEntities(EntityType entityType) {
|
||||
return summonedEntities.get(entityType);
|
||||
}
|
||||
|
||||
protected static void removeFromTracker(TrackedTamingEntity trackedEntity) {
|
||||
protected void removeFromTracker(TrackedTamingEntity trackedEntity) {
|
||||
summonedEntities.get(trackedEntity.getLivingEntity().getType()).remove(trackedEntity);
|
||||
}
|
||||
|
||||
public boolean canUseThickFur() {
|
||||
return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_THICK_FUR)
|
||||
return pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_THICK_FUR)
|
||||
&& Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.TAMING_THICK_FUR);
|
||||
}
|
||||
|
||||
public boolean canUseEnvironmentallyAware() {
|
||||
return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_ENVIRONMENTALLY_AWARE)
|
||||
return pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_ENVIRONMENTALLY_AWARE)
|
||||
&& Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.TAMING_ENVIRONMENTALLY_AWARE);
|
||||
}
|
||||
|
||||
public boolean canUseShockProof() {
|
||||
return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_SHOCK_PROOF)
|
||||
return pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_SHOCK_PROOF)
|
||||
&& Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.TAMING_SHOCK_PROOF);
|
||||
}
|
||||
|
||||
public boolean canUseHolyHound() {
|
||||
return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_ENVIRONMENTALLY_AWARE)
|
||||
return pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_ENVIRONMENTALLY_AWARE)
|
||||
&& Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.TAMING_HOLY_HOUND);
|
||||
}
|
||||
|
||||
public boolean canUseFastFoodService() {
|
||||
return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_FAST_FOOD_SERVICE)
|
||||
return pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_FAST_FOOD_SERVICE)
|
||||
&& Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.TAMING_FAST_FOOD_SERVICE);
|
||||
}
|
||||
|
||||
public boolean canUseSharpenedClaws() {
|
||||
return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_SHARPENED_CLAWS)
|
||||
return pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_SHARPENED_CLAWS)
|
||||
&& Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.TAMING_SHARPENED_CLAWS);
|
||||
}
|
||||
|
||||
public boolean canUseGore() {
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_GORE))
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_GORE))
|
||||
return false;
|
||||
|
||||
return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.TAMING_GORE);
|
||||
}
|
||||
|
||||
public boolean canUseBeastLore() {
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_BEAST_LORE))
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_BEAST_LORE))
|
||||
return false;
|
||||
|
||||
return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.TAMING_BEAST_LORE);
|
||||
@ -112,7 +109,7 @@ public class TamingManager extends SkillManager {
|
||||
* @param damage The damage being absorbed by the wolf
|
||||
*/
|
||||
public void fastFoodService(Wolf wolf, double damage) {
|
||||
//static chance (3rd param)
|
||||
//chance (3rd param)
|
||||
if (!pluginRef.getRandomChanceTools().isActivationSuccessful(SkillActivationType.RANDOM_STATIC_CHANCE, SubSkillType.TAMING_FAST_FOOD_SERVICE, getPlayer())) {
|
||||
return;
|
||||
}
|
||||
@ -157,7 +154,7 @@ public class TamingManager extends SkillManager {
|
||||
* Summon an ocelot to your side.
|
||||
*/
|
||||
public void summonOcelot() {
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_CALL_OF_THE_WILD))
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_CALL_OF_THE_WILD))
|
||||
return;
|
||||
|
||||
if (!Permissions.callOfTheWild(getPlayer(), EntityType.OCELOT)) {
|
||||
@ -171,7 +168,7 @@ public class TamingManager extends SkillManager {
|
||||
* Summon a wolf to your side.
|
||||
*/
|
||||
public void summonWolf() {
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_CALL_OF_THE_WILD))
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_CALL_OF_THE_WILD))
|
||||
return;
|
||||
|
||||
if (!Permissions.callOfTheWild(getPlayer(), EntityType.WOLF)) {
|
||||
@ -185,7 +182,7 @@ public class TamingManager extends SkillManager {
|
||||
* Summon a horse to your side.
|
||||
*/
|
||||
public void summonHorse() {
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_CALL_OF_THE_WILD))
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_CALL_OF_THE_WILD))
|
||||
return;
|
||||
|
||||
if (!Permissions.callOfTheWild(getPlayer(), EntityType.HORSE)) {
|
||||
@ -226,7 +223,7 @@ public class TamingManager extends SkillManager {
|
||||
}
|
||||
|
||||
public void pummel(LivingEntity target, Wolf wolf) {
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_PUMMEL))
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_PUMMEL))
|
||||
return;
|
||||
|
||||
if (!pluginRef.getRandomChanceTools().checkRandomChanceExecutionSuccess(new RandomChanceSkillStatic(AdvancedConfig.getInstance().getPummelChance(), getPlayer(), SubSkillType.TAMING_PUMMEL)))
|
||||
|
@ -12,7 +12,6 @@ import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockState;
|
||||
@ -32,7 +31,7 @@ public class UnarmedManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean canUseIronArm() {
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.UNARMED_IRON_ARM_STYLE))
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.UNARMED_IRON_ARM_STYLE))
|
||||
return false;
|
||||
|
||||
return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.UNARMED_IRON_ARM_STYLE);
|
||||
@ -43,14 +42,14 @@ public class UnarmedManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean canDisarm(LivingEntity target) {
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.UNARMED_DISARM))
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.UNARMED_DISARM))
|
||||
return false;
|
||||
|
||||
return target instanceof Player && ((Player) target).getInventory().getItemInMainHand().getType() != Material.AIR && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.UNARMED_DISARM);
|
||||
}
|
||||
|
||||
public boolean canDeflect() {
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.UNARMED_ARROW_DEFLECT))
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.UNARMED_ARROW_DEFLECT))
|
||||
return false;
|
||||
|
||||
Player player = getPlayer();
|
||||
@ -59,7 +58,7 @@ public class UnarmedManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean canUseBlockCracker() {
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.UNARMED_BLOCK_CRACKER))
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.UNARMED_BLOCK_CRACKER))
|
||||
return false;
|
||||
|
||||
return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.UNARMED_BLOCK_CRACKER);
|
||||
@ -150,7 +149,7 @@ public class UnarmedManager extends SkillManager {
|
||||
}
|
||||
|
||||
public double getIronArmDamage() {
|
||||
int rank = RankUtils.getRank(getPlayer(), SubSkillType.UNARMED_IRON_ARM_STYLE);
|
||||
int rank = pluginRef.getRankTools().getRank(getPlayer(), SubSkillType.UNARMED_IRON_ARM_STYLE);
|
||||
|
||||
if (rank == 1) {
|
||||
return 4;
|
||||
|
@ -9,11 +9,9 @@ import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.behaviours.WoodcuttingBehaviour;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.BlockUtils;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
@ -40,7 +38,7 @@ public class WoodcuttingManager extends SkillManager {
|
||||
|
||||
public boolean canUseLeafBlower(ItemStack heldItem) {
|
||||
return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.WOODCUTTING_LEAF_BLOWER)
|
||||
&& RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.WOODCUTTING_LEAF_BLOWER)
|
||||
&& pluginRef.getRankTools().hasUnlockedSubskill(getPlayer(), SubSkillType.WOODCUTTING_LEAF_BLOWER)
|
||||
&& ItemUtils.isAxe(heldItem);
|
||||
}
|
||||
|
||||
@ -51,7 +49,7 @@ public class WoodcuttingManager extends SkillManager {
|
||||
|
||||
public boolean canGetDoubleDrops() {
|
||||
return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.WOODCUTTING_HARVEST_LUMBER)
|
||||
&& RankUtils.hasReachedRank(1, getPlayer(), SubSkillType.WOODCUTTING_HARVEST_LUMBER)
|
||||
&& pluginRef.getRankTools().hasReachedRank(1, getPlayer(), SubSkillType.WOODCUTTING_HARVEST_LUMBER)
|
||||
&& pluginRef.getRandomChanceTools().isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.WOODCUTTING_HARVEST_LUMBER, getPlayer());
|
||||
}
|
||||
|
||||
@ -198,7 +196,7 @@ public class WoodcuttingManager extends SkillManager {
|
||||
Material type = inHand.getType();
|
||||
|
||||
for (BlockState blockState : treeFellerBlocks) {
|
||||
if (BlockUtils.isLog(blockState)) {
|
||||
if (pluginRef.getBlockTools().isLog(blockState)) {
|
||||
durabilityLoss += pluginRef.getConfigManager().getConfigSuperAbilities().getSuperAbilityLimits().getToolDurabilityDamage();
|
||||
}
|
||||
}
|
||||
@ -229,11 +227,11 @@ public class WoodcuttingManager extends SkillManager {
|
||||
treeFellerReachedThreshold = true;
|
||||
}
|
||||
|
||||
if (BlockUtils.isLog(blockState)) {
|
||||
if (pluginRef.getBlockTools().isLog(blockState)) {
|
||||
treeFellerBlocks.add(blockState);
|
||||
futureCenterBlocks.add(blockState);
|
||||
return true;
|
||||
} else if (BlockUtils.isLeaves(blockState)) {
|
||||
} else if (pluginRef.getBlockTools().isLeaves(blockState)) {
|
||||
treeFellerBlocks.add(blockState);
|
||||
return false;
|
||||
}
|
||||
@ -269,14 +267,14 @@ public class WoodcuttingManager extends SkillManager {
|
||||
xp += woodcuttingBehaviour.processTreeFellerXPGains(blockState, processedLogCount);
|
||||
Misc.dropItems(Misc.getBlockCenter(blockState), block.getDrops());
|
||||
} else {
|
||||
if (BlockUtils.isLog(blockState)) {
|
||||
if (pluginRef.getBlockTools().isLog(blockState)) {
|
||||
if (canGetDoubleDrops()) {
|
||||
woodcuttingBehaviour.checkForDoubleDrop(blockState);
|
||||
}
|
||||
xp += woodcuttingBehaviour.processTreeFellerXPGains(blockState, processedLogCount);
|
||||
Misc.dropItems(Misc.getBlockCenter(blockState), block.getDrops());
|
||||
}
|
||||
if (BlockUtils.isLeaves(blockState)) {
|
||||
if (pluginRef.getBlockTools().isLeaves(blockState)) {
|
||||
Misc.dropItems(Misc.getBlockCenter(blockState), block.getDrops());
|
||||
}
|
||||
}
|
||||
|
@ -3,8 +3,7 @@ package com.gmail.nossr50.util;
|
||||
import com.gmail.nossr50.core.MetadataConstants;
|
||||
import com.gmail.nossr50.datatypes.meta.BonusDropMeta;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.skills.repair.Repair;
|
||||
import com.gmail.nossr50.skills.salvage.Salvage;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.random.RandomChanceSkill;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
@ -15,9 +14,12 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
public final class BlockUtils {
|
||||
public final class BlockTools {
|
||||
|
||||
private BlockUtils() {
|
||||
private final mcMMO pluginRef;
|
||||
|
||||
public BlockTools(mcMMO pluginRef) {
|
||||
this.pluginRef = pluginRef;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -26,7 +28,7 @@ public final class BlockUtils {
|
||||
* @param blockState target blockstate
|
||||
* @param triple marks the block to give triple drops
|
||||
*/
|
||||
public static void markDropsAsBonus(BlockState blockState, boolean triple) {
|
||||
public void markDropsAsBonus(BlockState blockState, boolean triple) {
|
||||
if (triple)
|
||||
blockState.setMetadata(MetadataConstants.BONUS_DROPS_METAKEY, new BonusDropMeta(2, pluginRef));
|
||||
else
|
||||
@ -39,7 +41,7 @@ public final class BlockUtils {
|
||||
* @param blockState target blockstate
|
||||
* @param amount amount of extra items to drop
|
||||
*/
|
||||
public static void markDropsAsBonus(BlockState blockState, int amount) {
|
||||
public void markDropsAsBonus(BlockState blockState, int amount) {
|
||||
blockState.setMetadata(MetadataConstants.BONUS_DROPS_METAKEY, new BonusDropMeta(amount, pluginRef));
|
||||
}
|
||||
|
||||
@ -49,9 +51,9 @@ public final class BlockUtils {
|
||||
* @param blockState the blockstate
|
||||
* @return true if the player succeeded in the check
|
||||
*/
|
||||
public static boolean checkDoubleDrops(Player player, BlockState blockState, SubSkillType subSkillType) {
|
||||
public boolean checkDoubleDrops(Player player, BlockState blockState, SubSkillType subSkillType) {
|
||||
if (pluginRef.getDynamicSettingsManager().isBonusDropsEnabled(blockState.getType()) && Permissions.isSubSkillEnabled(player, subSkillType)) {
|
||||
return pluginRef.getRandomChanceTools().checkRandomChanceExecutionSuccess(new RandomChanceSkill(player, subSkillType, true));
|
||||
return pluginRef.getRandomChanceTools().checkRandomChanceExecutionSuccess(new RandomChanceSkill(pluginRef, player, subSkillType, true));
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -63,7 +65,7 @@ public final class BlockUtils {
|
||||
* @param block The {@link Block} of the block to check
|
||||
* @return true if the block awards XP, false otherwise
|
||||
*/
|
||||
public static boolean shouldBeWatched(Block block) {
|
||||
public boolean shouldBeWatched(Block block) {
|
||||
return affectedByGigaDrillBreaker(block.getType()) || affectedByGreenTerra(block.getType()) || affectedBySuperBreaker(block.getType()) || isLog(block.getType());
|
||||
}
|
||||
|
||||
@ -73,7 +75,7 @@ public final class BlockUtils {
|
||||
* @param blockState The {@link BlockState} of the block to check
|
||||
* @return true if the block awards XP, false otherwise
|
||||
*/
|
||||
public static boolean shouldBeWatched(BlockState blockState) {
|
||||
public boolean shouldBeWatched(BlockState blockState) {
|
||||
return affectedByGigaDrillBreaker(blockState) || affectedByGreenTerra(blockState) || affectedBySuperBreaker(blockState) || isLog(blockState);
|
||||
}
|
||||
|
||||
@ -83,7 +85,7 @@ public final class BlockUtils {
|
||||
* @param material The {@link Material} of the block to check
|
||||
* @return true if the block awards XP, false otherwise
|
||||
*/
|
||||
public static boolean shouldBeWatched(Material material) {
|
||||
public boolean shouldBeWatched(Material material) {
|
||||
return affectedByGigaDrillBreaker(material) || affectedByGreenTerra(material) || affectedBySuperBreaker(material) || isLog(material);
|
||||
}
|
||||
|
||||
@ -94,7 +96,7 @@ public final class BlockUtils {
|
||||
* @return true if the block should allow ability activation, false
|
||||
* otherwise
|
||||
*/
|
||||
public static boolean canActivateAbilities(BlockState blockState) {
|
||||
public boolean canActivateAbilities(BlockState blockState) {
|
||||
return !pluginRef.getMaterialMapStore().isAbilityActivationBlackListed(blockState.getType());
|
||||
}
|
||||
|
||||
@ -106,7 +108,7 @@ public final class BlockUtils {
|
||||
* @return true if the block should allow ability activation, false
|
||||
* otherwise
|
||||
*/
|
||||
public static boolean canActivateTools(BlockState blockState) {
|
||||
public boolean canActivateTools(BlockState blockState) {
|
||||
return !pluginRef.getMaterialMapStore().isToolActivationBlackListed(blockState.getType());
|
||||
}
|
||||
|
||||
@ -116,7 +118,7 @@ public final class BlockUtils {
|
||||
* @param blockState The {@link BlockState} of the block to check
|
||||
* @return true if the block is an ore, false otherwise
|
||||
*/
|
||||
public static boolean isOre(BlockState blockState) {
|
||||
public boolean isOre(BlockState blockState) {
|
||||
return MaterialUtils.isOre(blockState.getType());
|
||||
}
|
||||
|
||||
@ -126,7 +128,7 @@ public final class BlockUtils {
|
||||
* @param blockState The {@link BlockState} of the block to check
|
||||
* @return true if the block can be made mossy, false otherwise
|
||||
*/
|
||||
public static boolean canMakeMossy(BlockState blockState) {
|
||||
public boolean canMakeMossy(BlockState blockState) {
|
||||
return pluginRef.getMaterialMapStore().isMossyWhiteListed(blockState.getType());
|
||||
}
|
||||
|
||||
@ -136,7 +138,7 @@ public final class BlockUtils {
|
||||
* @param blockState The {@link BlockState} of the block to check
|
||||
* @return true if the block should affected by Green Terra, false otherwise
|
||||
*/
|
||||
public static boolean affectedByGreenTerra(BlockState blockState) {
|
||||
public boolean affectedByGreenTerra(BlockState blockState) {
|
||||
return pluginRef.getDynamicSettingsManager().getExperienceManager().hasHerbalismXp(blockState.getType());
|
||||
}
|
||||
|
||||
@ -146,7 +148,7 @@ public final class BlockUtils {
|
||||
* @param material The {@link Material} of the block to check
|
||||
* @return true if the block should affected by Green Terra, false otherwise
|
||||
*/
|
||||
public static boolean affectedByGreenTerra(Material material) {
|
||||
public boolean affectedByGreenTerra(Material material) {
|
||||
return pluginRef.getDynamicSettingsManager().getExperienceManager().hasHerbalismXp(material);
|
||||
}
|
||||
|
||||
@ -157,7 +159,7 @@ public final class BlockUtils {
|
||||
* @return true if the block should affected by Super Breaker, false
|
||||
* otherwise
|
||||
*/
|
||||
public static Boolean affectedBySuperBreaker(BlockState blockState) {
|
||||
public Boolean affectedBySuperBreaker(BlockState blockState) {
|
||||
if (pluginRef.getDynamicSettingsManager().getExperienceManager().hasMiningXp(blockState.getType()))
|
||||
return true;
|
||||
|
||||
@ -171,7 +173,7 @@ public final class BlockUtils {
|
||||
* @return true if the block should affected by Super Breaker, false
|
||||
* otherwise
|
||||
*/
|
||||
public static Boolean affectedBySuperBreaker(Material material) {
|
||||
public Boolean affectedBySuperBreaker(Material material) {
|
||||
if (pluginRef.getDynamicSettingsManager().getExperienceManager().hasMiningXp(material))
|
||||
return true;
|
||||
|
||||
@ -184,7 +186,7 @@ public final class BlockUtils {
|
||||
* @param material target blocks material
|
||||
* @return
|
||||
*/
|
||||
public static boolean isMineable(Material material) {
|
||||
public boolean isMineable(Material material) {
|
||||
switch (material) {
|
||||
case COAL_ORE:
|
||||
case DIAMOND_ORE:
|
||||
@ -211,7 +213,7 @@ public final class BlockUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isMineable(BlockState blockState) {
|
||||
public boolean isMineable(BlockState blockState) {
|
||||
return isMineable(blockState.getType());
|
||||
}
|
||||
|
||||
@ -222,7 +224,7 @@ public final class BlockUtils {
|
||||
* @return true if the block should affected by Giga Drill Breaker, false
|
||||
* otherwise
|
||||
*/
|
||||
public static boolean affectedByGigaDrillBreaker(Material material) {
|
||||
public boolean affectedByGigaDrillBreaker(Material material) {
|
||||
if (pluginRef.getDynamicSettingsManager().getExperienceManager().hasExcavationXp(material))
|
||||
return true;
|
||||
|
||||
@ -236,7 +238,7 @@ public final class BlockUtils {
|
||||
* @return true if the block should affected by Giga Drill Breaker, false
|
||||
* otherwise
|
||||
*/
|
||||
public static boolean affectedByGigaDrillBreaker(BlockState blockState) {
|
||||
public boolean affectedByGigaDrillBreaker(BlockState blockState) {
|
||||
if (pluginRef.getDynamicSettingsManager().getExperienceManager().hasExcavationXp(blockState.getType()))
|
||||
return true;
|
||||
|
||||
@ -250,7 +252,7 @@ public final class BlockUtils {
|
||||
* @return true if a shovel is typically used for digging this block
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean isDiggable(BlockState blockState) {
|
||||
public boolean isDiggable(BlockState blockState) {
|
||||
return isDiggable(blockState.getType());
|
||||
}
|
||||
|
||||
@ -260,7 +262,7 @@ public final class BlockUtils {
|
||||
* @param material target blocks material
|
||||
* @return true if a shovel is typically used for digging this block
|
||||
*/
|
||||
public static boolean isDiggable(Material material) {
|
||||
public boolean isDiggable(Material material) {
|
||||
switch (material) {
|
||||
case CLAY:
|
||||
case FARMLAND:
|
||||
@ -288,7 +290,7 @@ public final class BlockUtils {
|
||||
* @param blockState The {@link BlockState} of the block to check
|
||||
* @return true if the block is a log, false otherwise
|
||||
*/
|
||||
public static boolean isLog(BlockState blockState) {
|
||||
public boolean isLog(BlockState blockState) {
|
||||
if (pluginRef.getDynamicSettingsManager().getExperienceManager().hasWoodcuttingXp(blockState.getType()))
|
||||
return true;
|
||||
|
||||
@ -302,7 +304,7 @@ public final class BlockUtils {
|
||||
* @param material The {@link Material} of the block to check
|
||||
* @return true if the block is a log, false otherwise
|
||||
*/
|
||||
public static boolean isLog(Material material) {
|
||||
public boolean isLog(Material material) {
|
||||
if (pluginRef.getDynamicSettingsManager().getExperienceManager().hasWoodcuttingXp(material))
|
||||
return true;
|
||||
|
||||
@ -316,7 +318,7 @@ public final class BlockUtils {
|
||||
* @param material target material
|
||||
* @return true if the block is gathered via axe
|
||||
*/
|
||||
public static boolean isLoggingRelated(Material material) {
|
||||
public boolean isLoggingRelated(Material material) {
|
||||
switch (material) {
|
||||
case ACACIA_LOG:
|
||||
case BIRCH_LOG:
|
||||
@ -354,7 +356,7 @@ public final class BlockUtils {
|
||||
* @param blockState target blockstate
|
||||
* @return true if the block is gathered via axe
|
||||
*/
|
||||
public static boolean isLoggingRelated(BlockState blockState) {
|
||||
public boolean isLoggingRelated(BlockState blockState) {
|
||||
return isLoggingRelated(blockState.getType());
|
||||
}
|
||||
|
||||
@ -364,7 +366,7 @@ public final class BlockUtils {
|
||||
* @param blockState The {@link BlockState} of the block to check
|
||||
* @return true if the block is a leaf, false otherwise
|
||||
*/
|
||||
public static boolean isLeaves(BlockState blockState) {
|
||||
public boolean isLeaves(BlockState blockState) {
|
||||
return pluginRef.getMaterialMapStore().isLeavesWhiteListed(blockState.getType());
|
||||
}
|
||||
|
||||
@ -374,7 +376,7 @@ public final class BlockUtils {
|
||||
* @param blockState The {@link BlockState} of the block to check
|
||||
* @return true if the block should affected by Flux Mining, false otherwise
|
||||
*/
|
||||
public static boolean affectedByFluxMining(BlockState blockState) {
|
||||
public boolean affectedByFluxMining(BlockState blockState) {
|
||||
switch (blockState.getType()) {
|
||||
case IRON_ORE:
|
||||
case GOLD_ORE:
|
||||
@ -393,7 +395,7 @@ public final class BlockUtils {
|
||||
* @return true if the block can be activate Herbalism abilities, false
|
||||
* otherwise
|
||||
*/
|
||||
public static boolean canActivateHerbalism(BlockState blockState) {
|
||||
public boolean canActivateHerbalism(BlockState blockState) {
|
||||
return pluginRef.getMaterialMapStore().isHerbalismAbilityWhiteListed(blockState.getType());
|
||||
}
|
||||
|
||||
@ -404,7 +406,7 @@ public final class BlockUtils {
|
||||
* @return true if the block should affected by Block Cracker, false
|
||||
* otherwise
|
||||
*/
|
||||
public static boolean affectedByBlockCracker(BlockState blockState) {
|
||||
public boolean affectedByBlockCracker(BlockState blockState) {
|
||||
return pluginRef.getMaterialMapStore().isBlockCrackerWhiteListed(blockState.getType());
|
||||
}
|
||||
|
||||
@ -414,23 +416,23 @@ public final class BlockUtils {
|
||||
* @param blockState The {@link BlockState} of the block to check
|
||||
* @return true if the block can be made into Mycelium, false otherwise
|
||||
*/
|
||||
public static boolean canMakeShroomy(BlockState blockState) {
|
||||
public boolean canMakeShroomy(BlockState blockState) {
|
||||
return pluginRef.getMaterialMapStore().isShroomyWhiteListed(blockState.getType());
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a given block is an mcMMO anvil
|
||||
*
|
||||
* @param blockState The {@link BlockState} of the block to check
|
||||
* @return true if the block is an mcMMO anvil, false otherwise
|
||||
*/
|
||||
public static boolean isMcMMOAnvil(BlockState blockState) {
|
||||
Material type = blockState.getType();
|
||||
// /**
|
||||
// * Determine if a given block is an mcMMO anvil
|
||||
// *
|
||||
// * @param blockState The {@link BlockState} of the block to check
|
||||
// * @return true if the block is an mcMMO anvil, false otherwise
|
||||
// */
|
||||
// public boolean isMcMMOAnvil(BlockState blockState) {
|
||||
// Material type = blockState.getType();
|
||||
//
|
||||
// return type == Repair.getInstance().getAnvilMaterial() || type == Salvage.anvilMaterial;
|
||||
// }
|
||||
|
||||
return type == Repair.getInstance().getAnvilMaterial() || type == Salvage.anvilMaterial;
|
||||
}
|
||||
|
||||
public static boolean isPistonPiece(BlockState blockState) {
|
||||
public boolean isPistonPiece(BlockState blockState) {
|
||||
Material type = blockState.getType();
|
||||
|
||||
return type == Material.MOVING_PISTON || type == Material.AIR;
|
||||
@ -441,7 +443,7 @@ public final class BlockUtils {
|
||||
*
|
||||
* @return HashSet with the IDs of every transparent block
|
||||
*/
|
||||
public static HashSet<Material> getTransparentBlocks() {
|
||||
public HashSet<Material> getTransparentBlocks() {
|
||||
HashSet<Material> transparentBlocks = new HashSet<>();
|
||||
|
||||
for (Material material : Material.values()) {
|
||||
@ -453,7 +455,7 @@ public final class BlockUtils {
|
||||
return transparentBlocks;
|
||||
}
|
||||
|
||||
public static boolean isFullyGrown(BlockState blockState) {
|
||||
public boolean isFullyGrown(BlockState blockState) {
|
||||
BlockData data = blockState.getBlockData();
|
||||
if (data.getMaterial() == Material.CACTUS || data.getMaterial() == Material.SUGAR_CANE)
|
||||
return true;
|
@ -411,8 +411,8 @@ public class EventManager {
|
||||
return !isCancelled;
|
||||
}
|
||||
|
||||
public void callAbilityDeactivateEvent(Player player, SuperAbilityType ability) {
|
||||
McMMOPlayerAbilityDeactivateEvent event = new McMMOPlayerAbilityDeactivateEvent(player, PrimarySkillType.getPrimarySkillBySuperAbility(ability));
|
||||
public void callAbilityDeactivateEvent(Player player, SuperAbilityType superAbilityType) {
|
||||
McMMOPlayerAbilityDeactivateEvent event = new McMMOPlayerAbilityDeactivateEvent(player, pluginRef.getSkillTools().getPrimarySkillBySuperAbility(superAbilityType));
|
||||
pluginRef.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
||||
import com.gmail.nossr50.listeners.InteractionManager;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.*;
|
||||
@ -273,7 +272,7 @@ public class TextComponentFactory {
|
||||
//Get skill name
|
||||
String skillName = subSkillType.getLocaleName();
|
||||
|
||||
boolean skillUnlocked = RankUtils.hasUnlockedSubskill(player, subSkillType);
|
||||
boolean skillUnlocked = pluginRef.getRankTools().hasUnlockedSubskill(player, subSkillType);
|
||||
|
||||
TextComponent textComponent = initNewSkillTextComponent(player, skillName, subSkillType, skillUnlocked);
|
||||
|
||||
@ -297,7 +296,7 @@ public class TextComponentFactory {
|
||||
//Setup Text Component
|
||||
SubSkillType subSkillType = abstractSubSkill.getSubSkillType();
|
||||
|
||||
boolean skillUnlocked = RankUtils.hasUnlockedSubskill(player, subSkillType);
|
||||
boolean skillUnlocked = pluginRef.getRankTools().hasUnlockedSubskill(player, subSkillType);
|
||||
|
||||
TextComponent textComponent = initNewSkillTextComponent(player, skillName, subSkillType, skillUnlocked);
|
||||
|
||||
@ -313,7 +312,7 @@ public class TextComponentFactory {
|
||||
private TextComponent initNewSkillTextComponent(Player player, String skillName, SubSkillType subSkillType, boolean skillUnlocked) {
|
||||
TextComponent textComponent;
|
||||
if (skillUnlocked) {
|
||||
if (RankUtils.getHighestRank(subSkillType) == RankUtils.getRank(player, subSkillType) && subSkillType.getNumRanks() > 1)
|
||||
if (pluginRef.getRankTools().getHighestRank(subSkillType) == pluginRef.getRankTools().getRank(player, subSkillType) && subSkillType.getNumRanks() > 1)
|
||||
textComponent = new TextComponent(pluginRef.getLocaleManager().getString("JSON.Hover.MaxRankSkillName", skillName));
|
||||
else
|
||||
textComponent = new TextComponent(pluginRef.getLocaleManager().getString("JSON.Hover.SkillName", skillName));
|
||||
@ -322,7 +321,7 @@ public class TextComponentFactory {
|
||||
|
||||
} else {
|
||||
textComponent = new TextComponent(pluginRef.getLocaleManager().getString("JSON.Hover.Mystery",
|
||||
String.valueOf(RankUtils.getUnlockLevel(subSkillType))));
|
||||
String.valueOf(pluginRef.getRankTools().getUnlockLevel(subSkillType))));
|
||||
|
||||
textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/mmoinfo ???"));
|
||||
}
|
||||
@ -364,23 +363,23 @@ public class TextComponentFactory {
|
||||
SubSkillType subSkillType = abstractSubSkill.getSubSkillType();
|
||||
|
||||
//SubSkillType Name
|
||||
ComponentBuilder componentBuilder = setupSkillComponentNameStyle(player, skillName, subSkillType, RankUtils.hasUnlockedSubskill(player, abstractSubSkill));
|
||||
ComponentBuilder componentBuilder = setupSkillComponentNameStyle(player, skillName, subSkillType, pluginRef.getRankTools().hasUnlockedSubskill(player, abstractSubSkill));
|
||||
|
||||
if (!RankUtils.hasUnlockedSubskill(player, abstractSubSkill)) {
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(player, abstractSubSkill)) {
|
||||
//Skill is not unlocked yet
|
||||
addLocked(abstractSubSkill, ccLocked, ccLevelRequirement, ccLevelRequired, componentBuilder);
|
||||
} else {
|
||||
addSubSkillTypeToHoverEventJSON(abstractSubSkill, componentBuilder);
|
||||
|
||||
//RANK
|
||||
int curRank = RankUtils.getRank(player, abstractSubSkill);
|
||||
int curRank = pluginRef.getRankTools().getRank(player, abstractSubSkill);
|
||||
int nextRank = 0;
|
||||
|
||||
if (curRank < abstractSubSkill.getNumRanks() && abstractSubSkill.getNumRanks() > 0) {
|
||||
nextRank = RankUtils.getRankUnlockLevel(abstractSubSkill, curRank + 1);
|
||||
nextRank = pluginRef.getRankTools().getRankUnlockLevel(abstractSubSkill, curRank + 1);
|
||||
}
|
||||
|
||||
addRanked(ccRank, ccCurRank, ccPossessive, ccNumRanks, componentBuilder, abstractSubSkill.getNumRanks(), RankUtils.getRank(player, abstractSubSkill), nextRank);
|
||||
addRanked(ccRank, ccCurRank, ccPossessive, ccNumRanks, componentBuilder, abstractSubSkill.getNumRanks(), pluginRef.getRankTools().getRank(player, abstractSubSkill), nextRank);
|
||||
|
||||
componentBuilder.append(pluginRef.getLocaleManager().getString("JSON.DescriptionHeader"));
|
||||
componentBuilder.append("\n").append(abstractSubSkill.getDescription()).append("\n");
|
||||
@ -399,13 +398,13 @@ public class TextComponentFactory {
|
||||
private ComponentBuilder setupSkillComponentNameStyle(Player player, String skillName, SubSkillType subSkillType, boolean skillUnlocked) {
|
||||
ComponentBuilder componentBuilder;
|
||||
if (skillUnlocked) {
|
||||
if (RankUtils.getHighestRank(subSkillType) == RankUtils.getRank(player, subSkillType) && subSkillType.getNumRanks() > 1)
|
||||
if (pluginRef.getRankTools().getHighestRank(subSkillType) == pluginRef.getRankTools().getRank(player, subSkillType) && subSkillType.getNumRanks() > 1)
|
||||
componentBuilder = getNewComponentBuilder(pluginRef.getLocaleManager().getString("JSON.Hover.MaxRankSkillName", skillName));
|
||||
else
|
||||
componentBuilder = getNewComponentBuilder(pluginRef.getLocaleManager().getString("JSON.Hover.SkillName", skillName));
|
||||
} else
|
||||
componentBuilder = getNewComponentBuilder(pluginRef.getLocaleManager().getString("JSON.Hover.Mystery",
|
||||
String.valueOf(RankUtils.getUnlockLevel(subSkillType))));
|
||||
String.valueOf(pluginRef.getRankTools().getUnlockLevel(subSkillType))));
|
||||
return componentBuilder;
|
||||
}
|
||||
|
||||
@ -433,13 +432,13 @@ public class TextComponentFactory {
|
||||
|
||||
private void addLocked(SubSkillType subSkillType, ChatColor ccLocked, ChatColor ccLevelRequirement, ChatColor ccLevelRequired, ComponentBuilder componentBuilder) {
|
||||
addLocked(ccLocked, ccLevelRequirement, componentBuilder);
|
||||
componentBuilder.append(String.valueOf(RankUtils.getSubSkillUnlockLevel(subSkillType, 1))).color(ccLevelRequired);
|
||||
componentBuilder.append(String.valueOf(pluginRef.getRankTools().getSubSkillUnlockLevel(subSkillType, 1))).color(ccLevelRequired);
|
||||
//componentBuilder.append("\n");
|
||||
}
|
||||
|
||||
private void addLocked(AbstractSubSkill abstractSubSkill, ChatColor ccLocked, ChatColor ccLevelRequirement, ChatColor ccLevelRequired, ComponentBuilder componentBuilder) {
|
||||
addLocked(ccLocked, ccLevelRequirement, componentBuilder);
|
||||
componentBuilder.append(String.valueOf(RankUtils.getSubSkillUnlockLevel(abstractSubSkill, 1))).color(ccLevelRequired);
|
||||
componentBuilder.append(String.valueOf(pluginRef.getRankTools().getSubSkillUnlockLevel(abstractSubSkill, 1))).color(ccLevelRequired);
|
||||
//componentBuilder.append("\n");m
|
||||
}
|
||||
|
||||
@ -468,9 +467,9 @@ public class TextComponentFactory {
|
||||
ChatColor ccLevelRequired = ChatColor.RED;
|
||||
|
||||
//SubSkillType Name
|
||||
ComponentBuilder componentBuilder = setupSkillComponentNameStyle(player, skillName, subSkillType, RankUtils.hasUnlockedSubskill(player, subSkillType));
|
||||
ComponentBuilder componentBuilder = setupSkillComponentNameStyle(player, skillName, subSkillType, pluginRef.getRankTools().hasUnlockedSubskill(player, subSkillType));
|
||||
|
||||
if (!RankUtils.hasUnlockedSubskill(player, subSkillType)) {
|
||||
if (!pluginRef.getRankTools().hasUnlockedSubskill(player, subSkillType)) {
|
||||
//Skill is not unlocked yet
|
||||
addLocked(subSkillType, ccLocked, ccLevelRequirement, ccLevelRequired, componentBuilder);
|
||||
} else {
|
||||
@ -478,14 +477,14 @@ public class TextComponentFactory {
|
||||
|
||||
//RANK
|
||||
if (subSkillType.getNumRanks() > 0) {
|
||||
int curRank = RankUtils.getRank(player, subSkillType);
|
||||
int curRank = pluginRef.getRankTools().getRank(player, subSkillType);
|
||||
int nextRank = 0;
|
||||
|
||||
if (curRank < subSkillType.getNumRanks() && subSkillType.getNumRanks() > 0) {
|
||||
nextRank = RankUtils.getRankUnlockLevel(subSkillType, curRank + 1);
|
||||
nextRank = pluginRef.getRankTools().getRankUnlockLevel(subSkillType, curRank + 1);
|
||||
}
|
||||
|
||||
addRanked(ccRank, ccCurRank, ccPossessive, ccNumRanks, componentBuilder, subSkillType.getNumRanks(), RankUtils.getRank(player, subSkillType), nextRank);
|
||||
addRanked(ccRank, ccCurRank, ccPossessive, ccNumRanks, componentBuilder, subSkillType.getNumRanks(), pluginRef.getRankTools().getRank(player, subSkillType), nextRank);
|
||||
|
||||
}
|
||||
|
||||
@ -536,7 +535,7 @@ public class TextComponentFactory {
|
||||
|
||||
public TextComponent getSubSkillUnlockedNotificationComponents(Player player, SubSkillType subSkillType) {
|
||||
TextComponent unlockMessage = new TextComponent("");
|
||||
unlockMessage.setText(pluginRef.getLocaleManager().getString("JSON.SkillUnlockMessage", subSkillType.getLocaleName(), RankUtils.getRank(player, subSkillType)));
|
||||
unlockMessage.setText(pluginRef.getLocaleManager().getString("JSON.SkillUnlockMessage", subSkillType.getLocaleName(), pluginRef.getRankTools().getRank(player, subSkillType)));
|
||||
unlockMessage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, getSubSkillHoverComponent(player, subSkillType)));
|
||||
unlockMessage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/" + subSkillType.getParentSkill().toString().toLowerCase()));
|
||||
return unlockMessage;
|
||||
|
@ -376,7 +376,7 @@ public final class CombatTools {
|
||||
}
|
||||
|
||||
public int getLimitBreakDamage(Player player, SubSkillType subSkillType) {
|
||||
return RankUtils.getRank(player, subSkillType);
|
||||
return pluginRef.getRankTools().getRank(player, subSkillType);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -386,7 +386,7 @@ public final class CombatTools {
|
||||
* @return true if the player has access to the limit break
|
||||
*/
|
||||
public boolean canUseLimitBreak(Player player, SubSkillType subSkillType) {
|
||||
return RankUtils.hasUnlockedSubskill(player, subSkillType)
|
||||
return pluginRef.getRankTools().hasUnlockedSubskill(player, subSkillType)
|
||||
&& Permissions.isSubSkillEnabled(player, subSkillType);
|
||||
}
|
||||
|
||||
|
@ -8,28 +8,34 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
||||
import com.gmail.nossr50.listeners.InteractionManager;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.runnables.skills.SkillUnlockNotificationTask;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import ninja.leaping.configurate.commented.CommentedConfigurationNode;
|
||||
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class RankUtils {
|
||||
private static HashMap<String, HashMap<Integer, Integer>> subSkillRanks;
|
||||
private static int count = 0;
|
||||
public class RankTools {
|
||||
|
||||
private final mcMMO pluginRef;
|
||||
|
||||
public RankTools(mcMMO pluginRef) {
|
||||
this.pluginRef = pluginRef;
|
||||
}
|
||||
|
||||
private HashMap<String, HashMap<Integer, Integer>> subSkillRanks;
|
||||
private int count = 0;
|
||||
|
||||
/**
|
||||
* @param plugin plugin instance ref
|
||||
* @param mcMMOPlayer target player
|
||||
* @param primarySkillType target primary skill
|
||||
* @param newLevel the new level of this skill
|
||||
*/
|
||||
public static void executeSkillUnlockNotifications(Plugin plugin, McMMOPlayer mcMMOPlayer, PrimarySkillType primarySkillType, int newLevel) {
|
||||
for (SubSkillType subSkillType : primarySkillType.getSkillAbilities()) {
|
||||
public void executeSkillUnlockNotifications(McMMOPlayer mcMMOPlayer, PrimarySkillType primarySkillType, int newLevel) {
|
||||
for (SubSkillType subSkillType : pluginRef.getSkillTools().getSkillAbilities(primarySkillType)) {
|
||||
int playerRankInSkill = getRank(mcMMOPlayer.getPlayer(), subSkillType);
|
||||
|
||||
HashMap<Integer, Integer> innerMap = subSkillRanks.get(subSkillType.toString());
|
||||
@ -44,21 +50,21 @@ public class RankUtils {
|
||||
|
||||
//The players level is the exact level requirement for this skill
|
||||
if (newLevel == innerMap.get(playerRankInSkill)) {
|
||||
SkillUnlockNotificationTask skillUnlockNotificationTask = new SkillUnlockNotificationTask(mcMMOPlayer, subSkillType);
|
||||
SkillUnlockNotificationTask skillUnlockNotificationTask = new SkillUnlockNotificationTask(pluginRef, mcMMOPlayer, subSkillType);
|
||||
|
||||
skillUnlockNotificationTask.runTaskLater(plugin, (count * 100));
|
||||
skillUnlockNotificationTask.runTaskLater(pluginRef, (count * 100));
|
||||
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void resetUnlockDelayTimer() {
|
||||
public void resetUnlockDelayTimer() {
|
||||
count = 0;
|
||||
}
|
||||
|
||||
/* NEW SYSTEM */
|
||||
private static void addRanks(AbstractSubSkill abstractSubSkill) {
|
||||
private void addRanks(AbstractSubSkill abstractSubSkill) {
|
||||
//Fill out the rank array
|
||||
for (int i = 0; i < abstractSubSkill.getNumRanks(); i++) {
|
||||
//This adds the highest ranks first
|
||||
@ -69,7 +75,7 @@ public class RankUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static void addRanks(SubSkillType subSkillType) {
|
||||
private void addRanks(SubSkillType subSkillType) {
|
||||
//Fill out the rank array
|
||||
for (int i = 0; i < subSkillType.getNumRanks(); i++) {
|
||||
//This adds the highest ranks first
|
||||
@ -83,7 +89,7 @@ public class RankUtils {
|
||||
/**
|
||||
* Populates the ranks for every skill we know about
|
||||
*/
|
||||
public static void populateRanks() {
|
||||
public void populateRanks() {
|
||||
for (SubSkillType subSkillType : SubSkillType.values()) {
|
||||
addRanks(subSkillType);
|
||||
}
|
||||
@ -100,7 +106,7 @@ public class RankUtils {
|
||||
* @param subSkillType the target subskill
|
||||
* @return true if the player has at least one rank in the skill
|
||||
*/
|
||||
public static boolean hasUnlockedSubskill(Player player, SubSkillType subSkillType) {
|
||||
public boolean hasUnlockedSubskill(Player player, SubSkillType subSkillType) {
|
||||
int curRank = getRank(player, subSkillType);
|
||||
|
||||
//-1 means the skill has no unlockable levels and is therefor unlocked
|
||||
@ -114,7 +120,7 @@ public class RankUtils {
|
||||
* @param abstractSubSkill the target subskill
|
||||
* @return true if the player has at least one rank in the skill
|
||||
*/
|
||||
public static boolean hasUnlockedSubskill(Player player, AbstractSubSkill abstractSubSkill) {
|
||||
public boolean hasUnlockedSubskill(Player player, AbstractSubSkill abstractSubSkill) {
|
||||
int curRank = getRank(player, abstractSubSkill);
|
||||
|
||||
//-1 means the skill has no unlockable levels and is therefor unlocked
|
||||
@ -129,7 +135,7 @@ public class RankUtils {
|
||||
* @param subSkillType the target subskill
|
||||
* @return true if the player is at least that rank in this subskill
|
||||
*/
|
||||
public static boolean hasReachedRank(int rank, Player player, SubSkillType subSkillType) {
|
||||
public boolean hasReachedRank(int rank, Player player, SubSkillType subSkillType) {
|
||||
return getRank(player, subSkillType) >= rank;
|
||||
}
|
||||
|
||||
@ -141,7 +147,7 @@ public class RankUtils {
|
||||
* @param abstractSubSkill the target subskill
|
||||
* @return true if the player is at least that rank in this subskill
|
||||
*/
|
||||
public static boolean hasReachedRank(int rank, Player player, AbstractSubSkill abstractSubSkill) {
|
||||
public boolean hasReachedRank(int rank, Player player, AbstractSubSkill abstractSubSkill) {
|
||||
return getRank(player, abstractSubSkill) >= rank;
|
||||
}
|
||||
|
||||
@ -152,7 +158,7 @@ public class RankUtils {
|
||||
* @param subSkillType Target subskill
|
||||
* @return The rank the player currently has achieved in this skill. -1 for skills without ranks.
|
||||
*/
|
||||
public static int getRank(Player player, SubSkillType subSkillType) {
|
||||
public int getRank(Player player, SubSkillType subSkillType) {
|
||||
String skillName = subSkillType.toString();
|
||||
int numRanks = subSkillType.getNumRanks();
|
||||
|
||||
@ -172,7 +178,7 @@ public class RankUtils {
|
||||
return 0;
|
||||
|
||||
//Skill level of parent skill
|
||||
int currentSkillLevel = pluginRef.getUserManager().getPlayer(player).getSkillLevel(subSkillType.getParentSkill());
|
||||
int currentSkillLevel = pluginRef.getUserManager().getPlayer(player).getSkillLevel(subSkillType.getParentSkill(pluginRef));
|
||||
|
||||
for (int i = 0; i < numRanks; i++) {
|
||||
//Compare against the highest to lowest rank in that order
|
||||
@ -198,7 +204,7 @@ public class RankUtils {
|
||||
* @param abstractSubSkill Target subskill
|
||||
* @return The rank the player currently has achieved in this skill. -1 for skills without ranks.
|
||||
*/
|
||||
public static int getRank(Player player, AbstractSubSkill abstractSubSkill) {
|
||||
public int getRank(Player player, AbstractSubSkill abstractSubSkill) {
|
||||
String skillName = abstractSubSkill.getConfigKeyName();
|
||||
int numRanks = abstractSubSkill.getNumRanks();
|
||||
|
||||
@ -243,7 +249,7 @@ public class RankUtils {
|
||||
* @param abstractSubSkill The subskill to add ranks for
|
||||
* @param rank The rank to add
|
||||
*/
|
||||
private static void addRank(AbstractSubSkill abstractSubSkill, int rank) {
|
||||
private void addRank(AbstractSubSkill abstractSubSkill, int rank) {
|
||||
initMaps(abstractSubSkill.getConfigKeyName());
|
||||
|
||||
HashMap<Integer, Integer> rankMap = subSkillRanks.get(abstractSubSkill.getConfigKeyName());
|
||||
@ -252,7 +258,7 @@ public class RankUtils {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
private static void addRank(SubSkillType subSkillType, int rank) {
|
||||
private void addRank(SubSkillType subSkillType, int rank) {
|
||||
initMaps(subSkillType.toString());
|
||||
|
||||
HashMap<Integer, Integer> rankMap = subSkillRanks.get(subSkillType.toString());
|
||||
@ -260,14 +266,14 @@ public class RankUtils {
|
||||
rankMap.put(rank, getRankUnlockLevel(subSkillType, rank));
|
||||
}
|
||||
|
||||
private static void initMaps(String s) {
|
||||
private void initMaps(String s) {
|
||||
if (subSkillRanks == null)
|
||||
subSkillRanks = new HashMap<>();
|
||||
|
||||
subSkillRanks.computeIfAbsent(s, k -> new HashMap<>());
|
||||
}
|
||||
|
||||
/* public static int getSubSkillUnlockRequirement(SubSkillType subSkillType)
|
||||
/* public int getSubSkillUnlockRequirement(SubSkillType subSkillType)
|
||||
{
|
||||
String skillName = subSkillType.toString();
|
||||
int numRanks = subSkillType.getNumRanks();
|
||||
@ -292,11 +298,11 @@ public class RankUtils {
|
||||
* @return The level at which this rank unlocks
|
||||
*/
|
||||
@Deprecated
|
||||
public static int getRankUnlockLevel(SubSkillType subSkillType, int rank) {
|
||||
public int getRankUnlockLevel(SubSkillType subSkillType, int rank) {
|
||||
return getSubSkillUnlockLevel(subSkillType, rank);
|
||||
}
|
||||
|
||||
public static int getRankUnlockLevel(AbstractSubSkill abstractSubSkill, int rank) {
|
||||
public int getRankUnlockLevel(AbstractSubSkill abstractSubSkill, int rank) {
|
||||
return getSubSkillUnlockLevel(abstractSubSkill, rank);
|
||||
}
|
||||
|
||||
@ -306,7 +312,7 @@ public class RankUtils {
|
||||
* @param subSkillType target subskill
|
||||
* @return The unlock requirements for rank 1 in this skill
|
||||
*/
|
||||
public static int getUnlockLevel(SubSkillType subSkillType) {
|
||||
public int getUnlockLevel(SubSkillType subSkillType) {
|
||||
return getSubSkillUnlockLevel(subSkillType, 1);
|
||||
}
|
||||
|
||||
@ -316,7 +322,7 @@ public class RankUtils {
|
||||
* @param abstractSubSkill target subskill
|
||||
* @return The unlock requirements for rank 1 in this skill
|
||||
*/
|
||||
public static int getUnlockLevel(AbstractSubSkill abstractSubSkill) {
|
||||
public int getUnlockLevel(AbstractSubSkill abstractSubSkill) {
|
||||
return getSubSkillUnlockLevel(abstractSubSkill, 1);
|
||||
}
|
||||
|
||||
@ -326,11 +332,11 @@ public class RankUtils {
|
||||
* @param subSkillType target subskill
|
||||
* @return the last rank of a subskill
|
||||
*/
|
||||
public static int getHighestRank(SubSkillType subSkillType) {
|
||||
public int getHighestRank(SubSkillType subSkillType) {
|
||||
return subSkillType.getNumRanks();
|
||||
}
|
||||
|
||||
public static String getHighestRankStr(SubSkillType subSkillType) {
|
||||
public String getHighestRankStr(SubSkillType subSkillType) {
|
||||
return String.valueOf(subSkillType.getNumRanks());
|
||||
}
|
||||
|
||||
@ -340,11 +346,11 @@ public class RankUtils {
|
||||
* @param abstractSubSkill target subskill
|
||||
* @return the last rank of a subskill
|
||||
*/
|
||||
public static int getHighestRank(AbstractSubSkill abstractSubSkill) {
|
||||
public int getHighestRank(AbstractSubSkill abstractSubSkill) {
|
||||
return abstractSubSkill.getNumRanks();
|
||||
}
|
||||
|
||||
public static int getSuperAbilityUnlockRequirement(SuperAbilityType superAbilityType) {
|
||||
public int getSuperAbilityUnlockRequirement(SuperAbilityType superAbilityType) {
|
||||
return getRankUnlockLevel(superAbilityType.getSubSkillTypeDefinition(), 1);
|
||||
}
|
||||
|
||||
@ -355,7 +361,7 @@ public class RankUtils {
|
||||
* @param rank the rank we are checking
|
||||
* @return the level requirement for a subskill at this particular rank
|
||||
*/
|
||||
public static int getSubSkillUnlockLevel(SubSkillType subSkillType, int rank) {
|
||||
public int getSubSkillUnlockLevel(SubSkillType subSkillType, int rank) {
|
||||
return findRankByRootAddress(rank, subSkillType);
|
||||
}
|
||||
|
||||
@ -366,7 +372,7 @@ public class RankUtils {
|
||||
* @param rank the rank we are checking
|
||||
* @return the level requirement for a subskill at this particular rank
|
||||
*/
|
||||
public static int getSubSkillUnlockLevel(AbstractSubSkill abstractSubSkill, int rank) {
|
||||
public int getSubSkillUnlockLevel(AbstractSubSkill abstractSubSkill, int rank) {
|
||||
return findRankByRootAddress(rank, abstractSubSkill.getSubSkillType());
|
||||
}
|
||||
|
||||
@ -377,13 +383,13 @@ public class RankUtils {
|
||||
* @param rank the rank we are checking
|
||||
* @return the level requirement for a subskill at this particular rank
|
||||
*/
|
||||
private static int findRankByRootAddress(int rank, SubSkillType subSkillType) {
|
||||
private int findRankByRootAddress(int rank, SubSkillType subSkillType) {
|
||||
|
||||
CommentedConfigurationNode rankConfigRoot = pluginRef.getConfigManager().getConfigRanksRootNode();
|
||||
|
||||
try {
|
||||
SkillRankProperty skillRankProperty
|
||||
= (SkillRankProperty) rankConfigRoot.getNode(subSkillType.getParentSkill().getCapitalizedPrimarySkillName())
|
||||
= (SkillRankProperty) rankConfigRoot.getNode(pluginRef.getSkillTools().getCapitalizedPrimarySkillName(subSkillType.getParentSkill(pluginRef)))
|
||||
.getNode(subSkillType.getHoconFriendlyConfigName())
|
||||
.getValue(TypeToken.of(SkillRankProperty.class));
|
||||
|
||||
@ -397,10 +403,10 @@ public class RankUtils {
|
||||
}
|
||||
|
||||
//Default to the max level for the skill if any errors were encountered incorrect
|
||||
return pluginRef.getConfigManager().getConfigLeveling().getSkillLevelCap(subSkillType.getParentSkill());
|
||||
return pluginRef.getConfigManager().getConfigLeveling().getSkillLevelCap(subSkillType.getParentSkill(pluginRef));
|
||||
}
|
||||
|
||||
public static boolean isPlayerMaxRankInSubSkill(Player player, SubSkillType subSkillType) {
|
||||
public boolean isPlayerMaxRankInSubSkill(Player player, SubSkillType subSkillType) {
|
||||
int playerRank = getRank(player, subSkillType);
|
||||
int highestRank = getHighestRank(subSkillType);
|
||||
|
@ -276,7 +276,7 @@ public class SkillTools {
|
||||
}
|
||||
|
||||
public int handleFoodSkills(Player player, int eventFoodLevel, SubSkillType subSkillType) {
|
||||
int curRank = RankUtils.getRank(player, subSkillType);
|
||||
int curRank = pluginRef.getRankTools().getRank(player, subSkillType);
|
||||
|
||||
int currentFoodLevel = player.getFoodLevel();
|
||||
int foodChange = eventFoodLevel - currentFoodLevel;
|
||||
@ -643,7 +643,7 @@ public class SkillTools {
|
||||
}
|
||||
|
||||
public boolean isSuperAbilityUnlocked(PrimarySkillType primarySkillType, Player player) {
|
||||
return RankUtils.getRank(player, getSuperAbility(primarySkillType).getSubSkillTypeDefinition()) >= 1;
|
||||
return pluginRef.getRankTools().getRank(player, getSuperAbility(primarySkillType).getSubSkillTypeDefinition()) >= 1;
|
||||
}
|
||||
|
||||
public boolean getPVPEnabled(PrimarySkillType primarySkillType) {
|
||||
|
Loading…
Reference in New Issue
Block a user