From 0ca01403480d1f498a2d465ee8a293f39ccd44ee Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 3 Apr 2019 19:55:52 -0700 Subject: [PATCH] Code Cleanup pt 3 --- .../gmail/nossr50/commands/McImportCommand.java | 8 +++----- .../party/alliance/PartyAllianceCommand.java | 3 +-- .../commands/skills/AcrobaticsCommand.java | 5 ++--- .../nossr50/commands/skills/ArcheryCommand.java | 5 ++--- .../nossr50/commands/skills/AxesCommand.java | 3 +-- .../commands/skills/HerbalismCommand.java | 9 ++++----- .../nossr50/commands/skills/MiningCommand.java | 3 +-- .../nossr50/commands/skills/RepairCommand.java | 3 +-- .../nossr50/commands/skills/SkillCommand.java | 4 ++-- .../nossr50/commands/skills/SmeltingCommand.java | 3 +-- .../nossr50/commands/skills/SwordsCommand.java | 5 ++--- .../nossr50/commands/skills/TamingCommand.java | 3 +-- .../nossr50/commands/skills/UnarmedCommand.java | 7 +++---- .../commands/skills/WoodcuttingCommand.java | 3 +-- .../config/hocon/CustomEnumValueSerializer.java | 3 ++- .../CustomEnumValueSerializerPartyFeature.java | 3 ++- .../config/hocon/RepairableSerializer.java | 3 ++- .../hocon/playerleveling/ConfigLeveling.java | 4 ++-- .../com/gmail/nossr50/datatypes/party/Party.java | 9 ++++----- .../nossr50/datatypes/player/McMMOPlayer.java | 3 --- .../gmail/nossr50/listeners/EntityListener.java | 9 --------- .../nossr50/listeners/InventoryListener.java | 1 - .../gmail/nossr50/listeners/PlayerListener.java | 2 -- .../gmail/nossr50/listeners/SelfListener.java | 1 - .../com/gmail/nossr50/party/PartyManager.java | 5 ++--- .../runnables/skills/AbilityDisableTask.java | 8 ++++---- .../skills/alchemy/AlchemyPotionBrewer.java | 3 --- .../com/gmail/nossr50/skills/mining/Mining.java | 2 -- .../java/com/gmail/nossr50/util/BlockUtils.java | 6 ++---- .../java/com/gmail/nossr50/util/EventUtils.java | 12 ++++-------- .../java/com/gmail/nossr50/util/Permissions.java | 6 +++--- .../util/blockmeta/NullChunkletManager.java | 16 ---------------- .../blockmeta/chunkmeta/HashChunkManager.java | 7 ++----- .../chunkmeta/McMMOSimpleRegionFile.java | 8 ++++---- .../blockmeta/chunkmeta/NullChunkManager.java | 2 +- .../conversion/BlockStoreConversionMain.java | 2 -- .../BlockStoreConversionXDirectory.java | 1 - .../BlockStoreConversionZDirectory.java | 1 - .../nossr50/util/commands/CommandUtils.java | 2 +- .../util/scoreboards/ScoreboardWrapper.java | 2 -- .../gmail/nossr50/util/skills/CombatUtils.java | 9 ++++----- .../nossr50/util/skills/ParticleEffectUtils.java | 2 -- .../gmail/nossr50/util/sounds/SoundManager.java | 4 +--- .../nossr50/worldguard/WorldGuardManager.java | 2 +- 44 files changed, 66 insertions(+), 136 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/McImportCommand.java b/src/main/java/com/gmail/nossr50/commands/McImportCommand.java index 42b3d4cf5..37fa0e7c0 100644 --- a/src/main/java/com/gmail/nossr50/commands/McImportCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/McImportCommand.java @@ -27,7 +27,7 @@ public class McImportCommand implements CommandExecutor { } } - public boolean importModConfig() { + public void importModConfig() { String importFilePath = mcMMO.getModDirectory() + File.separator + "import"; File importFile = new File(importFilePath, "import.log"); mcMMO.p.getLogger().info("Starting import of mod materials..."); @@ -69,17 +69,16 @@ public class McImportCommand implements CommandExecutor { } materialNames.get(type).add(materialName); - continue; } } catch (FileNotFoundException e) { mcMMO.p.getLogger().warning("Could not find " + importFile.getAbsolutePath() + " ! (No such file or directory)"); mcMMO.p.getLogger().warning("Copy and paste latest.log to " + importFile.getParentFile().getAbsolutePath() + " and rename it to import.log"); - return false; + return; } catch (Exception e) { e.printStackTrace(); - return false; + return; } finally { tryClose(in); @@ -88,7 +87,6 @@ public class McImportCommand implements CommandExecutor { createOutput(materialNames); mcMMO.p.getLogger().info("Import finished! Created " + fileAmount + " files!"); - return true; } private void createOutput(HashMap> materialNames) { diff --git a/src/main/java/com/gmail/nossr50/commands/party/alliance/PartyAllianceCommand.java b/src/main/java/com/gmail/nossr50/commands/party/alliance/PartyAllianceCommand.java index 45ee67872..7bc7794b0 100644 --- a/src/main/java/com/gmail/nossr50/commands/party/alliance/PartyAllianceCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/party/alliance/PartyAllianceCommand.java @@ -94,10 +94,9 @@ public class PartyAllianceCommand implements TabExecutor { } } - private boolean printUsage() { + private void printUsage() { player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.Help.0")); player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.Help.1")); - return true; } @Override diff --git a/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java index 91e86ef0f..1003ecfd3 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java @@ -8,7 +8,6 @@ import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.random.RandomChanceSkill; import com.gmail.nossr50.util.random.RandomChanceUtil; -import com.gmail.nossr50.util.skills.SkillActivationType; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.entity.Player; @@ -30,7 +29,7 @@ public class AcrobaticsCommand extends SkillCommand { protected void dataCalculations(Player player, float skillValue) { // ACROBATICS_DODGE if (canDodge) { - String[] dodgeStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ACROBATICS_DODGE); + String[] dodgeStrings = getAbilityDisplayValues(player, SubSkillType.ACROBATICS_DODGE); dodgeChance = dodgeStrings[0]; dodgeChanceLucky = dodgeStrings[1]; } @@ -71,7 +70,7 @@ public class AcrobaticsCommand extends SkillCommand { graceChance = RandomChanceUtil.getRandomChanceExecutionChance(grace_rcs); //damageThreshold = AdvancedConfig.getInstance().getRollDamageThreshold(); - String[] rollStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ACROBATICS_ROLL); + String[] rollStrings = getAbilityDisplayValues(player, SubSkillType.ACROBATICS_ROLL); //Format double rollChanceLucky = rollChance * 1.333D; diff --git a/src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java index 4a8063b28..70d3466da 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java @@ -6,7 +6,6 @@ import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.skills.archery.Archery; import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.skills.CombatUtils; -import com.gmail.nossr50.util.skills.SkillActivationType; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.entity.Player; @@ -32,14 +31,14 @@ public class ArcheryCommand extends SkillCommand { protected void dataCalculations(Player player, float skillValue) { // ARCHERY_ARROW_RETRIEVAL if (canRetrieve) { - String[] retrieveStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ARCHERY_ARROW_RETRIEVAL); + String[] retrieveStrings = getAbilityDisplayValues(player, SubSkillType.ARCHERY_ARROW_RETRIEVAL); retrieveChance = retrieveStrings[0]; retrieveChanceLucky = retrieveStrings[1]; } // ARCHERY_DAZE if (canDaze) { - String[] dazeStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ARCHERY_DAZE); + String[] dazeStrings = getAbilityDisplayValues(player, SubSkillType.ARCHERY_DAZE); dazeChance = dazeStrings[0]; dazeChanceLucky = dazeStrings[1]; } diff --git a/src/main/java/com/gmail/nossr50/commands/skills/AxesCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/AxesCommand.java index 8c75d24a5..8b56fc9a9 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/AxesCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/AxesCommand.java @@ -9,7 +9,6 @@ import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.skills.CombatUtils; import com.gmail.nossr50.util.skills.RankUtils; -import com.gmail.nossr50.util.skills.SkillActivationType; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.entity.Player; @@ -48,7 +47,7 @@ public class AxesCommand extends SkillCommand { // CRITICAL HIT if (canCritical) { - String[] criticalHitStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.AXES_CRITICAL_STRIKES); + String[] criticalHitStrings = getAbilityDisplayValues(player, SubSkillType.AXES_CRITICAL_STRIKES); critChance = criticalHitStrings[0]; critChanceLucky = criticalHitStrings[1]; } diff --git a/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java index 87f18e413..3d60f17e2 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java @@ -6,7 +6,6 @@ import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.skills.RankUtils; -import com.gmail.nossr50.util.skills.SkillActivationType; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -45,7 +44,7 @@ public class HerbalismCommand extends SkillCommand { // DOUBLE DROPS if (canDoubleDrop) { - String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_DOUBLE_DROPS); + String[] doubleDropStrings = getAbilityDisplayValues(player, SubSkillType.HERBALISM_DOUBLE_DROPS); doubleDropChance = doubleDropStrings[0]; doubleDropChanceLucky = doubleDropStrings[1]; } @@ -66,21 +65,21 @@ public class HerbalismCommand extends SkillCommand { if (canGreenThumbBlocks || canGreenThumbPlants) { greenThumbStage = RankUtils.getRank(player, SubSkillType.HERBALISM_GREEN_THUMB); - String[] greenThumbStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_GREEN_THUMB); + String[] greenThumbStrings = getAbilityDisplayValues(player, SubSkillType.HERBALISM_GREEN_THUMB); greenThumbChance = greenThumbStrings[0]; greenThumbChanceLucky = greenThumbStrings[1]; } // HYLIAN LUCK if (hasHylianLuck) { - String[] hylianLuckStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_HYLIAN_LUCK); + String[] hylianLuckStrings = getAbilityDisplayValues(player, SubSkillType.HERBALISM_HYLIAN_LUCK); hylianLuckChance = hylianLuckStrings[0]; hylianLuckChanceLucky = hylianLuckStrings[1]; } // SHROOM THUMB if (canShroomThumb) { - String[] shroomThumbStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_SHROOM_THUMB); + String[] shroomThumbStrings = getAbilityDisplayValues(player, SubSkillType.HERBALISM_SHROOM_THUMB); shroomThumbChance = shroomThumbStrings[0]; shroomThumbChanceLucky = shroomThumbStrings[1]; } diff --git a/src/main/java/com/gmail/nossr50/commands/skills/MiningCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/MiningCommand.java index c3a9b25ac..e2ee79d63 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/MiningCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/MiningCommand.java @@ -8,7 +8,6 @@ import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.skills.RankUtils; -import com.gmail.nossr50.util.skills.SkillActivationType; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.entity.Player; @@ -54,7 +53,7 @@ public class MiningCommand extends SkillCommand { // DOUBLE DROPS if (canDoubleDrop) { - String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.MINING_DOUBLE_DROPS); + String[] doubleDropStrings = getAbilityDisplayValues(player, SubSkillType.MINING_DOUBLE_DROPS); doubleDropChance = doubleDropStrings[0]; doubleDropChanceLucky = doubleDropStrings[1]; } diff --git a/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java index 349d18e8e..1e198f40d 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java @@ -12,7 +12,6 @@ import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.skills.RankUtils; -import com.gmail.nossr50.util.skills.SkillActivationType; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -67,7 +66,7 @@ public class RepairCommand extends SkillCommand { // SUPER REPAIR if (canSuperRepair) { - String[] superRepairStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.REPAIR_SUPER_REPAIR); + String[] superRepairStrings = getAbilityDisplayValues(player, SubSkillType.REPAIR_SUPER_REPAIR); superRepairChance = superRepairStrings[0]; superRepairChanceLucky = superRepairStrings[1]; } diff --git a/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java index 946548b8b..b92527048 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java @@ -220,8 +220,8 @@ public abstract class SkillCommand implements TabExecutor { return Math.min((int) skillValue, maxLevel) / rankChangeLevel; } - protected String[] getAbilityDisplayValues(SkillActivationType skillActivationType, Player player, SubSkillType subSkill) { - return RandomChanceUtil.calculateAbilityDisplayValues(skillActivationType, player, subSkill); + protected String[] getAbilityDisplayValues(Player player, SubSkillType subSkill) { + return RandomChanceUtil.calculateAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, subSkill); } protected String[] calculateLengthDisplayValues(Player player, float skillValue) { diff --git a/src/main/java/com/gmail/nossr50/commands/skills/SmeltingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/SmeltingCommand.java index a3a5f5805..06b530392 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/SmeltingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/SmeltingCommand.java @@ -7,7 +7,6 @@ import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.skills.RankUtils; -import com.gmail.nossr50.util.skills.SkillActivationType; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.entity.Player; @@ -46,7 +45,7 @@ public class SmeltingCommand extends SkillCommand { // SECOND SMELT if (canSecondSmelt) { - String[] secondSmeltStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.SMELTING_SECOND_SMELT); + String[] secondSmeltStrings = getAbilityDisplayValues(player, SubSkillType.SMELTING_SECOND_SMELT); str_secondSmeltChance = secondSmeltStrings[0]; str_secondSmeltChanceLucky = secondSmeltStrings[1]; } diff --git a/src/main/java/com/gmail/nossr50/commands/skills/SwordsCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/SwordsCommand.java index 98a0d3b57..4d7b7d88c 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/SwordsCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/SwordsCommand.java @@ -9,7 +9,6 @@ import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.skills.CombatUtils; import com.gmail.nossr50.util.skills.RankUtils; -import com.gmail.nossr50.util.skills.SkillActivationType; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.entity.Player; @@ -37,7 +36,7 @@ public class SwordsCommand extends SkillCommand { protected void dataCalculations(Player player, float skillValue) { // SWORDS_COUNTER_ATTACK if (canCounter) { - String[] counterStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.SWORDS_COUNTER_ATTACK); + String[] counterStrings = getAbilityDisplayValues(player, SubSkillType.SWORDS_COUNTER_ATTACK); counterChance = counterStrings[0]; counterChanceLucky = counterStrings[1]; } @@ -46,7 +45,7 @@ public class SwordsCommand extends SkillCommand { if (canBleed) { bleedLength = UserManager.getPlayer(player).getSwordsManager().getRuptureBleedTicks(); - String[] bleedStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.SWORDS_RUPTURE); + String[] bleedStrings = getAbilityDisplayValues(player, SubSkillType.SWORDS_RUPTURE); bleedChance = bleedStrings[0]; bleedChanceLucky = bleedStrings[1]; } diff --git a/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java index e54ce1505..781cc09ed 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java @@ -6,7 +6,6 @@ import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.skills.taming.Taming; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.TextComponentFactory; -import com.gmail.nossr50.util.skills.SkillActivationType; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; @@ -35,7 +34,7 @@ public class TamingCommand extends SkillCommand { @Override protected void dataCalculations(Player player, float skillValue) { if (canGore) { - String[] goreStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.TAMING_GORE); + String[] goreStrings = getAbilityDisplayValues(player, SubSkillType.TAMING_GORE); goreChance = goreStrings[0]; goreChanceLucky = goreStrings[1]; } diff --git a/src/main/java/com/gmail/nossr50/commands/skills/UnarmedCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/UnarmedCommand.java index f653d0c76..f479369cf 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/UnarmedCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/UnarmedCommand.java @@ -8,7 +8,6 @@ import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.skills.CombatUtils; import com.gmail.nossr50.util.skills.RankUtils; -import com.gmail.nossr50.util.skills.SkillActivationType; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.entity.Player; @@ -40,7 +39,7 @@ public class UnarmedCommand extends SkillCommand { protected void dataCalculations(Player player, float skillValue) { // UNARMED_ARROW_DEFLECT if (canDeflect) { - String[] deflectStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.UNARMED_ARROW_DEFLECT); + String[] deflectStrings = getAbilityDisplayValues(player, SubSkillType.UNARMED_ARROW_DEFLECT); deflectChance = deflectStrings[0]; deflectChanceLucky = deflectStrings[1]; } @@ -54,7 +53,7 @@ public class UnarmedCommand extends SkillCommand { // UNARMED_DISARM if (canDisarm) { - String[] disarmStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.UNARMED_DISARM); + String[] disarmStrings = getAbilityDisplayValues(player, SubSkillType.UNARMED_DISARM); disarmChance = disarmStrings[0]; disarmChanceLucky = disarmStrings[1]; } @@ -66,7 +65,7 @@ public class UnarmedCommand extends SkillCommand { // IRON GRIP if (canIronGrip) { - String[] ironGripStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.UNARMED_IRON_GRIP); + String[] ironGripStrings = getAbilityDisplayValues(player, SubSkillType.UNARMED_IRON_GRIP); ironGripChance = ironGripStrings[0]; ironGripChanceLucky = ironGripStrings[1]; } diff --git a/src/main/java/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java index c0f7ae4cb..bb97a3ad2 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java @@ -6,7 +6,6 @@ import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.skills.RankUtils; -import com.gmail.nossr50.util.skills.SkillActivationType; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.entity.Player; @@ -46,7 +45,7 @@ public class WoodcuttingCommand extends SkillCommand { } private void setDoubleDropClassicChanceStrings(Player player) { - String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.WOODCUTTING_HARVEST_LUMBER); + String[] doubleDropStrings = getAbilityDisplayValues(player, SubSkillType.WOODCUTTING_HARVEST_LUMBER); doubleDropChance = doubleDropStrings[0]; doubleDropChanceLucky = doubleDropStrings[1]; } diff --git a/src/main/java/com/gmail/nossr50/config/hocon/CustomEnumValueSerializer.java b/src/main/java/com/gmail/nossr50/config/hocon/CustomEnumValueSerializer.java index c0cd4913b..60557e423 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/CustomEnumValueSerializer.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/CustomEnumValueSerializer.java @@ -20,6 +20,7 @@ public class CustomEnumValueSerializer implements TypeSerializer { throw new ObjectMappingException("No value present in node " + value); } + //noinspection RedundantCast Optional ret = (Optional) EnumLookup.lookupEnum(type.getRawType().asSubclass(Enum.class), enumConstant); // XXX: intellij says this cast is optional but it isnt if (!ret.isPresent()) { @@ -30,7 +31,7 @@ public class CustomEnumValueSerializer implements TypeSerializer { } @Override - public void serialize(@NonNull TypeToken type, @Nullable Enum obj, @NonNull ConfigurationNode value) throws ObjectMappingException { + public void serialize(@NonNull TypeToken type, @Nullable Enum obj, @NonNull ConfigurationNode value) { value.setValue(HOCONUtil.serializeENUMName(obj.name())); } } diff --git a/src/main/java/com/gmail/nossr50/config/hocon/CustomEnumValueSerializerPartyFeature.java b/src/main/java/com/gmail/nossr50/config/hocon/CustomEnumValueSerializerPartyFeature.java index 486cbca91..8929edc66 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/CustomEnumValueSerializerPartyFeature.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/CustomEnumValueSerializerPartyFeature.java @@ -20,6 +20,7 @@ public class CustomEnumValueSerializerPartyFeature implements TypeSerializer ret = (Optional) EnumLookup.lookupEnum(type.getRawType().asSubclass(Enum.class), enumConstant); // XXX: intellij says this cast is optional but it isnt if (!ret.isPresent()) { @@ -30,7 +31,7 @@ public class CustomEnumValueSerializerPartyFeature implements TypeSerializer type, @Nullable Enum obj, @NonNull ConfigurationNode value) throws ObjectMappingException { + public void serialize(@NonNull TypeToken type, @Nullable Enum obj, @NonNull ConfigurationNode value) { value.setValue(HOCONUtil.serializeENUMName(obj.name())); } } diff --git a/src/main/java/com/gmail/nossr50/config/hocon/RepairableSerializer.java b/src/main/java/com/gmail/nossr50/config/hocon/RepairableSerializer.java index b0469f2be..2d14a813d 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/RepairableSerializer.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/RepairableSerializer.java @@ -58,7 +58,7 @@ public class RepairableSerializer implements TypeSerializer { } @Override - public void serialize(TypeToken type, Repairable obj, ConfigurationNode value) throws ObjectMappingException { + public void serialize(TypeToken type, Repairable obj, ConfigurationNode value) { /*value.getNode("Item").setValue(HOCONUtil.serializeENUMName(obj.getItemMaterial().getKey().getKey())); value.getNode("Item-Used-To-Repair").setValue(HOCONUtil.serializeENUMName(obj.getRepairMaterials().getKey().getKey()));*/ @@ -71,6 +71,7 @@ public class RepairableSerializer implements TypeSerializer { private Enum getEnum(String enumConstant, TypeToken type) throws ObjectMappingException { + //noinspection RedundantCast Optional ret = (Optional) EnumLookup.lookupEnum(type.getRawType().asSubclass(Enum.class), enumConstant); // XXX: intellij says this cast is optional but it isnt diff --git a/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigLeveling.java b/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigLeveling.java index 66129e131..ec6b38495 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigLeveling.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigLeveling.java @@ -66,7 +66,7 @@ public class ConfigLeveling { case WOODCUTTING: return configSectionLevelCaps.getConfigSectionSkills().getWoodcutting().getLevelCap(); case SMELTING: - return configSectionLevelCaps.getConfigSectionSkills().getWoodcutting().getLevelCap(); + return configSectionLevelCaps.getConfigSectionSkills().getSmelting().getLevelCap(); case SALVAGE: return configSectionLevelCaps.getConfigSectionSkills().getSalvage().getLevelCap(); default: @@ -105,7 +105,7 @@ public class ConfigLeveling { case WOODCUTTING: return configSectionLevelCaps.getConfigSectionSkills().getWoodcutting().isLevelCapEnabled(); case SMELTING: - return configSectionLevelCaps.getConfigSectionSkills().getWoodcutting().isLevelCapEnabled(); + return configSectionLevelCaps.getConfigSectionSkills().getSmelting().isLevelCapEnabled(); case SALVAGE: return configSectionLevelCaps.getConfigSectionSkills().getSalvage().isLevelCapEnabled(); default: diff --git a/src/main/java/com/gmail/nossr50/datatypes/party/Party.java b/src/main/java/com/gmail/nossr50/datatypes/party/Party.java index c751fc221..4cfc326a4 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/party/Party.java +++ b/src/main/java/com/gmail/nossr50/datatypes/party/Party.java @@ -101,12 +101,12 @@ public class Party { return onlinePlayerNames; } - public boolean addOnlineMember(Player player) { - return onlineMembers.add(player); + public void addOnlineMember(Player player) { + onlineMembers.add(player); } - public boolean removeOnlineMember(Player player) { - return onlineMembers.remove(player); + public void removeOnlineMember(Player player) { + onlineMembers.remove(player); } public String getName() { @@ -308,7 +308,6 @@ public class Party { break; default: - return; } } diff --git a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java index 676aa66b7..c52fab2de 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java +++ b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java @@ -699,7 +699,6 @@ public class McMMOPlayer { return; default: - return; } } @@ -716,7 +715,6 @@ public class McMMOPlayer { return; default: - return; } } @@ -734,7 +732,6 @@ public class McMMOPlayer { return; default: - return; } } diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index 27a7e55b4..de810de3a 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -174,7 +174,6 @@ public class EntityListener implements Listener { mcMMO.getPlaceStore().setTrue(block); } } else if ((block.getType() == Material.REDSTONE_ORE)) { - return; } else { if (mcMMO.getPlaceStore().isTrue(block)) { @@ -248,7 +247,6 @@ public class EntityListener implements Listener { event.setCancelled(true); } - return; } } @@ -564,7 +562,6 @@ public class EntityListener implements Listener { return; default: - return; } } } @@ -659,7 +656,6 @@ public class EntityListener implements Listener { return; default: - return; } } @@ -832,10 +828,6 @@ public class EntityListener implements Listener { * RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @ * 1000 */ - if (Permissions.isSubSkillEnabled(player, SubSkillType.HERBALISM_FARMERS_DIET)) { - event.setFoodLevel(UserManager.getPlayer(player).getHerbalismManager().farmersDiet(newFoodLevel)); - } - return; case COOKIE: /* RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 1000 */ case MELON_SLICE: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */ @@ -859,7 +851,6 @@ public class EntityListener implements Listener { return; default: - return; } } diff --git a/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java b/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java index b91c761aa..8a9f21141 100644 --- a/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java @@ -249,7 +249,6 @@ public class InventoryListener implements Listener { AlchemyPotionBrewer.scheduleCheck(player, stand); return; default: - return; } } else if (slot == InventoryType.SlotType.FUEL) { diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index facd20400..8279b9a83 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -286,7 +286,6 @@ public class PlayerListener implements Listener { return; default: - return; } } @@ -388,7 +387,6 @@ public class PlayerListener implements Listener { } return; default: - return; } } diff --git a/src/main/java/com/gmail/nossr50/listeners/SelfListener.java b/src/main/java/com/gmail/nossr50/listeners/SelfListener.java index 5280664fb..5c5a1e2cf 100644 --- a/src/main/java/com/gmail/nossr50/listeners/SelfListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/SelfListener.java @@ -48,7 +48,6 @@ public class SelfListener implements Listener { ScoreboardManager.handleLevelUp(player, skill); if (!MainConfig.getInstance().getLevelUpEffectsEnabled()) { - return; } /*if ((event.getSkillLevel() % Config.getInstance().getLevelUpEffectsTier()) == 0) { diff --git a/src/main/java/com/gmail/nossr50/party/PartyManager.java b/src/main/java/com/gmail/nossr50/party/PartyManager.java index ac07cdac5..84a5e0775 100644 --- a/src/main/java/com/gmail/nossr50/party/PartyManager.java +++ b/src/main/java/com/gmail/nossr50/party/PartyManager.java @@ -486,13 +486,12 @@ public final class PartyManager { } } - public static boolean disbandAlliance(Player player, Party firstParty, Party secondParty){ + public static void disbandAlliance(Player player, Party firstParty, Party secondParty){ if (!handlePartyChangeAllianceEvent(player, firstParty.getName(), secondParty.getName(), McMMOPartyAllianceChangeEvent.EventReason.DISBAND_ALLIANCE)) { - return false; + return; } PartyManager.disbandAlliance(firstParty, secondParty); - return true; } private static void disbandAlliance(Party firstParty, Party secondParty) { diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/AbilityDisableTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/AbilityDisableTask.java index 494871ba8..a2f985526 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/AbilityDisableTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/AbilityDisableTask.java @@ -41,7 +41,7 @@ public class AbilityDisableTask extends BukkitRunnable { case BERSERK: if (MainConfig.getInstance().getRefreshChunksEnabled()) { - resendChunkRadiusAt(player, 1); + resendChunkRadiusAt(player); } // Fallthrough @@ -66,15 +66,15 @@ public class AbilityDisableTask extends BukkitRunnable { new AbilityCooldownTask(mcMMOPlayer, ability).runTaskLaterAsynchronously(mcMMO.p, PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * Misc.TICK_CONVERSION_FACTOR); } - private void resendChunkRadiusAt(Player player, int radius) { + private void resendChunkRadiusAt(Player player) { Chunk chunk = player.getLocation().getChunk(); World world = player.getWorld(); int chunkX = chunk.getX(); int chunkZ = chunk.getZ(); - for (int x = chunkX - radius; x <= chunkX + radius; x++) { - for (int z = chunkZ - radius; z <= chunkZ + radius; z++) { + for (int x = chunkX - 1; x <= chunkX + 1; x++) { + for (int z = chunkZ - 1; z <= chunkZ + 1; z++) { world.refreshChunk(x, z); } } diff --git a/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyPotionBrewer.java b/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyPotionBrewer.java index 5577b51c4..a777144ac 100644 --- a/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyPotionBrewer.java +++ b/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyPotionBrewer.java @@ -59,16 +59,13 @@ public final class AlchemyPotionBrewer { ItemStack ingredient = inventory.getIngredient() == null ? null : inventory.getIngredient().clone(); if (isEmpty(ingredient) || !isValidIngredient(player, ingredient)) { - return; } else if (ingredient.getAmount() <= 1) { inventory.setIngredient(null); - return; } else { ingredient.setAmount(ingredient.getAmount() - 1); inventory.setIngredient(ingredient); - return; } } diff --git a/src/main/java/com/gmail/nossr50/skills/mining/Mining.java b/src/main/java/com/gmail/nossr50/skills/mining/Mining.java index a6e9ac5a5..262eb79c6 100644 --- a/src/main/java/com/gmail/nossr50/skills/mining/Mining.java +++ b/src/main/java/com/gmail/nossr50/skills/mining/Mining.java @@ -96,7 +96,6 @@ public class Mining { /*if (mcMMO.getModManager().isCustomMiningBlock(blockState)) { Misc.dropItem(Misc.getBlockCenter(blockState), new ItemStack(blockState.getType())); }*/ - return; } } @@ -163,7 +162,6 @@ public class Mining { /*if (mcMMO.getModManager().isCustomMiningBlock(blockState)) { Misc.dropItems(Misc.getBlockCenter(blockState), blockState.getBlock().getDrops()); }*/ - return; } } } diff --git a/src/main/java/com/gmail/nossr50/util/BlockUtils.java b/src/main/java/com/gmail/nossr50/util/BlockUtils.java index 40f3bef00..07b6df8bc 100644 --- a/src/main/java/com/gmail/nossr50/util/BlockUtils.java +++ b/src/main/java/com/gmail/nossr50/util/BlockUtils.java @@ -308,12 +308,10 @@ public final class BlockUtils { case COBBLESTONE : case DIRT : case GRASS_PATH : - return true; - - case STONE_BRICKS: - return true; case COBBLESTONE_WALL: + + case STONE_BRICKS: return true; default : diff --git a/src/main/java/com/gmail/nossr50/util/EventUtils.java b/src/main/java/com/gmail/nossr50/util/EventUtils.java index a96474f35..3a117c1bd 100644 --- a/src/main/java/com/gmail/nossr50/util/EventUtils.java +++ b/src/main/java/com/gmail/nossr50/util/EventUtils.java @@ -175,11 +175,10 @@ public class EventUtils { return event; } - public static FakePlayerAnimationEvent callFakeArmSwingEvent(Player player) { + public static void callFakeArmSwingEvent(Player player) { FakePlayerAnimationEvent event = new FakePlayerAnimationEvent(player); mcMMO.p.getServer().getPluginManager().callEvent(event); - return event; } public static boolean handleLevelChangeEvent(Player player, PrimarySkillType skill, int levelsChanged, float xpRemoved, boolean isLevelUp, XPGainReason xpGainReason) { @@ -198,7 +197,7 @@ public class EventUtils { return !isCancelled; } - public static boolean handleLevelChangeEventEdit(Player player, PrimarySkillType skill, int levelsChanged, float xpRemoved, boolean isLevelUp, XPGainReason xpGainReason, int oldLevel) { + public static void handleLevelChangeEventEdit(Player player, PrimarySkillType skill, int levelsChanged, float xpRemoved, boolean isLevelUp, XPGainReason xpGainReason, int oldLevel) { McMMOPlayerLevelChangeEvent event = isLevelUp ? new McMMOPlayerLevelUpEvent(player, skill, levelsChanged - oldLevel, xpGainReason) : new McMMOPlayerLevelDownEvent(player, skill, levelsChanged, xpGainReason); mcMMO.p.getServer().getPluginManager().callEvent(event); @@ -211,7 +210,6 @@ public class EventUtils { profile.addXp(skill, xpRemoved); } - return !isCancelled; } /** @@ -371,11 +369,10 @@ public class EventUtils { return !isCancelled; } - public static McMMOPlayerAbilityDeactivateEvent callAbilityDeactivateEvent(Player player, SuperAbilityType ability) { + public static void callAbilityDeactivateEvent(Player player, SuperAbilityType ability) { McMMOPlayerAbilityDeactivateEvent event = new McMMOPlayerAbilityDeactivateEvent(player, PrimarySkillType.byAbility(ability)); mcMMO.p.getServer().getPluginManager().callEvent(event); - return event; } public static McMMOPlayerFishingTreasureEvent callFishingTreasureEvent(Player player, ItemStack treasureDrop, int treasureXp, Map enchants) { @@ -385,11 +382,10 @@ public class EventUtils { return event; } - public static FakePlayerFishEvent callFakeFishEvent(Player player, FishHook hook) { + public static void callFakeFishEvent(Player player, FishHook hook) { FakePlayerFishEvent event = new FakePlayerFishEvent(player, null, hook, PlayerFishEvent.State.FISHING); mcMMO.p.getServer().getPluginManager().callEvent(event); - return event; } public static McMMOPlayerRepairCheckEvent callRepairCheckEvent(Player player, short durability, ItemStack repairMaterial, ItemStack repairedObject) { diff --git a/src/main/java/com/gmail/nossr50/util/Permissions.java b/src/main/java/com/gmail/nossr50/util/Permissions.java index 26793bef8..d130d3f5a 100644 --- a/src/main/java/com/gmail/nossr50/util/Permissions.java +++ b/src/main/java/com/gmail/nossr50/util/Permissions.java @@ -217,13 +217,13 @@ public final class Permissions { PluginManager pluginManager = server.getPluginManager(); for (World world : server.getWorlds()) { - addDynamicPermission("mcmmo.commands.ptp.world." + world.getName(), PermissionDefault.OP, pluginManager); + addDynamicPermission("mcmmo.commands.ptp.world." + world.getName(), pluginManager); } } - private static void addDynamicPermission(String permissionName, PermissionDefault permissionDefault, PluginManager pluginManager) { + private static void addDynamicPermission(String permissionName, PluginManager pluginManager) { Permission permission = new Permission(permissionName); - permission.setDefault(permissionDefault); + permission.setDefault(PermissionDefault.OP); pluginManager.addPermission(permission); } } diff --git a/src/main/java/com/gmail/nossr50/util/blockmeta/NullChunkletManager.java b/src/main/java/com/gmail/nossr50/util/blockmeta/NullChunkletManager.java index 89bd46967..304ef8780 100755 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/NullChunkletManager.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/NullChunkletManager.java @@ -11,57 +11,46 @@ import org.bukkit.block.Block; public class NullChunkletManager implements ChunkletManager { @Override public void loadChunklet(int cx, int cy, int cz, World world) { - return; } @Override public void unloadChunklet(int cx, int cy, int cz, World world) { - return; } @Override public void loadChunk(int cx, int cz, World world) { - return; } @Override public void unloadChunk(int cx, int cz, World world) { - return; } @Override public void chunkLoaded(int cx, int cz, World world) { - return; } @Override public void chunkUnloaded(int cx, int cz, World world) { - return; } @Override public void saveWorld(World world) { - return; } @Override public void unloadWorld(World world) { - return; } @Override public void loadWorld(World world) { - return; } @Override public void saveAll() { - return; } @Override public void unloadAll() { - return; } @Override @@ -76,26 +65,21 @@ public class NullChunkletManager implements ChunkletManager { @Override public void setTrue(int x, int y, int z, World world) { - return; } @Override public void setTrue(Block block) { - return; } @Override public void setFalse(int x, int y, int z, World world) { - return; } @Override public void setFalse(Block block) { - return; } @Override public void cleanUp() { - return; } } diff --git a/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java b/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java index c4d4483b0..b38f2199a 100755 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java @@ -154,11 +154,8 @@ public class HashChunkManager implements ChunkManager { public synchronized void unloadChunk(int cx, int cz, World world) { saveChunk(cx, cz, world); - if (store.containsKey(world.getName() + "," + cx + "," + cz)) { - store.remove(world.getName() + "," + cx + "," + cz); - - //closeChunkStore(world, cx, cz); - } + //closeChunkStore(world, cx, cz); + store.remove(world.getName() + "," + cx + "," + cz); } @Override diff --git a/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/McMMOSimpleRegionFile.java b/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/McMMOSimpleRegionFile.java index a396a8060..e04ef11c9 100644 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/McMMOSimpleRegionFile.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/McMMOSimpleRegionFile.java @@ -147,15 +147,15 @@ public class McMMOSimpleRegionFile { return file; } - public synchronized boolean testCloseTimeout() { - /* +/* public synchronized boolean testCloseTimeout() { + *//* if (System.currentTimeMillis() - TIMEOUT_TIME > lastAccessTime) { close(); return true; } - */ + *//* return false; - } + }*/ public synchronized DataOutputStream getOutputStream(int x, int z) { int index = getChunkIndex(x, z); diff --git a/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/NullChunkManager.java b/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/NullChunkManager.java index 3081b0938..8b9005d8e 100755 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/NullChunkManager.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/NullChunkManager.java @@ -13,7 +13,7 @@ public class NullChunkManager implements ChunkManager { public void closeAll() {} @Override - public ChunkStore readChunkStore(World world, int x, int z) throws IOException { + public ChunkStore readChunkStore(World world, int x, int z) { return null; } diff --git a/src/main/java/com/gmail/nossr50/util/blockmeta/conversion/BlockStoreConversionMain.java b/src/main/java/com/gmail/nossr50/util/blockmeta/conversion/BlockStoreConversionMain.java index 1994314b1..77ff10714 100755 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/conversion/BlockStoreConversionMain.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/conversion/BlockStoreConversionMain.java @@ -28,7 +28,6 @@ public class BlockStoreConversionMain implements Runnable { } this.taskID = this.scheduler.runTaskLater(mcMMO.p, this, 1).getTaskId(); - return; } @Override @@ -87,6 +86,5 @@ public class BlockStoreConversionMain implements Runnable { this.world = null; this.scheduler = null; this.converters = null; - return; } } diff --git a/src/main/java/com/gmail/nossr50/util/blockmeta/conversion/BlockStoreConversionXDirectory.java b/src/main/java/com/gmail/nossr50/util/blockmeta/conversion/BlockStoreConversionXDirectory.java index a189df0d1..de53a70f1 100755 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/conversion/BlockStoreConversionXDirectory.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/conversion/BlockStoreConversionXDirectory.java @@ -29,7 +29,6 @@ public class BlockStoreConversionXDirectory implements Runnable { } this.taskID = this.scheduler.runTaskLater(mcMMO.p, this, 1).getTaskId(); - return; } @Override diff --git a/src/main/java/com/gmail/nossr50/util/blockmeta/conversion/BlockStoreConversionZDirectory.java b/src/main/java/com/gmail/nossr50/util/blockmeta/conversion/BlockStoreConversionZDirectory.java index 2441e9ed4..66ab78a42 100755 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/conversion/BlockStoreConversionZDirectory.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/conversion/BlockStoreConversionZDirectory.java @@ -41,7 +41,6 @@ public class BlockStoreConversionZDirectory implements Runnable { } this.taskID = this.scheduler.runTaskLater(mcMMO.p, this, 1).getTaskId(); - return; } @Override diff --git a/src/main/java/com/gmail/nossr50/util/commands/CommandUtils.java b/src/main/java/com/gmail/nossr50/util/commands/CommandUtils.java index d93ad9ffd..5855b6d1f 100644 --- a/src/main/java/com/gmail/nossr50/util/commands/CommandUtils.java +++ b/src/main/java/com/gmail/nossr50/util/commands/CommandUtils.java @@ -115,7 +115,7 @@ public final class CommandUtils { } public static boolean hasPlayerDataKey(CommandSender sender) { - if (sender == null || !(sender instanceof Player)) { + if (!(sender instanceof Player)) { return false; } diff --git a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java index d7f86cdc1..ed73cb31d 100644 --- a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java +++ b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardWrapper.java @@ -435,8 +435,6 @@ public class ScoreboardWrapper { McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); switch (sidebarType) { - case NONE: - break; case SKILL_BOARD: Validate.notNull(targetSkill); diff --git a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java index d69cf7cb3..48c15c503 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java @@ -330,7 +330,7 @@ public final class CombatUtils { Wolf wolf = (Wolf) damager; AnimalTamer tamer = wolf.getOwner(); - if (tamer != null && tamer instanceof Player && PrimarySkillType.TAMING.shouldProcess(target)) { + if (tamer instanceof Player && PrimarySkillType.TAMING.shouldProcess(target)) { Player master = (Player) tamer; if (!Misc.isNPCEntity(master) && PrimarySkillType.TAMING.getPermissions(master)) { @@ -342,7 +342,7 @@ public final class CombatUtils { Arrow arrow = (Arrow) damager; ProjectileSource projectileSource = arrow.getShooter(); - if (projectileSource != null && projectileSource instanceof Player && PrimarySkillType.ARCHERY.shouldProcess(target)) { + if (projectileSource instanceof Player && PrimarySkillType.ARCHERY.shouldProcess(target)) { Player player = (Player) projectileSource; if (!Misc.isNPCEntity(player) && PrimarySkillType.ARCHERY.getPermissions(player)) { @@ -774,10 +774,10 @@ public final class CombatUtils { return scaledModifiers; } - public static EntityDamageByEntityEvent applyScaledModifiers(double initialDamage, double finalDamage, EntityDamageByEntityEvent event) { + public static void applyScaledModifiers(double initialDamage, double finalDamage, EntityDamageByEntityEvent event) { // No additional damage if (initialDamage == finalDamage) { - return event; + return; } for (DamageModifier modifier : DamageModifier.values()) { @@ -793,7 +793,6 @@ public final class CombatUtils { event.setDamage(modifier, finalDamage / initialDamage * event.getDamage(modifier)); } - return event; } /** diff --git a/src/main/java/com/gmail/nossr50/util/skills/ParticleEffectUtils.java b/src/main/java/com/gmail/nossr50/util/skills/ParticleEffectUtils.java index a4ab565a0..fd952c38e 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/ParticleEffectUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/ParticleEffectUtils.java @@ -74,7 +74,6 @@ public final class ParticleEffectUtils { public static void playAbilityEnabledEffect(Player player) { if (!MainConfig.getInstance().getAbilityActivationEffectEnabled()) { - return; } /* if (hasHeadRoom(player)) { @@ -84,7 +83,6 @@ public final class ParticleEffectUtils { public static void playAbilityDisabledEffect(Player player) { if (!MainConfig.getInstance().getAbilityDeactivationEffectEnabled()) { - return; } /*if (hasHeadRoom(player)) { diff --git a/src/main/java/com/gmail/nossr50/util/sounds/SoundManager.java b/src/main/java/com/gmail/nossr50/util/sounds/SoundManager.java index 73a4905e1..a8b132665 100644 --- a/src/main/java/com/gmail/nossr50/util/sounds/SoundManager.java +++ b/src/main/java/com/gmail/nossr50/util/sounds/SoundManager.java @@ -82,13 +82,11 @@ public class SoundManager { case SKILL_UNLOCKED: return Sound.UI_TOAST_CHALLENGE_COMPLETE; case ABILITY_ACTIVATED_BERSERK: + case TIRED: return Sound.BLOCK_CONDUIT_AMBIENT; case ABILITY_ACTIVATED_GENERIC: return Sound.ITEM_TRIDENT_RIPTIDE_3; case DEFLECT_ARROWS: - return Sound.ENTITY_ENDER_EYE_DEATH; - case TIRED: - return Sound.BLOCK_CONDUIT_AMBIENT; case BLEED: return Sound.ENTITY_ENDER_EYE_DEATH; default: diff --git a/src/main/java/com/gmail/nossr50/worldguard/WorldGuardManager.java b/src/main/java/com/gmail/nossr50/worldguard/WorldGuardManager.java index 25cd6291a..07c2de7e0 100644 --- a/src/main/java/com/gmail/nossr50/worldguard/WorldGuardManager.java +++ b/src/main/java/com/gmail/nossr50/worldguard/WorldGuardManager.java @@ -68,7 +68,7 @@ public class WorldGuardManager { Plugin plugin = getServer().getPluginManager().getPlugin("WorldGuard"); // WorldGuard may not be loaded - if (plugin == null || !(plugin instanceof WorldGuardPlugin)) { + if (!(plugin instanceof WorldGuardPlugin)) { return null; // Maybe you want throw an exception instead }