Misc code fixes

This commit is contained in:
nossr50
2020-07-13 11:39:03 -07:00
parent 428c093ae4
commit 7eae59a0b3
153 changed files with 1139 additions and 1474 deletions

View File

@@ -7,8 +7,8 @@ import com.gmail.nossr50.util.player.NotificationManager;
import org.bukkit.scheduler.BukkitRunnable;
public class AbilityCooldownTask extends BukkitRunnable {
private McMMOPlayer mcMMOPlayer;
private SuperAbilityType ability;
private final McMMOPlayer mcMMOPlayer;
private final SuperAbilityType ability;
public AbilityCooldownTask(McMMOPlayer mcMMOPlayer, SuperAbilityType ability) {
this.mcMMOPlayer = mcMMOPlayer;

View File

@@ -17,8 +17,8 @@ import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
public class AbilityDisableTask extends BukkitRunnable {
private McMMOPlayer mcMMOPlayer;
private SuperAbilityType ability;
private final McMMOPlayer mcMMOPlayer;
private final SuperAbilityType ability;
public AbilityDisableTask(McMMOPlayer mcMMOPlayer, SuperAbilityType ability) {
this.mcMMOPlayer = mcMMOPlayer;
@@ -41,7 +41,7 @@ public class AbilityDisableTask extends BukkitRunnable {
case BERSERK:
if (Config.getInstance().getRefreshChunksEnabled()) {
resendChunkRadiusAt(player, 1);
resendChunkRadiusAt(player);
}
// Fallthrough
@@ -66,13 +66,15 @@ public class AbilityDisableTask extends BukkitRunnable {
new AbilityCooldownTask(mcMMOPlayer, ability).runTaskLater(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();
int radius = 1;
for (int x = chunkX - radius; x <= chunkX + radius; x++) {
for (int z = chunkZ - radius; z <= chunkZ + radius; z++) {
world.refreshChunk(x, z);

View File

@@ -11,9 +11,9 @@ import org.bukkit.scheduler.BukkitRunnable;
import java.util.Arrays;
public class AlchemyBrewCheckTask extends BukkitRunnable {
private Player player;
private BrewingStand brewingStand;
private ItemStack[] oldInventory;
private final Player player;
private final BrewingStand brewingStand;
private final ItemStack[] oldInventory;
public AlchemyBrewCheckTask(Player player, BrewingStand brewingStand) {
this.player = player;

View File

@@ -18,14 +18,14 @@ 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 static final double DEFAULT_BREW_SPEED = 1.0;
private static final int DEFAULT_BREW_TICKS = 400;
private BlockState brewingStand;
private Location location;
private final BlockState brewingStand;
private final Location location;
private double brewSpeed;
private double brewTimer;
private Player player;
private final Player player;
private int fuel;
private boolean firstRun = true;

View File

@@ -8,12 +8,12 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.scheduler.BukkitRunnable;
public class AwardCombatXpTask extends BukkitRunnable {
private McMMOPlayer mcMMOPlayer;
private double baseXp;
private PrimarySkillType primarySkillType;
private LivingEntity target;
private XPGainReason xpGainReason;
private double baseHealth;
private final McMMOPlayer mcMMOPlayer;
private final double baseXp;
private final PrimarySkillType primarySkillType;
private final LivingEntity target;
private final XPGainReason xpGainReason;
private final double baseHealth;
public AwardCombatXpTask(McMMOPlayer mcMMOPlayer, PrimarySkillType primarySkillType, double baseXp, LivingEntity target, XPGainReason xpGainReason) {
this.mcMMOPlayer = mcMMOPlayer;

View File

@@ -23,7 +23,7 @@ import java.util.Map;
import java.util.Map.Entry;
public class BleedTimerTask extends BukkitRunnable {
private static Map<LivingEntity, BleedContainer> bleedList = new HashMap<LivingEntity, BleedContainer>();
private static final Map<LivingEntity, BleedContainer> bleedList = new HashMap<LivingEntity, BleedContainer>();
private static boolean isIterating = false;
@Override
@@ -155,8 +155,7 @@ public class BleedTimerTask extends BukkitRunnable {
int bleedRank = container.bleedRank;
int toolTier = container.toolTier;
BleedContainer newContainer = new BleedContainer(target, bleedTicks, bleedRank, toolTier, source);
return newContainer;
return new BleedContainer(target, bleedTicks, bleedRank, toolTier, source);
}
/**

View File

@@ -4,7 +4,7 @@ import org.bukkit.block.BlockState;
import org.bukkit.scheduler.BukkitRunnable;
public class HerbalismBlockUpdaterTask extends BukkitRunnable {
private BlockState blockState;
private final BlockState blockState;
public HerbalismBlockUpdaterTask(BlockState blockState) {
this.blockState = blockState;

View File

@@ -7,9 +7,9 @@ import org.bukkit.scheduler.BukkitRunnable;
public class SkillUnlockNotificationTask extends BukkitRunnable {
private McMMOPlayer mcMMOPlayer;
private SubSkillType subSkillType;
private int rank;
private final McMMOPlayer mcMMOPlayer;
private final SubSkillType subSkillType;
private final int rank;
/**
* Notify a player about a newly unlocked subskill
* @param mcMMOPlayer target player

View File

@@ -8,8 +8,8 @@ import com.gmail.nossr50.util.player.NotificationManager;
import org.bukkit.scheduler.BukkitRunnable;
public class ToolLowerTask extends BukkitRunnable {
private McMMOPlayer mcMMOPlayer;
private ToolType tool;
private final McMMOPlayer mcMMOPlayer;
private final ToolType tool;
public ToolLowerTask(McMMOPlayer mcMMOPlayer, ToolType tool) {
this.mcMMOPlayer = mcMMOPlayer;