From 7bbf1acd5d40d9da4f4182bf18c477ef5b67a6f8 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 3 Apr 2019 16:11:35 -0700 Subject: [PATCH] minor cleanup --- .../gmail/nossr50/listeners/PlayerListener.java | 1 - .../player/PlayerUpdateInventoryTask.java | 1 - .../nossr50/runnables/skills/AlchemyBrewTask.java | 6 ++---- .../nossr50/skills/alchemy/AlchemyManager.java | 2 +- .../conversion/BlockStoreConversionMain.java | 10 +++++----- .../BlockStoreConversionXDirectory.java | 10 +++++----- .../BlockStoreConversionZDirectory.java | 15 ++++++--------- 7 files changed, 19 insertions(+), 26 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index efb9c60fb..facd20400 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -3,7 +3,6 @@ package com.gmail.nossr50.listeners; import com.gmail.nossr50.chat.ChatManager; import com.gmail.nossr50.chat.ChatManagerFactory; import com.gmail.nossr50.chat.PartyChatManager; -import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.MainConfig; import com.gmail.nossr50.config.WorldBlacklist; import com.gmail.nossr50.config.experience.ExperienceConfig; diff --git a/src/main/java/com/gmail/nossr50/runnables/player/PlayerUpdateInventoryTask.java b/src/main/java/com/gmail/nossr50/runnables/player/PlayerUpdateInventoryTask.java index d255eee2a..7658f62f2 100644 --- a/src/main/java/com/gmail/nossr50/runnables/player/PlayerUpdateInventoryTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/player/PlayerUpdateInventoryTask.java @@ -3,7 +3,6 @@ package com.gmail.nossr50.runnables.player; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; -@SuppressWarnings("deprecation") public class PlayerUpdateInventoryTask extends BukkitRunnable { private Player player; diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/AlchemyBrewTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/AlchemyBrewTask.java index c7fb56760..c40e5947a 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/AlchemyBrewTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/AlchemyBrewTask.java @@ -18,8 +18,6 @@ import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; public class AlchemyBrewTask extends BukkitRunnable { - private static double DEFAULT_BREW_SPEED = 1.0; - private static int DEFAULT_BREW_TICKS = 400; private BlockState brewingStand; private Location location; @@ -34,8 +32,8 @@ public class AlchemyBrewTask extends BukkitRunnable { this.location = brewingStand.getLocation(); this.player = player; - brewSpeed = DEFAULT_BREW_SPEED; - brewTimer = DEFAULT_BREW_TICKS; + brewSpeed = 1.0; + brewTimer = 400; if (player != null && !Misc.isNPCEntity(player) && Permissions.isSubSkillEnabled(player, SubSkillType.ALCHEMY_CATALYSIS)) { double catalysis = UserManager.getPlayer(player).getAlchemyManager().calculateBrewSpeed(Permissions.lucky(player, PrimarySkillType.ALCHEMY)); diff --git a/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyManager.java b/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyManager.java index 01c8e7665..ee19cbcc1 100644 --- a/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyManager.java +++ b/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyManager.java @@ -16,7 +16,6 @@ import org.bukkit.inventory.ItemStack; import java.util.List; public class AlchemyManager extends SkillManager { - private final double LUCKY_MODIFIER = 4.0 / 3.0; public AlchemyManager(McMMOPlayer mcMMOPlayer) { super(mcMMOPlayer, PrimarySkillType.ALCHEMY); @@ -49,6 +48,7 @@ public class AlchemyManager extends SkillManager { return Alchemy.catalysisMinSpeed; } + double LUCKY_MODIFIER = 4.0 / 3.0; return Math.min(Alchemy.catalysisMaxSpeed, Alchemy.catalysisMinSpeed + (Alchemy.catalysisMaxSpeed - Alchemy.catalysisMinSpeed) * (skillLevel - Alchemy.catalysisUnlockLevel) / (Alchemy.catalysisMaxBonusLevel - Alchemy.catalysisUnlockLevel)) * (isLucky ? LUCKY_MODIFIER : 1.0); } 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 e3186c2c9..1994314b1 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 @@ -7,7 +7,7 @@ import org.bukkit.scheduler.BukkitScheduler; import java.io.File; public class BlockStoreConversionMain implements Runnable { - private int taskID, i; + private int taskID; private org.bukkit.World world; BukkitScheduler scheduler; File dataDir; @@ -52,12 +52,12 @@ public class BlockStoreConversionMain implements Runnable { this.xDirs = this.dataDir.listFiles(); - for (this.i = 0; (this.i < ChunkConversionOptions.getConversionRate()) && (this.i < this.xDirs.length); this.i++) { - if (this.converters[this.i] == null) { - this.converters[this.i] = new BlockStoreConversionXDirectory(); + for (int i = 0; (i < ChunkConversionOptions.getConversionRate()) && (i < this.xDirs.length); i++) { + if (this.converters[i] == null) { + this.converters[i] = new BlockStoreConversionXDirectory(); } - this.converters[this.i].start(this.world, this.xDirs[this.i]); + this.converters[i].start(this.world, this.xDirs[i]); } softStop(); 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 06fcdc8b6..a189df0d1 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 @@ -7,7 +7,7 @@ import org.bukkit.scheduler.BukkitScheduler; import java.io.File; public class BlockStoreConversionXDirectory implements Runnable { - private int taskID, i; + private int taskID; private org.bukkit.World world; BukkitScheduler scheduler; File dataDir; @@ -53,12 +53,12 @@ public class BlockStoreConversionXDirectory implements Runnable { this.zDirs = this.dataDir.listFiles(); - for (this.i = 0; (this.i < ChunkConversionOptions.getConversionRate()) && (this.i < this.zDirs.length); this.i++) { - if (this.converters[this.i] == null) { - this.converters[this.i] = new BlockStoreConversionZDirectory(); + for (int i = 0; (i < ChunkConversionOptions.getConversionRate()) && (i < this.zDirs.length); i++) { + if (this.converters[i] == null) { + this.converters[i] = new BlockStoreConversionZDirectory(); } - this.converters[this.i].start(this.world, this.dataDir, this.zDirs[this.i]); + this.converters[i].start(this.world, this.dataDir, this.zDirs[i]); } stop(); 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 5c182b55b..2441e9ed4 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 @@ -23,7 +23,6 @@ public class BlockStoreConversionZDirectory implements Runnable { private PrimitiveChunkletStore primitiveChunklet = null; private PrimitiveExChunkletStore primitiveExChunklet = null; private PrimitiveChunkStore currentChunk; - private boolean[] oldArray, newArray; public BlockStoreConversionZDirectory() { this.taskID = -1; @@ -130,27 +129,25 @@ public class BlockStoreConversionZDirectory implements Runnable { for (this.x = 0; this.x < 16; this.x++) { for (this.z = 0; this.z < 16; this.z++) { - if (this.primitiveChunklet != null) { - this.oldArray = this.primitiveChunklet.store[x][z]; - } + boolean[] oldArray; if (this.primitiveExChunklet != null) { - this.oldArray = this.primitiveExChunklet.store[x][z]; + oldArray = this.primitiveExChunklet.store[x][z]; } else { return; } - this.newArray = this.currentChunk.store[x][z]; + boolean[] newArray = this.currentChunk.store[x][z]; - if (this.oldArray.length < 64) { + if (oldArray.length < 64) { return; } - else if (this.newArray.length < ((this.y * 64) + 64)) { + else if (newArray.length < ((this.y * 64) + 64)) { return; } - System.arraycopy(this.oldArray, 0, this.newArray, (this.y * 64), 64); + System.arraycopy(oldArray, 0, newArray, (this.y * 64), 64); } } }