Code Cleanup pt 3

This commit is contained in:
nossr50 2019-04-03 19:55:52 -07:00
parent 43037f8c13
commit 0ca0140348
44 changed files with 66 additions and 136 deletions

View File

@ -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<ModConfigType, ArrayList<String>> materialNames) {

View File

@ -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

View File

@ -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;

View File

@ -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];
}

View File

@ -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];
}

View File

@ -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];
}

View File

@ -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];
}

View File

@ -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];
}

View File

@ -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) {

View File

@ -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];
}

View File

@ -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];
}

View File

@ -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];
}

View File

@ -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];
}

View File

@ -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];
}

View File

@ -20,6 +20,7 @@ public class CustomEnumValueSerializer implements TypeSerializer<Enum> {
throw new ObjectMappingException("No value present in node " + value);
}
//noinspection RedundantCast
Optional<Enum> 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<Enum> {
}
@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()));
}
}

View File

@ -20,6 +20,7 @@ public class CustomEnumValueSerializerPartyFeature implements TypeSerializer<Enu
throw new ObjectMappingException("No value present in node " + value);
}
//noinspection RedundantCast
Optional<Enum> 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<Enu
}
@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()));
}
}

View File

@ -58,7 +58,7 @@ public class RepairableSerializer implements TypeSerializer<Repairable> {
}
@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<Repairable> {
private Enum getEnum(String enumConstant, TypeToken<?> type) throws ObjectMappingException
{
//noinspection RedundantCast
Optional<Enum> ret = (Optional) EnumLookup.lookupEnum(type.getRawType().asSubclass(Enum.class),
enumConstant); // XXX: intellij says this cast is optional but it isnt

View File

@ -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:

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -249,7 +249,6 @@ public class InventoryListener implements Listener {
AlchemyPotionBrewer.scheduleCheck(player, stand);
return;
default:
return;
}
}
else if (slot == InventoryType.SlotType.FUEL) {

View File

@ -286,7 +286,6 @@ public class PlayerListener implements Listener {
return;
default:
return;
}
}
@ -388,7 +387,6 @@ public class PlayerListener implements Listener {
}
return;
default:
return;
}
}

View File

@ -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) {

View File

@ -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) {

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}
}

View File

@ -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 :

View File

@ -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<Enchantment, Integer> 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) {

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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

View File

@ -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);

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -29,7 +29,6 @@ public class BlockStoreConversionXDirectory implements Runnable {
}
this.taskID = this.scheduler.runTaskLater(mcMMO.p, this, 1).getTaskId();
return;
}
@Override

View File

@ -41,7 +41,6 @@ public class BlockStoreConversionZDirectory implements Runnable {
}
this.taskID = this.scheduler.runTaskLater(mcMMO.p, this, 1).getTaskId();
return;
}
@Override

View File

@ -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;
}

View File

@ -435,8 +435,6 @@ public class ScoreboardWrapper {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
switch (sidebarType) {
case NONE:
break;
case SKILL_BOARD:
Validate.notNull(targetSkill);

View File

@ -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;
}
/**

View File

@ -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)) {

View File

@ -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:

View File

@ -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
}