diff --git a/extras/eclipse/BukkitPlugin.launch b/extras/eclipse/BukkitPlugin.launch
index 69800120..edb63eb8 100644
--- a/extras/eclipse/BukkitPlugin.launch
+++ b/extras/eclipse/BukkitPlugin.launch
@@ -15,10 +15,8 @@
-
-
diff --git a/src/com/projectkorra/projectkorra/BendingManager.java b/src/com/projectkorra/projectkorra/BendingManager.java
index f601b97d..b75514ef 100644
--- a/src/com/projectkorra/projectkorra/BendingManager.java
+++ b/src/com/projectkorra/projectkorra/BendingManager.java
@@ -4,6 +4,7 @@ import java.util.HashMap;
import java.util.UUID;
import co.aikar.timings.lib.MCTiming;
+
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.World;
@@ -29,19 +30,19 @@ public class BendingManager implements Runnable {
long interval;
private final HashMap times = new HashMap(); // true if day time
- private MCTiming TimingCoreAbilityProgressAll, TimingTempPotionProgressAll, TimingHandleDayNight, TimingHorizontalVelocityTrackerUpdateAll, TimingHandleCoolDowns, TimingTempArmorCleanup, TimingActionBarCheck;
+ private final MCTiming CORE_ABILITY_TIMING, TEMP_POTION_TIMING, DAY_NIGHT_TIMING, HORIZONTAL_VELOCITY_TRACKER_TIMING, COOLDOWN_TIMING, TEMP_ARMOR_TIMING, ACTIONBAR_STATUS_TIMING;
public BendingManager() {
instance = this;
this.time = System.currentTimeMillis();
- TimingCoreAbilityProgressAll = ProjectKorra.timing("CoreAbilityProgressAll");
- TimingTempPotionProgressAll = ProjectKorra.timing("TempPotionProgressAll");
- TimingHandleDayNight = ProjectKorra.timing("HandleDayNight");
- TimingHorizontalVelocityTrackerUpdateAll = ProjectKorra.timing("HorizontalVelocityTrackerUpdateAll");
- TimingHandleCoolDowns = ProjectKorra.timing("HandleCoolDowns");
- TimingTempArmorCleanup = ProjectKorra.timing("TempArmorCleanup");
- TimingActionBarCheck = ProjectKorra.timing("ActionBarCheck");
+ this.CORE_ABILITY_TIMING = ProjectKorra.timing("CoreAbility#ProgressAll");
+ this.TEMP_POTION_TIMING = ProjectKorra.timing("TempPotion#ProgressAll");
+ this.DAY_NIGHT_TIMING = ProjectKorra.timing("HandleDayNight");
+ this.HORIZONTAL_VELOCITY_TRACKER_TIMING = ProjectKorra.timing("HorizontalVelocityTracker#UpdateAll");
+ this.COOLDOWN_TIMING = ProjectKorra.timing("HandleCooldowns");
+ this.TEMP_ARMOR_TIMING = ProjectKorra.timing("TempArmor#Cleanup");
+ this.ACTIONBAR_STATUS_TIMING = ProjectKorra.timing("ActionBarCheck");
}
public static BendingManager getInstance() {
@@ -112,33 +113,33 @@ public class BendingManager implements Runnable {
this.time = System.currentTimeMillis();
ProjectKorra.time_step = this.interval;
- try(MCTiming timing = TimingCoreAbilityProgressAll.startTiming()) {
+ try (MCTiming timing = this.CORE_ABILITY_TIMING.startTiming()) {
CoreAbility.progressAll();
}
- try(MCTiming timing = TimingTempPotionProgressAll.startTiming()) {
+ try (MCTiming timing = this.TEMP_POTION_TIMING.startTiming()) {
TempPotionEffect.progressAll();
}
- try(MCTiming timing = TimingHandleDayNight.startTiming()) {
+ try (MCTiming timing = this.DAY_NIGHT_TIMING.startTiming()) {
this.handleDayNight();
}
RevertChecker.revertAirBlocks();
- try(MCTiming timing = TimingHorizontalVelocityTrackerUpdateAll.startTiming()) {
+ try (MCTiming timing = this.HORIZONTAL_VELOCITY_TRACKER_TIMING.startTiming()) {
HorizontalVelocityTracker.updateAll();
}
- try(MCTiming timing = TimingHandleCoolDowns.startTiming()) {
+ try (MCTiming timing = this.COOLDOWN_TIMING.startTiming()) {
this.handleCooldowns();
}
- try(MCTiming timing = TimingTempArmorCleanup.startTiming()) {
+ try (MCTiming timing = this.TEMP_ARMOR_TIMING.startTiming()) {
TempArmor.cleanup();
}
- try(MCTiming timing = TimingActionBarCheck.startTiming()) {
+ try (MCTiming timing = this.ACTIONBAR_STATUS_TIMING.startTiming()) {
for (final Player player : Bukkit.getOnlinePlayers()) {
if (Bloodbending.isBloodbent(player)) {
ActionBar.sendActionBar(Element.BLOOD.getColor() + "* Bloodbent *", player);
diff --git a/src/com/projectkorra/projectkorra/BendingPlayer.java b/src/com/projectkorra/projectkorra/BendingPlayer.java
index d86373db..ce1aed51 100644
--- a/src/com/projectkorra/projectkorra/BendingPlayer.java
+++ b/src/com/projectkorra/projectkorra/BendingPlayer.java
@@ -1,5 +1,25 @@
package com.projectkorra.projectkorra;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import org.bukkit.Bukkit;
+import org.bukkit.GameMode;
+import org.bukkit.Location;
+import org.bukkit.OfflinePlayer;
+import org.bukkit.configuration.file.FileConfiguration;
+import org.bukkit.entity.Player;
+
import com.projectkorra.projectkorra.Element.SubElement;
import com.projectkorra.projectkorra.ability.Ability;
import com.projectkorra.projectkorra.ability.AvatarAbility;
@@ -16,20 +36,6 @@ import com.projectkorra.projectkorra.storage.DBConnection;
import com.projectkorra.projectkorra.util.Cooldown;
import com.projectkorra.projectkorra.util.DBCooldownManager;
import com.projectkorra.projectkorra.waterbending.blood.Bloodbending;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-import org.bukkit.Bukkit;
-import org.bukkit.GameMode;
-import org.bukkit.Location;
-import org.bukkit.OfflinePlayer;
-import org.bukkit.configuration.file.FileConfiguration;
-import org.bukkit.entity.Player;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.*;
-import java.util.Map.Entry;
-import java.util.concurrent.ConcurrentHashMap;
/**
* Class that presents a player and stores all bending information about the
@@ -154,7 +160,7 @@ public class BendingPlayer {
while (rs.next()) {
final int cooldownId = rs.getInt("cooldown_id");
final long value = rs.getLong("value");
- final String name = cooldownManager.getCooldownName(cooldownId);
+ final String name = this.cooldownManager.getCooldownName(cooldownId);
cooldowns.put(name, new Cooldown(value, true));
}
} catch (final SQLException e) {
@@ -169,15 +175,14 @@ public class BendingPlayer {
for (final Entry entry : this.cooldowns.entrySet()) {
final String name = entry.getKey();
final Cooldown cooldown = entry.getValue();
- final int cooldownId = cooldownManager.getCooldownId(name, false);
+ final int cooldownId = this.cooldownManager.getCooldownId(name, false);
try (ResultSet rs = DBConnection.sql.readQuery("SELECT value FROM pk_cooldowns WHERE uuid = '" + this.uuid.toString() + "' AND cooldown_id = " + cooldownId)) {
if (rs.next()) {
DBConnection.sql.modifyQuery("UPDATE pk_cooldowns SET value = " + cooldown.getCooldown() + " WHERE uuid = '" + this.uuid.toString() + "' AND cooldown_id = " + cooldownId, false);
} else {
DBConnection.sql.modifyQuery("INSERT INTO pk_cooldowns (uuid, cooldown_id, value) VALUES ('" + this.uuid.toString() + "', " + cooldownId + ", " + cooldown.getCooldown() + ")", false);
}
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
}
}
@@ -908,8 +913,7 @@ public class BendingPlayer {
}
@Override
- public String toString()
- {
+ public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
diff --git a/src/com/projectkorra/projectkorra/GeneralMethods.java b/src/com/projectkorra/projectkorra/GeneralMethods.java
index 77c4561c..51a5f420 100644
--- a/src/com/projectkorra/projectkorra/GeneralMethods.java
+++ b/src/com/projectkorra/projectkorra/GeneralMethods.java
@@ -31,32 +31,6 @@ import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.Color;
-import org.bukkit.GameMode;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.World;
-import org.bukkit.block.Block;
-import org.bukkit.block.BlockFace;
-import org.bukkit.block.BlockState;
-import org.bukkit.block.data.BlockData;
-import org.bukkit.block.data.Levelled;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.FallingBlock;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.entity.TNTPrimed;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.plugin.Plugin;
-import org.bukkit.plugin.PluginManager;
-import org.bukkit.plugin.java.JavaPlugin;
-import org.bukkit.scheduler.BukkitRunnable;
-import org.bukkit.util.Vector;
-
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.api.ResidenceInterface;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
@@ -78,6 +52,41 @@ import com.palmergames.bukkit.towny.object.WorldCoord;
import com.palmergames.bukkit.towny.utils.PlayerCacheUtil;
import com.palmergames.bukkit.towny.war.flagwar.TownyWar;
import com.palmergames.bukkit.towny.war.flagwar.TownyWarConfig;
+import com.sk89q.worldedit.bukkit.BukkitAdapter;
+import com.sk89q.worldguard.WorldGuard;
+import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
+import com.sk89q.worldguard.protection.flags.Flags;
+import com.sk89q.worldguard.protection.flags.StateFlag;
+import com.songoda.kingdoms.constants.land.Land;
+import com.songoda.kingdoms.constants.land.SimpleChunkLocation;
+import com.songoda.kingdoms.constants.player.KingdomPlayer;
+import com.songoda.kingdoms.manager.game.GameManagement;
+
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.Color;
+import org.bukkit.GameMode;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.World;
+import org.bukkit.block.Block;
+import org.bukkit.block.BlockFace;
+import org.bukkit.block.BlockState;
+import org.bukkit.block.data.BlockData;
+import org.bukkit.block.data.Levelled;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.FallingBlock;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.entity.TNTPrimed;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.plugin.Plugin;
+import org.bukkit.plugin.PluginManager;
+import org.bukkit.plugin.java.JavaPlugin;
+import org.bukkit.scheduler.BukkitRunnable;
+import org.bukkit.util.Vector;
+
import com.projectkorra.projectkorra.Element.SubElement;
import com.projectkorra.projectkorra.ability.Ability;
import com.projectkorra.projectkorra.ability.AddonAbility;
@@ -122,15 +131,6 @@ import com.projectkorra.projectkorra.util.TempArmorStand;
import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.waterbending.WaterManipulation;
import com.projectkorra.projectkorra.waterbending.WaterSpout;
-import com.sk89q.worldedit.bukkit.BukkitAdapter;
-import com.sk89q.worldguard.WorldGuard;
-import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
-import com.sk89q.worldguard.protection.flags.Flags;
-import com.sk89q.worldguard.protection.flags.StateFlag;
-import com.songoda.kingdoms.constants.land.Land;
-import com.songoda.kingdoms.constants.land.SimpleChunkLocation;
-import com.songoda.kingdoms.constants.player.KingdomPlayer;
-import com.songoda.kingdoms.manager.game.GameManagement;
import br.net.fabiozumbi12.RedProtect.Bukkit.RedProtect;
import br.net.fabiozumbi12.RedProtect.Bukkit.Region;
@@ -163,8 +163,7 @@ public class GeneralMethods {
try {
getAbsorption = ReflectionHandler.getMethod("EntityHuman", PackageType.MINECRAFT_SERVER, "getAbsorptionHearts");
setAbsorption = ReflectionHandler.getMethod("EntityHuman", PackageType.MINECRAFT_SERVER, "setAbsorptionHearts", Float.class);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
}
}
@@ -539,8 +538,7 @@ public class GeneralMethods {
}
}.runTask(ProjectKorra.plugin);
}
- }
- catch (final SQLException ex) {
+ } catch (final SQLException ex) {
ex.printStackTrace();
}
}
@@ -557,7 +555,7 @@ public class GeneralMethods {
if (readFile.exists()) {
try (DataInputStream input = new DataInputStream(new FileInputStream(readFile)); BufferedReader reader = new BufferedReader(new InputStreamReader(input));
- DataOutputStream output = new DataOutputStream(new FileOutputStream(writeFile)); BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(output))) {
+ DataOutputStream output = new DataOutputStream(new FileOutputStream(writeFile)); BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(output))) {
String line;
while ((line = reader.readLine()) != null) {
@@ -565,8 +563,7 @@ public class GeneralMethods {
writer.write(line + "\n");
}
}
- }
- catch (final IOException e) {
+ } catch (final IOException e) {
e.printStackTrace();
}
}
@@ -592,9 +589,9 @@ public class GeneralMethods {
if (red <= 0) {
red = 1 / 255.0F;
}
- loc.setX(loc.getX() + (Math.random()*2 - 1) * xOffset);
- loc.setY(loc.getY() + (Math.random()*2 - 1) * yOffset);
- loc.setZ(loc.getZ() + (Math.random()*2 - 1) * zOffset);
+ loc.setX(loc.getX() + (Math.random() * 2 - 1) * xOffset);
+ loc.setY(loc.getY() + (Math.random() * 2 - 1) * yOffset);
+ loc.setZ(loc.getZ() + (Math.random() * 2 - 1) * zOffset);
if (type != ParticleEffect.RED_DUST && type != ParticleEffect.REDSTONE && type != ParticleEffect.SPELL_MOB && type != ParticleEffect.MOB_SPELL && type != ParticleEffect.SPELL_MOB_AMBIENT && type != ParticleEffect.MOB_SPELL_AMBIENT) {
type = ParticleEffect.RED_DUST;
@@ -677,8 +674,7 @@ public class GeneralMethods {
final Object entityplayer = ActionBar.getHandle.invoke(player);
final Object hearts = getAbsorption.invoke(entityplayer);
return (float) hearts;
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
}
return 0;
@@ -689,8 +685,7 @@ public class GeneralMethods {
try {
final Object entityplayer = ActionBar.getHandle.invoke(player);
setAbsorption.invoke(entityplayer, hearts);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
}
}
@@ -1019,7 +1014,7 @@ public class GeneralMethods {
}
public static int getMaxPresets(final Player player) {
- int max = ConfigManager.getConfig().getInt("Properties.MaxPresets");
+ final int max = ConfigManager.getConfig().getInt("Properties.MaxPresets");
if (player.isOp()) {
return max;
}
@@ -1089,16 +1084,16 @@ public class GeneralMethods {
return null;
}
- public static BlockData getLavaData(int level) {
- BlockData data = Material.LAVA.createBlockData();
+ public static BlockData getLavaData(final int level) {
+ final BlockData data = Material.LAVA.createBlockData();
if (data instanceof Levelled) {
((Levelled) data).setLevel(level);
}
return data;
}
- public static BlockData getWaterData(int level) {
- BlockData data = Material.WATER.createBlockData();
+ public static BlockData getWaterData(final int level) {
+ final BlockData data = Material.WATER.createBlockData();
if (data instanceof Levelled) {
((Levelled) data).setLevel(level);
}
@@ -1137,12 +1132,12 @@ public class GeneralMethods {
public static Entity getTargetedEntity(final Player player, final double range) {
return getTargetedEntity(player, range, new ArrayList());
}
-
+
public static Location getTargetedLocation(final Player player, final double range, final boolean ignoreTempBlocks, final Material... nonOpaque2) {
final Location origin = player.getEyeLocation();
final Vector direction = origin.getDirection();
- HashSet trans = new HashSet();
+ final HashSet trans = new HashSet();
trans.add(Material.AIR);
trans.add(Material.CAVE_AIR);
trans.add(Material.VOID_AIR);
@@ -1152,15 +1147,15 @@ public class GeneralMethods {
trans.add(material);
}
}
-
- Location location = origin.clone();
- Vector vec = direction.normalize().multiply(0.2);
-
+
+ final Location location = origin.clone();
+ final Vector vec = direction.normalize().multiply(0.2);
+
for (double i = 0; i < range; i += 0.2) {
location.add(vec);
-
- Block block = location.getBlock();
-
+
+ final Block block = location.getBlock();
+
if (trans.contains(block.getType())) {
continue;
} else if (ignoreTempBlocks && (TempBlock.isTempBlock(block) && !WaterAbility.isBendableWaterTempBlock(block))) {
@@ -1300,7 +1295,7 @@ public class GeneralMethods {
//At this point it should either be water or lava
if (blocki.getBlockData() instanceof Levelled) {
- Levelled level = (Levelled) blocki.getBlockData();
+ final Levelled level = (Levelled) blocki.getBlockData();
if (level.getLevel() == 0) {
sources++;
}
@@ -1455,52 +1450,31 @@ public class GeneralMethods {
if (wg.getPlatform().getGlobalStateManager().get(BukkitAdapter.adapt(location.getWorld())).blockTNTExplosions) {
return true;
}
- StateFlag.State tntflag = wg.getPlatform().getRegionContainer().createQuery().queryState(BukkitAdapter.adapt(location), WorldGuardPlugin.inst().wrapPlayer(player), Flags.TNT);
+ final StateFlag.State tntflag = wg.getPlatform().getRegionContainer().createQuery().queryState(BukkitAdapter.adapt(location), WorldGuardPlugin.inst().wrapPlayer(player), Flags.TNT);
if (tntflag != null && tntflag.equals(StateFlag.State.DENY)) {
return true;
}
}
- StateFlag bendingflag = (StateFlag)WorldGuard.getInstance().getFlagRegistry().get("bending");
+ final StateFlag bendingflag = (StateFlag) WorldGuard.getInstance().getFlagRegistry().get("bending");
if (bendingflag != null) {
- StateFlag.State bendingflagstate = wg.getPlatform().getRegionContainer().createQuery().queryState(BukkitAdapter.adapt(location), WorldGuardPlugin.inst().wrapPlayer(player), bendingflag);
- if(bendingflagstate == null && !wg.getPlatform().getRegionContainer().createQuery().testState(BukkitAdapter.adapt(location), WorldGuardPlugin.inst().wrapPlayer(player), Flags.BUILD)){
+ final StateFlag.State bendingflagstate = wg.getPlatform().getRegionContainer().createQuery().queryState(BukkitAdapter.adapt(location), WorldGuardPlugin.inst().wrapPlayer(player), bendingflag);
+ if (bendingflagstate == null && !wg.getPlatform().getRegionContainer().createQuery().testState(BukkitAdapter.adapt(location), WorldGuardPlugin.inst().wrapPlayer(player), Flags.BUILD)) {
return true;
}
- if (bendingflagstate != null && bendingflagstate.equals(StateFlag.State.DENY)){
+ if (bendingflagstate != null && bendingflagstate.equals(StateFlag.State.DENY)) {
return true;
}
} else {
- if(!wg.getPlatform().getRegionContainer().createQuery().testState(BukkitAdapter.adapt(location), WorldGuardPlugin.inst().wrapPlayer(player), Flags.BUILD)){
+ if (!wg.getPlatform().getRegionContainer().createQuery().testState(BukkitAdapter.adapt(location), WorldGuardPlugin.inst().wrapPlayer(player), Flags.BUILD)) {
return true;
}
}
}
- /* outdated plugin
- if (psp != null && respectPreciousStones) {
- final PreciousStones ps = (PreciousStones) psp;
-
- if (isIgnite) {
- if (ps.getForceFieldManager().hasSourceField(location, FieldFlag.PREVENT_FIRE)) {
- return true;
- }
- }
- if (isExplosive) {
- if (ps.getForceFieldManager().hasSourceField(location, FieldFlag.PREVENT_EXPLOSIONS)) {
- return true;
- }
- }
-
- if (!PreciousStones.API().canBreak(player, location)) {
- return true;
- }
- }
- */
-
if (facsfw != null && respectFactions) {
- FPlayer fPlayer = FPlayers.getBySender(player);
- Faction faction = Factions.getFactionAt(location);
- Rel relation = fPlayer.getRelationTo(faction);
+ final FPlayer fPlayer = FPlayers.getBySender(player);
+ final Faction faction = Factions.getFactionAt(location);
+ final Rel relation = fPlayer.getRelationTo(faction);
if (!(faction.isNone() || fPlayer.getFaction().equals(faction) || relation == Rel.ALLY)) {
return true;
@@ -1524,8 +1498,7 @@ public class GeneralMethods {
if (((status == TownBlockStatus.ENEMY) && TownyWarConfig.isAllowingAttacks())) {
try {
TownyWar.callAttackCellEvent(twn, player, location.getBlock(), worldCoord);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
TownyMessaging.sendErrorMsg(player, e.getMessage());
}
return true;
@@ -1539,8 +1512,7 @@ public class GeneralMethods {
TownyMessaging.sendErrorMsg(player, cache.getBlockErrMsg());
}
}
- }
- catch (final Exception e1) {
+ } catch (final Exception e1) {
TownyMessaging.sendErrorMsg(player, TownySettings.getLangString("msg_err_not_configured"));
}
}
@@ -1571,11 +1543,11 @@ public class GeneralMethods {
}
if (kingdoms != null && respectKingdoms) {
- KingdomPlayer kPlayer = GameManagement.getPlayerManager().getOfflineKingdomPlayer(player).getKingdomPlayer();
+ final KingdomPlayer kPlayer = GameManagement.getPlayerManager().getOfflineKingdomPlayer(player).getKingdomPlayer();
if (kPlayer.getKingdom() != null) {
- SimpleChunkLocation chunkLocation = new SimpleChunkLocation(location.getChunk());
- Land land = GameManagement.getLandManager().getOrLoadLand(chunkLocation);
- UUID owner = land.getOwnerUUID();
+ final SimpleChunkLocation chunkLocation = new SimpleChunkLocation(location.getChunk());
+ final Land land = GameManagement.getLandManager().getOrLoadLand(chunkLocation);
+ final UUID owner = land.getOwnerUUID();
if (owner != null) {
if (!kPlayer.getKingdom().getKing().equals(owner)) {
return true;
@@ -1586,8 +1558,8 @@ public class GeneralMethods {
}
if (redprotect != null && respectRedProtect) {
- RedProtectAPI api = RedProtect.get().getAPI();
- Region region = api.getRegion(location);
+ final RedProtectAPI api = RedProtect.get().getAPI();
+ final Region region = api.getRegion(location);
if (!(region != null && region.canBuild(player))) {
return true;
}
@@ -1617,7 +1589,7 @@ public class GeneralMethods {
if (entity == null) {
return false;
}
- switch(entity.getType()){
+ switch (entity.getType()) {
case SKELETON:
case STRAY:
case WITHER_SKELETON:
@@ -1961,15 +1933,13 @@ public class GeneralMethods {
} else if (obj instanceof Map) {
writeToDebug(simpleName + ": " + field.getName() + " size=" + ((Map, ?>) obj).size());
}
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
}
}
}
}
- }
- catch (final IOException e) {
+ } catch (final IOException e) {
e.printStackTrace();
}
@@ -2153,40 +2123,39 @@ public class GeneralMethods {
return loc.getWorld().spawnFallingBlock(loc, data);
}
- public static boolean playerHeadIsInBlock(Player player, Block block) {
+ public static boolean playerHeadIsInBlock(final Player player, final Block block) {
return playerHeadIsInBlock(player, block, false);
}
- public static boolean playerHeadIsInBlock(Player player, Block block, boolean exact) {
+ public static boolean playerHeadIsInBlock(final Player player, final Block block, final boolean exact) {
double checkDistance;
- if (exact){
+ if (exact) {
checkDistance = 0.5;
} else {
checkDistance = 0.75;
}
- return (player.getEyeLocation().getBlockY() == block.getLocation().getBlockY() && (Math.abs(player.getEyeLocation().getX() - block.getLocation().add(0.5,0.0, 0.5).getX()) < checkDistance) && (Math.abs(player.getEyeLocation().getZ() - block.getLocation().add(0.5,0.0, 0.5).getZ()) < checkDistance));
+ return (player.getEyeLocation().getBlockY() == block.getLocation().getBlockY() && (Math.abs(player.getEyeLocation().getX() - block.getLocation().add(0.5, 0.0, 0.5).getX()) < checkDistance) && (Math.abs(player.getEyeLocation().getZ() - block.getLocation().add(0.5, 0.0, 0.5).getZ()) < checkDistance));
}
- public static boolean playerFeetIsInBlock(Player player, Block block) {
+ public static boolean playerFeetIsInBlock(final Player player, final Block block) {
return playerFeetIsInBlock(player, block, false);
}
- public static boolean playerFeetIsInBlock(Player player, Block block, boolean exact) {
+ public static boolean playerFeetIsInBlock(final Player player, final Block block, final boolean exact) {
double checkDistance;
- if (exact){
+ if (exact) {
checkDistance = 0.5;
} else {
checkDistance = 0.75;
}
- return (player.getLocation().getBlockY() == block.getLocation().getBlockY() && (Math.abs(player.getLocation().getX() - block.getLocation().add(0.5,0.0, 0.5).getX()) < checkDistance) && (Math.abs(player.getLocation().getZ() - block.getLocation().add(0.5,0.0, 0.5).getZ()) < checkDistance));
+ return (player.getLocation().getBlockY() == block.getLocation().getBlockY() && (Math.abs(player.getLocation().getX() - block.getLocation().add(0.5, 0.0, 0.5).getX()) < checkDistance) && (Math.abs(player.getLocation().getZ() - block.getLocation().add(0.5, 0.0, 0.5).getZ()) < checkDistance));
}
public static void sendBrandingMessage(final CommandSender sender, final String message) {
ChatColor color;
try {
color = ChatColor.valueOf(ConfigManager.languageConfig.get().getString("Chat.Branding.Color").toUpperCase());
- }
- catch (final IllegalArgumentException exception) {
+ } catch (final IllegalArgumentException exception) {
color = ChatColor.GOLD;
}
@@ -2292,17 +2261,16 @@ public class GeneralMethods {
pw.flush();
pw.close();
- }
- catch (final IOException e) {
+ } catch (final IOException e) {
e.printStackTrace();
}
}
- public static boolean locationEqualsIgnoreDirection(Location loc1, Location loc2) {
+ public static boolean locationEqualsIgnoreDirection(final Location loc1, final Location loc2) {
return loc1.getWorld().equals(loc2.getWorld()) && loc1.getX() == loc2.getX() && loc1.getY() == loc2.getY() && loc1.getZ() == loc2.getZ();
}
- public static boolean isLightEmitting(Material material) {
+ public static boolean isLightEmitting(final Material material) {
switch (material) {
case GLOWSTONE:
case TORCH:
@@ -2318,4 +2286,4 @@ public class GeneralMethods {
}
return false;
}
-}
\ No newline at end of file
+}
diff --git a/src/com/projectkorra/projectkorra/Manager.java b/src/com/projectkorra/projectkorra/Manager.java
index d19f246f..bb9390e0 100644
--- a/src/com/projectkorra/projectkorra/Manager.java
+++ b/src/com/projectkorra/projectkorra/Manager.java
@@ -6,6 +6,7 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang3.Validate;
+
import org.bukkit.Bukkit;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
@@ -25,48 +26,47 @@ public abstract class Manager implements Listener {
/**
* Register a new {@link Manager} instance.
- *
+ *
* @param managerClass {@link Class} of the {@link Manager} to be registered
* @throws NullPointerException if managerClass is null
* @throws IllegalArgumentException if managerClass has already been
* registered
*/
- public static void registerManager(Class extends Manager> managerClass) {
+ public static void registerManager(final Class extends Manager> managerClass) {
Validate.notNull(managerClass, "Manager class cannot be null");
Validate.isTrue(!MANAGERS.containsKey(managerClass), "Manager has already been registered");
try {
- Constructor extends Manager> constructor = managerClass.getDeclaredConstructor();
- boolean accessible = constructor.isAccessible();
+ final Constructor extends Manager> constructor = managerClass.getDeclaredConstructor();
+ final boolean accessible = constructor.isAccessible();
constructor.setAccessible(true);
- Manager manager = constructor.newInstance();
+ final Manager manager = constructor.newInstance();
constructor.setAccessible(accessible);
manager.activate();
MANAGERS.put(managerClass, manager);
- }
- catch (InstantiationException | IllegalAccessException | NoSuchMethodException | SecurityException | IllegalArgumentException | InvocationTargetException e) {
+ } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | SecurityException | IllegalArgumentException | InvocationTargetException e) {
e.printStackTrace();
}
}
/**
* Get a registered {@link Manager} by its {@link Class}.
- *
+ *
* @param managerClass {@link Class} of the registered {@link Manager}
* @return instance of the {@link Manager} class
* @throws NullPointerException if managerClass is null
* @throws IllegalArgumentException if managerClass has not yet been
* registered
*/
- public static T getManager(Class managerClass) {
+ public static T getManager(final Class managerClass) {
Validate.notNull(managerClass, "Manager class cannot be null");
Validate.isTrue(MANAGERS.containsKey(managerClass), "Manager has not yet been registered");
- Manager registered = MANAGERS.get(managerClass);
+ final Manager registered = MANAGERS.get(managerClass);
return managerClass.cast(registered);
}
/**
* Get this plugin instance
- *
+ *
* @return {@link ProjectKorra} plugin instance
*/
protected ProjectKorra getPlugin() {
@@ -78,7 +78,7 @@ public abstract class Manager implements Listener {
*/
public final void activate() {
Bukkit.getPluginManager().registerEvents(this, ProjectKorra.plugin);
- onActivate();
+ this.onActivate();
}
/**
@@ -93,7 +93,7 @@ public abstract class Manager implements Listener {
*/
public final void deactivate() {
HandlerList.unregisterAll(this);
- onDeactivate();
+ this.onDeactivate();
}
/**
diff --git a/src/com/projectkorra/projectkorra/PKListener.java b/src/com/projectkorra/projectkorra/PKListener.java
index 1e1ba6de..ae78e21d 100644
--- a/src/com/projectkorra/projectkorra/PKListener.java
+++ b/src/com/projectkorra/projectkorra/PKListener.java
@@ -1,22 +1,134 @@
package com.projectkorra.projectkorra;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
import co.aikar.timings.lib.MCTiming;
+
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.GameMode;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.Statistic;
+import org.bukkit.block.Block;
+import org.bukkit.block.BlockFace;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.block.Action;
+import org.bukkit.event.block.BlockBreakEvent;
+import org.bukkit.event.block.BlockFadeEvent;
+import org.bukkit.event.block.BlockFormEvent;
+import org.bukkit.event.block.BlockFromToEvent;
+import org.bukkit.event.block.BlockIgniteEvent;
+import org.bukkit.event.block.BlockPhysicsEvent;
+import org.bukkit.event.block.BlockPistonExtendEvent;
+import org.bukkit.event.block.BlockPistonRetractEvent;
+import org.bukkit.event.block.BlockPlaceEvent;
+import org.bukkit.event.block.FluidLevelChangeEvent;
+import org.bukkit.event.entity.EntityChangeBlockEvent;
+import org.bukkit.event.entity.EntityCombustEvent;
+import org.bukkit.event.entity.EntityDamageByBlockEvent;
+import org.bukkit.event.entity.EntityDamageByEntityEvent;
+import org.bukkit.event.entity.EntityDamageEvent;
+import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
+import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
+import org.bukkit.event.entity.EntityDeathEvent;
+import org.bukkit.event.entity.EntityExplodeEvent;
+import org.bukkit.event.entity.EntityInteractEvent;
+import org.bukkit.event.entity.EntityPickupItemEvent;
+import org.bukkit.event.entity.EntityShootBowEvent;
+import org.bukkit.event.entity.EntityTargetEvent;
+import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
+import org.bukkit.event.entity.EntityTeleportEvent;
+import org.bukkit.event.entity.EntityToggleGlideEvent;
+import org.bukkit.event.entity.ItemMergeEvent;
+import org.bukkit.event.entity.PlayerDeathEvent;
+import org.bukkit.event.entity.ProjectileHitEvent;
+import org.bukkit.event.entity.ProjectileLaunchEvent;
+import org.bukkit.event.entity.SlimeSplitEvent;
+import org.bukkit.event.inventory.InventoryClickEvent;
+import org.bukkit.event.inventory.InventoryPickupItemEvent;
+import org.bukkit.event.player.AsyncPlayerChatEvent;
+import org.bukkit.event.player.PlayerBucketEmptyEvent;
+import org.bukkit.event.player.PlayerChangedWorldEvent;
+import org.bukkit.event.player.PlayerGameModeChangeEvent;
+import org.bukkit.event.player.PlayerInteractAtEntityEvent;
+import org.bukkit.event.player.PlayerInteractEvent;
+import org.bukkit.event.player.PlayerItemDamageEvent;
+import org.bukkit.event.player.PlayerItemHeldEvent;
+import org.bukkit.event.player.PlayerJoinEvent;
+import org.bukkit.event.player.PlayerKickEvent;
+import org.bukkit.event.player.PlayerMoveEvent;
+import org.bukkit.event.player.PlayerQuitEvent;
+import org.bukkit.event.player.PlayerSwapHandItemsEvent;
+import org.bukkit.event.player.PlayerToggleFlightEvent;
+import org.bukkit.event.player.PlayerToggleSneakEvent;
+import org.bukkit.inventory.EquipmentSlot;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.scheduler.BukkitRunnable;
+import org.bukkit.util.Vector;
+
import com.projectkorra.projectkorra.Element.SubElement;
-import com.projectkorra.projectkorra.ability.*;
+import com.projectkorra.projectkorra.ability.Ability;
+import com.projectkorra.projectkorra.ability.AddonAbility;
+import com.projectkorra.projectkorra.ability.AirAbility;
+import com.projectkorra.projectkorra.ability.AvatarAbility;
+import com.projectkorra.projectkorra.ability.ChiAbility;
+import com.projectkorra.projectkorra.ability.CoreAbility;
+import com.projectkorra.projectkorra.ability.EarthAbility;
+import com.projectkorra.projectkorra.ability.ElementalAbility;
+import com.projectkorra.projectkorra.ability.FireAbility;
+import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.ability.util.ComboManager;
import com.projectkorra.projectkorra.ability.util.MultiAbilityManager;
import com.projectkorra.projectkorra.ability.util.PassiveManager;
-import com.projectkorra.projectkorra.airbending.*;
+import com.projectkorra.projectkorra.airbending.AirBlast;
+import com.projectkorra.projectkorra.airbending.AirBurst;
+import com.projectkorra.projectkorra.airbending.AirScooter;
+import com.projectkorra.projectkorra.airbending.AirShield;
+import com.projectkorra.projectkorra.airbending.AirSpout;
+import com.projectkorra.projectkorra.airbending.AirSuction;
+import com.projectkorra.projectkorra.airbending.AirSwipe;
+import com.projectkorra.projectkorra.airbending.Suffocate;
+import com.projectkorra.projectkorra.airbending.Tornado;
import com.projectkorra.projectkorra.airbending.flight.FlightMultiAbility;
import com.projectkorra.projectkorra.airbending.passive.GracefulDescent;
import com.projectkorra.projectkorra.avatar.AvatarState;
-import com.projectkorra.projectkorra.chiblocking.*;
+import com.projectkorra.projectkorra.chiblocking.AcrobatStance;
+import com.projectkorra.projectkorra.chiblocking.HighJump;
+import com.projectkorra.projectkorra.chiblocking.Paralyze;
+import com.projectkorra.projectkorra.chiblocking.QuickStrike;
+import com.projectkorra.projectkorra.chiblocking.RapidPunch;
+import com.projectkorra.projectkorra.chiblocking.Smokescreen;
+import com.projectkorra.projectkorra.chiblocking.SwiftKick;
+import com.projectkorra.projectkorra.chiblocking.WarriorStance;
import com.projectkorra.projectkorra.chiblocking.passive.Acrobatics;
import com.projectkorra.projectkorra.chiblocking.passive.ChiPassive;
import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.configuration.ConfigManager;
-import com.projectkorra.projectkorra.earthbending.*;
+import com.projectkorra.projectkorra.earthbending.Catapult;
+import com.projectkorra.projectkorra.earthbending.Collapse;
+import com.projectkorra.projectkorra.earthbending.CollapseWall;
+import com.projectkorra.projectkorra.earthbending.EarthArmor;
+import com.projectkorra.projectkorra.earthbending.EarthBlast;
+import com.projectkorra.projectkorra.earthbending.EarthGrab;
import com.projectkorra.projectkorra.earthbending.EarthGrab.GrabMode;
+import com.projectkorra.projectkorra.earthbending.EarthSmash;
+import com.projectkorra.projectkorra.earthbending.EarthTunnel;
+import com.projectkorra.projectkorra.earthbending.RaiseEarth;
+import com.projectkorra.projectkorra.earthbending.RaiseEarthWall;
+import com.projectkorra.projectkorra.earthbending.Shockwave;
+import com.projectkorra.projectkorra.earthbending.Tremorsense;
import com.projectkorra.projectkorra.earthbending.combo.EarthPillars;
import com.projectkorra.projectkorra.earthbending.lava.LavaFlow;
import com.projectkorra.projectkorra.earthbending.lava.LavaFlow.AbilityType;
@@ -30,18 +142,44 @@ import com.projectkorra.projectkorra.event.EntityBendingDeathEvent;
import com.projectkorra.projectkorra.event.HorizontalVelocityChangeEvent;
import com.projectkorra.projectkorra.event.PlayerChangeElementEvent;
import com.projectkorra.projectkorra.event.PlayerJumpEvent;
-import com.projectkorra.projectkorra.firebending.*;
+import com.projectkorra.projectkorra.firebending.Blaze;
+import com.projectkorra.projectkorra.firebending.BlazeArc;
+import com.projectkorra.projectkorra.firebending.BlazeRing;
+import com.projectkorra.projectkorra.firebending.FireBlast;
+import com.projectkorra.projectkorra.firebending.FireBlastCharged;
+import com.projectkorra.projectkorra.firebending.FireBurst;
+import com.projectkorra.projectkorra.firebending.FireJet;
+import com.projectkorra.projectkorra.firebending.FireManipulation;
import com.projectkorra.projectkorra.firebending.FireManipulation.FireManipulationType;
+import com.projectkorra.projectkorra.firebending.FireShield;
+import com.projectkorra.projectkorra.firebending.HeatControl;
import com.projectkorra.projectkorra.firebending.HeatControl.HeatControlType;
+import com.projectkorra.projectkorra.firebending.Illumination;
+import com.projectkorra.projectkorra.firebending.WallOfFire;
import com.projectkorra.projectkorra.firebending.combustion.Combustion;
import com.projectkorra.projectkorra.firebending.lightning.Lightning;
import com.projectkorra.projectkorra.firebending.passive.FirePassive;
import com.projectkorra.projectkorra.firebending.util.FireDamageTimer;
import com.projectkorra.projectkorra.object.HorizontalVelocityTracker;
import com.projectkorra.projectkorra.object.Preset;
-import com.projectkorra.projectkorra.util.*;
+import com.projectkorra.projectkorra.util.BlockSource;
+import com.projectkorra.projectkorra.util.ClickType;
+import com.projectkorra.projectkorra.util.DamageHandler;
+import com.projectkorra.projectkorra.util.FlightHandler;
import com.projectkorra.projectkorra.util.FlightHandler.Flight;
-import com.projectkorra.projectkorra.waterbending.*;
+import com.projectkorra.projectkorra.util.MovementHandler;
+import com.projectkorra.projectkorra.util.PassiveHandler;
+import com.projectkorra.projectkorra.util.StatisticsManager;
+import com.projectkorra.projectkorra.util.StatisticsMethods;
+import com.projectkorra.projectkorra.util.TempArmor;
+import com.projectkorra.projectkorra.util.TempBlock;
+import com.projectkorra.projectkorra.waterbending.OctopusForm;
+import com.projectkorra.projectkorra.waterbending.SurgeWall;
+import com.projectkorra.projectkorra.waterbending.SurgeWave;
+import com.projectkorra.projectkorra.waterbending.Torrent;
+import com.projectkorra.projectkorra.waterbending.WaterBubble;
+import com.projectkorra.projectkorra.waterbending.WaterManipulation;
+import com.projectkorra.projectkorra.waterbending.WaterSpout;
import com.projectkorra.projectkorra.waterbending.blood.Bloodbending;
import com.projectkorra.projectkorra.waterbending.combo.IceBullet;
import com.projectkorra.projectkorra.waterbending.healing.HealingWaters;
@@ -52,30 +190,6 @@ import com.projectkorra.projectkorra.waterbending.ice.PhaseChange.PhaseChangeTyp
import com.projectkorra.projectkorra.waterbending.multiabilities.WaterArms;
import com.projectkorra.projectkorra.waterbending.passive.FastSwim;
import com.projectkorra.projectkorra.waterbending.passive.HydroSink;
-import org.bukkit.Statistic;
-import org.bukkit.*;
-import org.bukkit.block.Block;
-import org.bukkit.block.BlockFace;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-import org.bukkit.event.Listener;
-import org.bukkit.event.block.*;
-import org.bukkit.event.entity.*;
-import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
-import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
-import org.bukkit.event.inventory.InventoryClickEvent;
-import org.bukkit.event.inventory.InventoryPickupItemEvent;
-import org.bukkit.event.player.*;
-import org.bukkit.inventory.EquipmentSlot;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.scheduler.BukkitRunnable;
-import org.bukkit.util.Vector;
-
-import java.util.*;
public class PKListener implements Listener {
ProjectKorra plugin;
@@ -155,7 +269,7 @@ public class PKListener implements Listener {
TempBlock.revertBlock(block, Material.AIR);
} else if (DensityShift.isPassiveSand(block)) {
DensityShift.revertSand(block);
- } else if (WaterBubble.isAir(block)){
+ } else if (WaterBubble.isAir(block)) {
event.setCancelled(true);
}
}
@@ -164,7 +278,7 @@ public class PKListener implements Listener {
public void onBlockFlowTo(final BlockFromToEvent event) {
final Block toblock = event.getToBlock();
final Block fromblock = event.getBlock();
-
+
if (TempBlock.isTempBlock(fromblock) || TempBlock.isTempBlock(toblock)) {
event.setCancelled(true);
} else {
@@ -175,7 +289,7 @@ public class PKListener implements Listener {
if (!event.isCancelled()) {
event.setCancelled(!WaterManipulation.canFlowFromTo(fromblock, toblock));
}
-
+
if (!event.isCancelled()) {
if (Illumination.isIlluminationTorch(toblock)) {
toblock.setType(Material.AIR);
@@ -186,8 +300,8 @@ public class PKListener implements Listener {
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
- public void onFluidLevelChange(FluidLevelChangeEvent event) {
- if (TempBlock.isTempBlock(event.getBlock())){
+ public void onFluidLevelChange(final FluidLevelChangeEvent event) {
+ if (TempBlock.isTempBlock(event.getBlock())) {
event.setCancelled(true);
} else if (TempBlock.isTouchingTempBlock(event.getBlock())) {
event.setCancelled(true);
@@ -229,8 +343,7 @@ public class PKListener implements Listener {
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
- public void onBlockIgnite(final BlockIgniteEvent event) {
- }
+ public void onBlockIgnite(final BlockIgniteEvent event) {}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlockMeltEvent(final BlockFadeEvent event) {
@@ -269,28 +382,28 @@ public class PKListener implements Listener {
public void onBlockPhysics(final BlockPhysicsEvent event) {
final Block block = event.getBlock();
- try(MCTiming timing = TimingPhysicsWaterManipulationCheck.startTiming()) {
+ try (MCTiming timing = TimingPhysicsWaterManipulationCheck.startTiming()) {
if (!WaterManipulation.canPhysicsChange(block)) {
event.setCancelled(true);
return;
}
}
- try(MCTiming timing = TimingPhysicsEarthPassiveCheck.startTiming()) {
+ try (MCTiming timing = TimingPhysicsEarthPassiveCheck.startTiming()) {
if (!EarthPassive.canPhysicsChange(block)) {
event.setCancelled(true);
return;
}
}
- try(MCTiming timing = TimingPhysicsIlluminationTorchCheck.startTiming()) {
+ try (MCTiming timing = TimingPhysicsIlluminationTorchCheck.startTiming()) {
if (Illumination.isIlluminationTorch(block)) {
event.setCancelled(true);
return;
}
}
- try(MCTiming timing = TimingPhysicsEarthAbilityCheck.startTiming()) {
+ try (MCTiming timing = TimingPhysicsEarthAbilityCheck.startTiming()) {
if (EarthAbility.getPreventPhysicsBlocks().contains(block)) {
event.setCancelled(true);
return;
@@ -298,11 +411,8 @@ public class PKListener implements Listener {
}
// If there is a TempBlock of Air bellow FallingSand blocks, prevent it from updating.
- try(MCTiming timing = TimingPhysicsAirTempBlockBelowFallingBlockCheck.startTiming()) {
- if ((block.getType() == Material.SAND || block.getType() == Material.RED_SAND || block.getType() == Material.GRAVEL || block.getType() == Material.ANVIL || block.getType() == Material.DRAGON_EGG) &&
- ElementalAbility.isAir(block.getRelative(BlockFace.DOWN).getType()) &&
- TempBlock.isTempBlock(block.getRelative(BlockFace.DOWN))
- ) {
+ try (MCTiming timing = TimingPhysicsAirTempBlockBelowFallingBlockCheck.startTiming()) {
+ if ((block.getType() == Material.SAND || block.getType() == Material.RED_SAND || block.getType() == Material.GRAVEL || block.getType() == Material.ANVIL || block.getType() == Material.DRAGON_EGG) && ElementalAbility.isAir(block.getRelative(BlockFace.DOWN).getType()) && TempBlock.isTempBlock(block.getRelative(BlockFace.DOWN))) {
event.setCancelled(true);
}
}
@@ -378,8 +488,7 @@ public class PKListener implements Listener {
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
- public void onEntityDamageBlock(final EntityDamageByBlockEvent event) {
- }
+ public void onEntityDamageBlock(final EntityDamageByBlockEvent event) {}
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onEntityDamageByBlock(final EntityDamageByBlockEvent event) {
@@ -1081,30 +1190,23 @@ public class PKListener implements Listener {
if (ProjectKorra.isStatisticsEnabled()) {
Manager.getManager(StatisticsManager.class).load(player.getUniqueId());
}
- Bukkit.getScheduler().runTaskLater(ProjectKorra.plugin, new Runnable() {
-
- @Override
- public void run() {
- PassiveManager.registerPassives(player);
- GeneralMethods.removeUnusableAbilities(player.getName());
- }
+ Bukkit.getScheduler().runTaskLater(ProjectKorra.plugin, (Runnable) () -> {
+ PassiveManager.registerPassives(player);
+ GeneralMethods.removeUnusableAbilities(player.getName());
}, 5);
if (ConfigManager.languageConfig.get().getBoolean("Chat.Branding.JoinMessage.Enabled")) {
- Bukkit.getScheduler().runTaskLater(ProjectKorra.plugin, new Runnable() {
- @Override
- public void run() {
- ChatColor color = ChatColor.valueOf(ConfigManager.languageConfig.get().getString("Chat.Branding.Color").toUpperCase());
- color = color == null ? ChatColor.GOLD : color;
- final String topBorder = ConfigManager.languageConfig.get().getString("Chat.Branding.Borders.TopBorder");
- final String bottomBorder = ConfigManager.languageConfig.get().getString("Chat.Branding.Borders.BottomBorder");
- if (!topBorder.isEmpty()) {
- player.sendMessage(ChatColor.translateAlternateColorCodes('&', topBorder));
- }
- player.sendMessage(color + "This server is running ProjectKorra version " + ProjectKorra.plugin.getDescription().getVersion() + " for bending! Find out more at http://www.projectkorra.com!");
- if (!bottomBorder.isEmpty()) {
- player.sendMessage(ChatColor.translateAlternateColorCodes('&', bottomBorder));
- }
+ Bukkit.getScheduler().runTaskLater(ProjectKorra.plugin, (Runnable) () -> {
+ ChatColor color = ChatColor.valueOf(ConfigManager.languageConfig.get().getString("Chat.Branding.Color").toUpperCase());
+ color = color == null ? ChatColor.GOLD : color;
+ final String topBorder = ConfigManager.languageConfig.get().getString("Chat.Branding.Borders.TopBorder");
+ final String bottomBorder = ConfigManager.languageConfig.get().getString("Chat.Branding.Borders.BottomBorder");
+ if (!topBorder.isEmpty()) {
+ player.sendMessage(ChatColor.translateAlternateColorCodes('&', topBorder));
+ }
+ player.sendMessage(color + "This server is running ProjectKorra version " + ProjectKorra.plugin.getDescription().getVersion() + " for bending! Find out more at http://www.projectkorra.com!");
+ if (!bottomBorder.isEmpty()) {
+ player.sendMessage(ChatColor.translateAlternateColorCodes('&', bottomBorder));
}
}, 20 * 4);
}
@@ -1129,7 +1231,7 @@ public class PKListener implements Listener {
final Player player = event.getPlayer();
final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
- try(MCTiming timing = TimingPlayerMoveMovementHandlerCheck.startTiming()) {
+ try (MCTiming timing = TimingPlayerMoveMovementHandlerCheck.startTiming()) {
if (MovementHandler.isStopped(player)) {
if (event.getTo().getX() != event.getFrom().getX() || event.getTo().getZ() != event.getFrom().getZ() || event.getTo().getY() > event.getFrom().getY()) {
event.setCancelled(true);
@@ -1138,7 +1240,7 @@ public class PKListener implements Listener {
}
}
- try(MCTiming timing = TimingPlayerMoveSpoutCheck.startTiming()) {
+ try (MCTiming timing = TimingPlayerMoveSpoutCheck.startTiming()) {
if (CoreAbility.hasAbility(player, WaterSpout.class) || CoreAbility.hasAbility(player, AirSpout.class)) {
Vector vel = new Vector();
vel.setX(event.getTo().getX() - event.getFrom().getX());
@@ -1156,7 +1258,7 @@ public class PKListener implements Listener {
}
}
- try(MCTiming timing = TimingPlayerMoveBloodbentCheck.startTiming()) {
+ try (MCTiming timing = TimingPlayerMoveBloodbentCheck.startTiming()) {
if (Bloodbending.isBloodbent(player)) {
final BendingPlayer bender = Bloodbending.getBloodbender(player);
if (bender.isAvatarState()) {
@@ -1175,20 +1277,20 @@ public class PKListener implements Listener {
}
if (bPlayer != null) {
- try(MCTiming timing = TimingPlayerMoveAirChiPassiveCheck) {
+ try (MCTiming timing = TimingPlayerMoveAirChiPassiveCheck) {
if (bPlayer.hasElement(Element.AIR) || bPlayer.hasElement(Element.CHI)) {
PassiveHandler.checkExhaustionPassives(player);
}
}
- try(MCTiming timing = TimingPlayerMoveFirePassiveCheck.startTiming()) {
+ try (MCTiming timing = TimingPlayerMoveFirePassiveCheck.startTiming()) {
if (event.getTo().getBlock() != event.getFrom().getBlock()) {
FirePassive.handle(player);
}
}
}
- try(MCTiming timing = TimingPlayerMoveJumpCheck.startTiming()) {
+ try (MCTiming timing = TimingPlayerMoveJumpCheck.startTiming()) {
if (event.getTo().getY() > event.getFrom().getY()) {
if (!(player.getLocation().getBlock().getType() == Material.VINE) && !(player.getLocation().getBlock().getType() == Material.LADDER)) {
final int current = player.getStatistic(Statistic.JUMP);
@@ -1315,17 +1417,17 @@ public class PKListener implements Listener {
final CoreAbility coreAbil = bPlayer.getBoundAbility();
final String abil = bPlayer.getBoundAbilityName();
-
+
if (coreAbil == null || !coreAbil.isSneakAbility()) {
if (PassiveManager.hasPassive(player, CoreAbility.getAbility(FerroControl.class))) {
new FerroControl(player);
}
-
+
if (PassiveManager.hasPassive(player, CoreAbility.getAbility(FastSwim.class))) {
new FastSwim(player);
}
}
-
+
if (coreAbil == null) {
return;
}
@@ -1495,7 +1597,7 @@ public class PKListener implements Listener {
if (event.getAction() != Action.LEFT_CLICK_BLOCK && event.getAction() != Action.LEFT_CLICK_AIR) {
return;
}
- if (event.getAction() == Action.LEFT_CLICK_BLOCK && event.isCancelled()){
+ if (event.getAction() == Action.LEFT_CLICK_BLOCK && event.isCancelled()) {
return;
}
final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
@@ -1766,7 +1868,7 @@ public class PKListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPickupItem(final EntityPickupItemEvent event) {
- for (MetalClips metalClips : CoreAbility.getAbilities(MetalClips.class)) {
+ for (final MetalClips metalClips : CoreAbility.getAbilities(MetalClips.class)) {
if (metalClips.getTrackedIngots().contains(event.getItem())) {
event.setCancelled(true);
}
@@ -1775,7 +1877,7 @@ public class PKListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onInventoryPickupItem(final InventoryPickupItemEvent event) {
- for (MetalClips metalClips : CoreAbility.getAbilities(MetalClips.class)) {
+ for (final MetalClips metalClips : CoreAbility.getAbilities(MetalClips.class)) {
if (metalClips.getTrackedIngots().contains(event.getItem())) {
event.setCancelled(true);
}
@@ -1784,7 +1886,7 @@ public class PKListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onItemMerge(final ItemMergeEvent event) {
- for (MetalClips metalClips : CoreAbility.getAbilities(MetalClips.class)) {
+ for (final MetalClips metalClips : CoreAbility.getAbilities(MetalClips.class)) {
if (metalClips.getTrackedIngots().contains(event.getEntity()) || metalClips.getTrackedIngots().contains(event.getTarget())) {
event.setCancelled(true);
}
@@ -1792,8 +1894,8 @@ public class PKListener implements Listener {
}
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
- public void onBlockPistonExtendEvent(final BlockPistonExtendEvent event){
- for (Block b : event.getBlocks()) {
+ public void onBlockPistonExtendEvent(final BlockPistonExtendEvent event) {
+ for (final Block b : event.getBlocks()) {
if (TempBlock.isTempBlock(b)) {
event.setCancelled(true);
break;
@@ -1802,8 +1904,8 @@ public class PKListener implements Listener {
}
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
- public void onBlockPistonRetractEvent(final BlockPistonRetractEvent event){
- for (Block b : event.getBlocks()) {
+ public void onBlockPistonRetractEvent(final BlockPistonRetractEvent event) {
+ for (final Block b : event.getBlocks()) {
if (TempBlock.isTempBlock(b)) {
event.setCancelled(true);
break;
diff --git a/src/com/projectkorra/projectkorra/ProjectKorra.java b/src/com/projectkorra/projectkorra/ProjectKorra.java
index 102ec070..4ddfe988 100644
--- a/src/com/projectkorra/projectkorra/ProjectKorra.java
+++ b/src/com/projectkorra/projectkorra/ProjectKorra.java
@@ -1,10 +1,26 @@
package com.projectkorra.projectkorra;
+import java.util.HashMap;
+import java.util.logging.Logger;
+
+import com.bekvon.bukkit.residence.protection.FlagPermissions;
+
import co.aikar.timings.lib.MCTiming;
import co.aikar.timings.lib.TimingManager;
-import com.bekvon.bukkit.residence.protection.FlagPermissions;
+
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.Statistic;
+import org.bukkit.entity.Player;
+import org.bukkit.plugin.java.JavaPlugin;
+import org.bukkit.scheduler.BukkitTask;
+
import com.projectkorra.projectkorra.ability.CoreAbility;
-import com.projectkorra.projectkorra.ability.util.*;
+import com.projectkorra.projectkorra.ability.util.CollisionInitializer;
+import com.projectkorra.projectkorra.ability.util.CollisionManager;
+import com.projectkorra.projectkorra.ability.util.ComboManager;
+import com.projectkorra.projectkorra.ability.util.MultiAbilityManager;
+import com.projectkorra.projectkorra.ability.util.PassiveManager;
import com.projectkorra.projectkorra.airbending.util.AirbendingManager;
import com.projectkorra.projectkorra.chiblocking.util.ChiblockingManager;
import com.projectkorra.projectkorra.command.Commands;
@@ -15,17 +31,12 @@ import com.projectkorra.projectkorra.hooks.PlaceholderAPIHook;
import com.projectkorra.projectkorra.hooks.WorldGuardFlag;
import com.projectkorra.projectkorra.object.Preset;
import com.projectkorra.projectkorra.storage.DBConnection;
-import com.projectkorra.projectkorra.util.*;
+import com.projectkorra.projectkorra.util.Metrics;
+import com.projectkorra.projectkorra.util.RevertChecker;
+import com.projectkorra.projectkorra.util.StatisticsManager;
+import com.projectkorra.projectkorra.util.TempBlock;
+import com.projectkorra.projectkorra.util.Updater;
import com.projectkorra.projectkorra.waterbending.util.WaterbendingManager;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.Statistic;
-import org.bukkit.entity.Player;
-import org.bukkit.plugin.java.JavaPlugin;
-import org.bukkit.scheduler.BukkitTask;
-
-import java.util.HashMap;
-import java.util.logging.Logger;
public class ProjectKorra extends JavaPlugin {
@@ -74,22 +85,19 @@ public class ProjectKorra extends JavaPlugin {
this.getServer().getScheduler().scheduleSyncRepeatingTask(this, new EarthbendingManager(this), 0, 1);
this.getServer().getScheduler().scheduleSyncRepeatingTask(this, new FirebendingManager(this), 0, 1);
this.getServer().getScheduler().scheduleSyncRepeatingTask(this, new ChiblockingManager(this), 0, 1);
- revertChecker = this.getServer().getScheduler().runTaskTimerAsynchronously(this, new RevertChecker(this), 0, 200);
+ this.revertChecker = this.getServer().getScheduler().runTaskTimerAsynchronously(this, new RevertChecker(this), 0, 200);
if (ConfigManager.languageConfig.get().getBoolean("Chat.Branding.AutoAnnouncer.Enabled")) {
- this.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
- @Override
- public void run() {
- ChatColor color = ChatColor.valueOf(ConfigManager.languageConfig.get().getString("Chat.Branding" + ".Color").toUpperCase());
- color = color == null ? ChatColor.GOLD : color;
- final String topBorder = ConfigManager.languageConfig.get().getString("Chat.Branding.Borders.TopBorder");
- final String bottomBorder = ConfigManager.languageConfig.get().getString("Chat.Branding.Borders" + ".BottomBorder");
- if (!topBorder.isEmpty()) {
- Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', topBorder));
- }
- Bukkit.broadcastMessage(color + "This server is running ProjectKorra version " + ProjectKorra.plugin.getDescription().getVersion() + " for bending! Find out more at http://www" + ".projectkorra.com!");
- if (!bottomBorder.isEmpty()) {
- Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', bottomBorder));
- }
+ this.getServer().getScheduler().scheduleSyncRepeatingTask(this, () -> {
+ ChatColor color = ChatColor.valueOf(ConfigManager.languageConfig.get().getString("Chat.Branding" + ".Color").toUpperCase());
+ color = color == null ? ChatColor.GOLD : color;
+ final String topBorder = ConfigManager.languageConfig.get().getString("Chat.Branding.Borders.TopBorder");
+ final String bottomBorder = ConfigManager.languageConfig.get().getString("Chat.Branding.Borders" + ".BottomBorder");
+ if (!topBorder.isEmpty()) {
+ Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', topBorder));
+ }
+ Bukkit.broadcastMessage(color + "This server is running ProjectKorra version " + ProjectKorra.plugin.getDescription().getVersion() + " for bending! Find out more at http://www" + ".projectkorra.com!");
+ if (!bottomBorder.isEmpty()) {
+ Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', bottomBorder));
}
}, (long) (ConfigManager.languageConfig.get().getDouble("Chat.Branding.AutoAnnouncer.Interval") * 60 * 20), (long) (ConfigManager.languageConfig.get().getDouble("Chat.Branding.AutoAnnouncer.Interval") * 60 * 20));
}
@@ -101,12 +109,9 @@ public class ProjectKorra extends JavaPlugin {
GeneralMethods.createBendingPlayer(player.getUniqueId(), player.getName());
GeneralMethods.removeUnusableAbilities(player.getName());
Manager.getManager(StatisticsManager.class).load(player.getUniqueId());
- Bukkit.getScheduler().runTaskLater(ProjectKorra.plugin, new Runnable() {
- @Override
- public void run() {
- PassiveManager.registerPassives(player);
- GeneralMethods.removeUnusableAbilities(player.getName());
- }
+ Bukkit.getScheduler().runTaskLater(ProjectKorra.plugin, (Runnable) () -> {
+ PassiveManager.registerPassives(player);
+ GeneralMethods.removeUnusableAbilities(player.getName());
}, 30);
}
@@ -143,14 +148,14 @@ public class ProjectKorra extends JavaPlugin {
GeneralMethods.deserializeFile();
GeneralMethods.startCacheCleaner(cacheTime);
- if(Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
+ if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
new PlaceholderAPIHook(this).register();
}
}
@Override
public void onDisable() {
- revertChecker.cancel();
+ this.revertChecker.cancel();
GeneralMethods.stopBending();
for (final Player player : this.getServer().getOnlinePlayers()) {
if (isStatisticsEnabled()) {
@@ -169,7 +174,7 @@ public class ProjectKorra extends JavaPlugin {
@Override
public void onLoad() {
- if(Bukkit.getPluginManager().getPlugin("WorldGuard") != null) {
+ if (Bukkit.getPluginManager().getPlugin("WorldGuard") != null) {
WorldGuardFlag.registerBendingWorldGuardFlag();
}
}
@@ -193,11 +198,12 @@ public class ProjectKorra extends JavaPlugin {
public static boolean isStatisticsEnabled() {
return ConfigManager.getConfig().getBoolean("Properties.Statistics");
}
+
public static boolean isDatabaseCooldownsEnabled() {
return ConfigManager.getConfig().getBoolean("Properties.DatabaseCooldowns");
}
- public static MCTiming timing(String name) {
+ public static MCTiming timing(final String name) {
return timingManager.of(name);
}
}
diff --git a/src/com/projectkorra/projectkorra/ability/AirAbility.java b/src/com/projectkorra/projectkorra/ability/AirAbility.java
index e4aed6c3..1c4b4a66 100644
--- a/src/com/projectkorra/projectkorra/ability/AirAbility.java
+++ b/src/com/projectkorra/projectkorra/ability/AirAbility.java
@@ -142,11 +142,9 @@ public abstract class AirAbility extends ElementalAbility {
try {
sound = Sound.valueOf(getConfig().getString("Properties.Air.Sound.Sound"));
- }
- catch (final IllegalArgumentException exception) {
+ } catch (final IllegalArgumentException exception) {
ProjectKorra.log.warning("Your current value for 'Properties.Air.Sound.Sound' is not valid.");
- }
- finally {
+ } finally {
loc.getWorld().playSound(loc, sound, volume, pitch);
}
}
diff --git a/src/com/projectkorra/projectkorra/ability/AvatarAbility.java b/src/com/projectkorra/projectkorra/ability/AvatarAbility.java
index 112180c2..da7a25ca 100644
--- a/src/com/projectkorra/projectkorra/ability/AvatarAbility.java
+++ b/src/com/projectkorra/projectkorra/ability/AvatarAbility.java
@@ -37,11 +37,9 @@ public abstract class AvatarAbility extends ElementalAbility {
try {
sound = Sound.valueOf(getConfig().getString("Abilities.Avatar.AvatarState.Sound.Sound"));
- }
- catch (final IllegalArgumentException exception) {
+ } catch (final IllegalArgumentException exception) {
ProjectKorra.log.warning("Your current value for 'Abilities.Avatar.AvatarState.Sound.Sound' is not valid.");
- }
- finally {
+ } finally {
loc.getWorld().playSound(loc, sound, volume, pitch);
}
}
diff --git a/src/com/projectkorra/projectkorra/ability/CoreAbility.java b/src/com/projectkorra/projectkorra/ability/CoreAbility.java
index 8cca8718..d544acd2 100644
--- a/src/com/projectkorra/projectkorra/ability/CoreAbility.java
+++ b/src/com/projectkorra/projectkorra/ability/CoreAbility.java
@@ -1,15 +1,57 @@
package com.projectkorra.projectkorra.ability;
-import co.aikar.timings.lib.MCTiming;
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentSkipListMap;
+import java.util.jar.JarFile;
+
+import sun.reflect.ReflectionFactory;
+
+import org.apache.commons.lang3.Validate;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import org.apache.commons.lang3.tuple.Pair;
+
import com.google.common.reflect.ClassPath;
import com.google.common.reflect.ClassPath.ClassInfo;
+
+import co.aikar.timings.lib.MCTiming;
+
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.Location;
+import org.bukkit.configuration.file.FileConfiguration;
+import org.bukkit.entity.Player;
+import org.bukkit.plugin.java.JavaPlugin;
+
import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.Element.SubElement;
import com.projectkorra.projectkorra.Manager;
import com.projectkorra.projectkorra.ProjectKorra;
-import com.projectkorra.projectkorra.ability.util.*;
+import com.projectkorra.projectkorra.ability.util.AbilityLoader;
+import com.projectkorra.projectkorra.ability.util.AddonAbilityLoader;
+import com.projectkorra.projectkorra.ability.util.Collision;
+import com.projectkorra.projectkorra.ability.util.CollisionManager;
+import com.projectkorra.projectkorra.ability.util.ComboManager;
+import com.projectkorra.projectkorra.ability.util.MultiAbilityManager;
import com.projectkorra.projectkorra.ability.util.MultiAbilityManager.MultiAbilityInfo;
+import com.projectkorra.projectkorra.ability.util.PassiveManager;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.attribute.AttributeModifier;
import com.projectkorra.projectkorra.attribute.AttributePriority;
@@ -19,28 +61,6 @@ import com.projectkorra.projectkorra.event.AbilityProgressEvent;
import com.projectkorra.projectkorra.event.AbilityStartEvent;
import com.projectkorra.projectkorra.util.FlightHandler;
import com.projectkorra.projectkorra.util.TimeUtil;
-import org.apache.commons.lang3.Validate;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-import org.apache.commons.lang3.tuple.Pair;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.Location;
-import org.bukkit.configuration.file.FileConfiguration;
-import org.bukkit.entity.Player;
-import org.bukkit.plugin.java.JavaPlugin;
-import sun.reflect.ReflectionFactory;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.text.SimpleDateFormat;
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentSkipListMap;
-import java.util.jar.JarFile;
/**
* CoreAbility provides default implementation of an Ability, including methods
@@ -101,13 +121,13 @@ public abstract class CoreAbility implements Ability {
* @see #getAbility(String)
*/
public CoreAbility() {
- for (Field field : getClass().getDeclaredFields()) {
+ for (final Field field : this.getClass().getDeclaredFields()) {
if (field.isAnnotationPresent(Attribute.class)) {
- Attribute attribute = field.getAnnotation(Attribute.class);
- if (!ATTRIBUTE_FIELDS.containsKey(getClass())) {
- ATTRIBUTE_FIELDS.put(getClass(), new HashMap<>());
+ final Attribute attribute = field.getAnnotation(Attribute.class);
+ if (!ATTRIBUTE_FIELDS.containsKey(this.getClass())) {
+ ATTRIBUTE_FIELDS.put(this.getClass(), new HashMap<>());
}
- ATTRIBUTE_FIELDS.get(getClass()).put(attribute.value(), field);
+ ATTRIBUTE_FIELDS.get(this.getClass()).put(attribute.value(), field);
}
}
}
@@ -250,25 +270,22 @@ public abstract class CoreAbility implements Ability {
abil.attributesModified = true;
}
- try(MCTiming timing = ProjectKorra.timing(abil.getName()).startTiming()) {
+ try (MCTiming timing = ProjectKorra.timing(abil.getName()).startTiming()) {
abil.progress();
}
Bukkit.getServer().getPluginManager().callEvent(new AbilityProgressEvent(abil));
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
Bukkit.getLogger().severe(abil.toString());
try {
abil.getPlayer().sendMessage(ChatColor.YELLOW + "[" + new SimpleDateFormat("dd-MM-yyyy HH:mm:ss").format(new Date()) + "] " + ChatColor.RED + "There was an error running " + abil.getName() + ". please notify the server owner describing exactly what you were doing at this moment");
- }
- catch (final Exception me) {
+ } catch (final Exception me) {
Bukkit.getLogger().severe("unable to notify ability user of error");
}
try {
abil.remove();
- }
- catch (final Exception re) {
+ } catch (final Exception re) {
Bukkit.getLogger().severe("unable to fully remove ability of above error");
}
}
@@ -575,16 +592,13 @@ public abstract class CoreAbility implements Ability {
final AddonAbility addon = (AddonAbility) ability;
addon.load();
}
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
- }
- catch (final Error e) {
+ } catch (final Error e) {
e.printStackTrace();
}
}
- }
- catch (final IOException e) {
+ } catch (final IOException e) {
e.printStackTrace();
}
}
@@ -640,13 +654,12 @@ public abstract class CoreAbility implements Ability {
if (coreAbil instanceof PassiveAbility) {
coreAbil.setHiddenAbility(true);
PassiveManager.getPassives().put(name, coreAbil);
- if (!PassiveManager.getPassiveClasses().containsKey((PassiveAbility) coreAbil)) {
+ if (!PassiveManager.getPassiveClasses().containsKey(coreAbil)) {
PassiveManager.getPassiveClasses().put((PassiveAbility) coreAbil, coreAbil.getClass());
}
PassiveManager.getPassiveClasses().put((PassiveAbility) coreAbil, coreAbil.getClass());
}
- }
- catch (Exception | Error e) {
+ } catch (Exception | Error e) {
plugin.getLogger().warning("The ability " + coreAbil.getName() + " was not able to load, if this message shows again please remove it!");
e.printStackTrace();
ABILITIES_BY_NAME.remove(name.toLowerCase());
@@ -709,12 +722,11 @@ public abstract class CoreAbility implements Ability {
if (coreAbil instanceof PassiveAbility) {
coreAbil.setHiddenAbility(true);
PassiveManager.getPassives().put(name, coreAbil);
- if (!PassiveManager.getPassiveClasses().containsKey((PassiveAbility) coreAbil)) {
+ if (!PassiveManager.getPassiveClasses().containsKey(coreAbil)) {
PassiveManager.getPassiveClasses().put((PassiveAbility) coreAbil, coreAbil.getClass());
}
}
- }
- catch (Exception | Error e) {
+ } catch (Exception | Error e) {
plugin.getLogger().warning("The ability " + coreAbil.getName() + " was not able to load, if this message shows again please remove it!");
e.printStackTrace();
addon.stop();
@@ -816,16 +828,16 @@ public abstract class CoreAbility implements Ability {
}
public String getMovePreview(final Player player) {
- BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
+ final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
String displayedMessage = "";
if (bPlayer.isOnCooldown(this)) {
- final long cooldown = bPlayer.getCooldown(getName()) - System.currentTimeMillis();
- displayedMessage = getElement().getColor() + "" + ChatColor.STRIKETHROUGH + getName() + "" + getElement().getColor() + " - " + TimeUtil.formatTime(cooldown);
+ final long cooldown = bPlayer.getCooldown(this.getName()) - System.currentTimeMillis();
+ displayedMessage = this.getElement().getColor() + "" + ChatColor.STRIKETHROUGH + this.getName() + "" + this.getElement().getColor() + " - " + TimeUtil.formatTime(cooldown);
} else {
- if (bPlayer.getStance() != null && bPlayer.getStance().getName().equals(getName())) {
- displayedMessage = getElement().getColor() + "" + ChatColor.UNDERLINE + getName();
+ if (bPlayer.getStance() != null && bPlayer.getStance().getName().equals(this.getName())) {
+ displayedMessage = this.getElement().getColor() + "" + ChatColor.UNDERLINE + this.getName();
} else {
- displayedMessage = getElement().getColor() + getName();
+ displayedMessage = this.getElement().getColor() + this.getName();
}
}
return displayedMessage;
@@ -956,70 +968,66 @@ public abstract class CoreAbility implements Ability {
return locations;
}
- public CoreAbility addAttributeModifier(String attribute, Number value, AttributeModifier modification) {
- return addAttributeModifier(attribute, value, modification, AttributePriority.MEDIUM);
+ public CoreAbility addAttributeModifier(final String attribute, final Number value, final AttributeModifier modification) {
+ return this.addAttributeModifier(attribute, value, modification, AttributePriority.MEDIUM);
}
- public CoreAbility addAttributeModifier(String attribute, Number value, AttributeModifier modificationType, AttributePriority priority) {
+ public CoreAbility addAttributeModifier(final String attribute, final Number value, final AttributeModifier modificationType, final AttributePriority priority) {
Validate.notNull(attribute, "attribute cannot be null");
Validate.notNull(value, "value cannot be null");
Validate.notNull(modificationType, "modifierMethod cannot be null");
Validate.notNull(priority, "priority cannot be null");
- Validate.isTrue(ATTRIBUTE_FIELDS.containsKey(getClass()) && ATTRIBUTE_FIELDS.get(getClass()).containsKey(attribute), "Attribute " + attribute + " is not a defined Attribute for " + getName());
- if (!attributeModifiers.containsKey(attribute)) {
- attributeModifiers.put(attribute, new HashMap<>());
+ Validate.isTrue(ATTRIBUTE_FIELDS.containsKey(this.getClass()) && ATTRIBUTE_FIELDS.get(this.getClass()).containsKey(attribute), "Attribute " + attribute + " is not a defined Attribute for " + this.getName());
+ if (!this.attributeModifiers.containsKey(attribute)) {
+ this.attributeModifiers.put(attribute, new HashMap<>());
}
- if (!attributeModifiers.get(attribute).containsKey(priority)) {
- attributeModifiers.get(attribute).put(priority, new HashSet<>());
+ if (!this.attributeModifiers.get(attribute).containsKey(priority)) {
+ this.attributeModifiers.get(attribute).put(priority, new HashSet<>());
}
- attributeModifiers.get(attribute).get(priority).add(Pair.of(value, modificationType));
+ this.attributeModifiers.get(attribute).get(priority).add(Pair.of(value, modificationType));
return this;
}
- public CoreAbility setAttribute(String attribute, Object value) {
+ public CoreAbility setAttribute(final String attribute, final Object value) {
Validate.notNull(attribute, "attribute cannot be null");
Validate.notNull(value, "value cannot be null");
- Validate.isTrue(ATTRIBUTE_FIELDS.containsKey(getClass()) && ATTRIBUTE_FIELDS.get(getClass()).containsKey(attribute), "Attribute " + attribute + " is not a defined Attribute for " + getName());
- attributeValues.put(attribute, value);
+ Validate.isTrue(ATTRIBUTE_FIELDS.containsKey(this.getClass()) && ATTRIBUTE_FIELDS.get(this.getClass()).containsKey(attribute), "Attribute " + attribute + " is not a defined Attribute for " + this.getName());
+ this.attributeValues.put(attribute, value);
return this;
}
private void modifyAttributes() {
- for (String attribute : attributeModifiers.keySet()) {
- Field field = ATTRIBUTE_FIELDS.get(getClass()).get(attribute);
- boolean accessibility = field.isAccessible();
+ for (final String attribute : this.attributeModifiers.keySet()) {
+ final Field field = ATTRIBUTE_FIELDS.get(this.getClass()).get(attribute);
+ final boolean accessibility = field.isAccessible();
field.setAccessible(true);
try {
- for (AttributePriority priority : AttributePriority.values()) {
- if (attributeModifiers.get(attribute).containsKey(priority)) {
- for (Pair pair : attributeModifiers.get(attribute).get(priority)) {
- Object get = field.get(this);
+ for (final AttributePriority priority : AttributePriority.values()) {
+ if (this.attributeModifiers.get(attribute).containsKey(priority)) {
+ for (final Pair pair : this.attributeModifiers.get(attribute).get(priority)) {
+ final Object get = field.get(this);
Validate.isTrue(get instanceof Number, "The field " + field.getName() + " cannot algebraically be modified.");
- Number oldValue = (Number) field.get(this);
- Number newValue = pair.getRight().performModification(oldValue, pair.getLeft());
+ final Number oldValue = (Number) field.get(this);
+ final Number newValue = pair.getRight().performModification(oldValue, pair.getLeft());
field.set(this, newValue);
}
}
}
- }
- catch (IllegalArgumentException | IllegalAccessException e) {
+ } catch (IllegalArgumentException | IllegalAccessException e) {
e.printStackTrace();
- }
- finally {
+ } finally {
field.setAccessible(accessibility);
}
}
- attributeValues.forEach((attribute, value) -> {
- Field field = ATTRIBUTE_FIELDS.get(getClass()).get(attribute);
- boolean accessibility = field.isAccessible();
+ this.attributeValues.forEach((attribute, value) -> {
+ final Field field = ATTRIBUTE_FIELDS.get(this.getClass()).get(attribute);
+ final boolean accessibility = field.isAccessible();
field.setAccessible(true);
try {
field.set(this, value);
- }
- catch (IllegalArgumentException | IllegalAccessException e) {
+ } catch (IllegalArgumentException | IllegalAccessException e) {
e.printStackTrace();
- }
- finally {
+ } finally {
field.setAccessible(accessibility);
}
});
@@ -1087,8 +1095,7 @@ public abstract class CoreAbility implements Ability {
}
@Override
- public String toString()
- {
+ public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
diff --git a/src/com/projectkorra/projectkorra/ability/EarthAbility.java b/src/com/projectkorra/projectkorra/ability/EarthAbility.java
index ccf4d66b..890102ae 100644
--- a/src/com/projectkorra/projectkorra/ability/EarthAbility.java
+++ b/src/com/projectkorra/projectkorra/ability/EarthAbility.java
@@ -1,19 +1,10 @@
package com.projectkorra.projectkorra.ability;
-import com.projectkorra.projectkorra.BendingPlayer;
-import com.projectkorra.projectkorra.Element;
-import com.projectkorra.projectkorra.GeneralMethods;
-import com.projectkorra.projectkorra.ProjectKorra;
-import com.projectkorra.projectkorra.ability.util.Collision;
-import com.projectkorra.projectkorra.configuration.ConfigManager;
-import com.projectkorra.projectkorra.earthbending.RaiseEarth;
-import com.projectkorra.projectkorra.earthbending.lava.LavaFlow;
-import com.projectkorra.projectkorra.earthbending.passive.DensityShift;
-import com.projectkorra.projectkorra.firebending.Illumination;
-import com.projectkorra.projectkorra.util.BlockSource;
-import com.projectkorra.projectkorra.util.Information;
-import com.projectkorra.projectkorra.util.ParticleEffect;
-import com.projectkorra.projectkorra.util.TempBlock;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -28,10 +19,19 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
+import com.projectkorra.projectkorra.BendingPlayer;
+import com.projectkorra.projectkorra.Element;
+import com.projectkorra.projectkorra.GeneralMethods;
+import com.projectkorra.projectkorra.ProjectKorra;
+import com.projectkorra.projectkorra.ability.util.Collision;
+import com.projectkorra.projectkorra.configuration.ConfigManager;
+import com.projectkorra.projectkorra.earthbending.RaiseEarth;
+import com.projectkorra.projectkorra.earthbending.lava.LavaFlow;
+import com.projectkorra.projectkorra.earthbending.passive.DensityShift;
+import com.projectkorra.projectkorra.util.BlockSource;
+import com.projectkorra.projectkorra.util.Information;
+import com.projectkorra.projectkorra.util.ParticleEffect;
+import com.projectkorra.projectkorra.util.TempBlock;
public abstract class EarthAbility extends ElementalAbility {
@@ -157,7 +157,7 @@ public abstract class EarthAbility extends ElementalAbility {
if (TempBlock.isTempBlock(affectedblock)) {
TempBlock.get(affectedblock).revertBlock();
}
- if (LavaFlow.isLavaFlowBlock(block)){
+ if (LavaFlow.isLavaFlowBlock(block)) {
LavaFlow.removeBlock(block);
}
@@ -186,7 +186,7 @@ public abstract class EarthAbility extends ElementalAbility {
final Block topblock = affectedblock.getRelative(BlockFace.UP);
if (!isAir(topblock.getType())) {
GeneralMethods.breakBlock(affectedblock);
- } else if (!affectedblock.isLiquid() && !isAir(affectedblock.getType())){
+ } else if (!affectedblock.isLiquid() && !isAir(affectedblock.getType())) {
moveEarthBlock(affectedblock, topblock);
}
} else {
@@ -277,10 +277,10 @@ public abstract class EarthAbility extends ElementalAbility {
if (amount <= 0) {
return;
}
-
- Material sand = red ? Material.RED_SAND : Material.SAND;
- Material stone = red ? Material.RED_SANDSTONE : Material.SANDSTONE;
-
+
+ final Material sand = red ? Material.RED_SAND : Material.SAND;
+ final Material stone = red ? Material.RED_SANDSTONE : Material.SANDSTONE;
+
ParticleEffect.BLOCK_CRACK.display(loc, amount, xOffset, yOffset, zOffset, speed, sand.createBlockData());
ParticleEffect.BLOCK_CRACK.display(loc, amount, xOffset, yOffset, zOffset, speed, stone.createBlockData());
}
@@ -480,11 +480,9 @@ public abstract class EarthAbility extends ElementalAbility {
try {
sound = Sound.valueOf(getConfig().getString("Properties.Earth.EarthSound.Sound"));
- }
- catch (final IllegalArgumentException exception) {
+ } catch (final IllegalArgumentException exception) {
ProjectKorra.log.warning("Your current value for 'Properties.Earth.EarthSound.Sound' is not valid.");
- }
- finally {
+ } finally {
loc.getWorld().playSound(loc, sound, volume, pitch);
}
}
@@ -499,11 +497,9 @@ public abstract class EarthAbility extends ElementalAbility {
try {
sound = Sound.valueOf(getConfig().getString("Properties.Earth.MetalSound.Sound"));
- }
- catch (final IllegalArgumentException exception) {
+ } catch (final IllegalArgumentException exception) {
ProjectKorra.log.warning("Your current value for 'Properties.Earth.MetalSound.Sound' is not valid.");
- }
- finally {
+ } finally {
loc.getWorld().playSound(loc, sound, volume, pitch);
}
}
@@ -518,11 +514,9 @@ public abstract class EarthAbility extends ElementalAbility {
try {
sound = Sound.valueOf(getConfig().getString("Properties.Earth.SandSound.Sound"));
- }
- catch (final IllegalArgumentException exception) {
+ } catch (final IllegalArgumentException exception) {
ProjectKorra.log.warning("Your current value for 'Properties.Earth.SandSound.Sound' is not valid.");
- }
- finally {
+ } finally {
loc.getWorld().playSound(loc, sound, volume, pitch);
}
}
@@ -537,11 +531,9 @@ public abstract class EarthAbility extends ElementalAbility {
try {
sound = Sound.valueOf(getConfig().getString("Properties.Earth.LavaSound.Sound"));
- }
- catch (final IllegalArgumentException exception) {
+ } catch (final IllegalArgumentException exception) {
ProjectKorra.log.warning("Your current value for 'Properties.Earth.LavaSound.Sound' is not valid.");
- }
- finally {
+ } finally {
loc.getWorld().playSound(loc, sound, volume, pitch);
}
}
@@ -634,7 +626,7 @@ public abstract class EarthAbility extends ElementalAbility {
}
if (GeneralMethods.isAdjacentToThreeOrMoreSources(block, false)) {
- BlockData data = Material.WATER.createBlockData();
+ final BlockData data = Material.WATER.createBlockData();
if (data instanceof Levelled) {
((Levelled) data).setLevel(7);
}
diff --git a/src/com/projectkorra/projectkorra/ability/ElementalAbility.java b/src/com/projectkorra/projectkorra/ability/ElementalAbility.java
index 500fcdd2..b5146f40 100644
--- a/src/com/projectkorra/projectkorra/ability/ElementalAbility.java
+++ b/src/com/projectkorra/projectkorra/ability/ElementalAbility.java
@@ -11,8 +11,6 @@ import org.bukkit.World.Environment;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Waterlogged;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType;
@@ -28,16 +26,16 @@ public abstract class ElementalAbility extends CoreAbility {
private static final PotionEffectType[] NEUTRAL_EFFECTS = { PotionEffectType.INVISIBILITY };
private static final PotionEffectType[] NEGATIVE_EFFECTS = { PotionEffectType.POISON, PotionEffectType.BLINDNESS, PotionEffectType.CONFUSION, PotionEffectType.HARM, PotionEffectType.HUNGER, PotionEffectType.SLOW, PotionEffectType.SLOW_DIGGING, PotionEffectType.WEAKNESS, PotionEffectType.WITHER };
private static final Set TRANSPARENT = new HashSet<>();
-
+
static {
TRANSPARENT.clear();
- for (Material mat : Material.values()) {
+ for (final Material mat : Material.values()) {
if (GeneralMethods.isTransparent(mat)) {
TRANSPARENT.add(mat);
}
}
}
-
+
public ElementalAbility(final Player player) {
super(player);
}
@@ -57,7 +55,7 @@ public abstract class ElementalAbility extends CoreAbility {
public static HashSet getTransparentMaterialSet() {
return new HashSet<>(TRANSPARENT);
}
-
+
public static boolean isAir(final Material material) {
return material == Material.AIR || material == Material.CAVE_AIR || material == Material.VOID_AIR;
}
@@ -209,13 +207,13 @@ public abstract class ElementalAbility extends CoreAbility {
public static boolean isWater(final Block block) {
if (block == null) {
return false;
- } else if(isWater(block.getType())) {
+ } else if (isWater(block.getType())) {
return true;
} else {
return isWater(block.getBlockData());
}
}
-
+
public static boolean isWater(final BlockData data) {
return (data instanceof Waterlogged) ? ((Waterlogged) data).isWaterlogged() : isWater(data.getMaterial());
}
diff --git a/src/com/projectkorra/projectkorra/ability/FireAbility.java b/src/com/projectkorra/projectkorra/ability/FireAbility.java
index 5a6d76f5..6b5f1ab4 100644
--- a/src/com/projectkorra/projectkorra/ability/FireAbility.java
+++ b/src/com/projectkorra/projectkorra/ability/FireAbility.java
@@ -1,5 +1,21 @@
package com.projectkorra.projectkorra.ability;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.bukkit.ChatColor;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.World;
+import org.bukkit.block.Block;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.ItemStack;
+
import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ProjectKorra;
@@ -8,18 +24,11 @@ import com.projectkorra.projectkorra.configuration.ConfigManager;
import com.projectkorra.projectkorra.firebending.BlazeArc;
import com.projectkorra.projectkorra.util.Information;
import com.projectkorra.projectkorra.util.ParticleEffect;
-import org.bukkit.*;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
public abstract class FireAbility extends ElementalAbility {
private static final Map TEMP_FIRE = new ConcurrentHashMap();
-
+
public FireAbility(final Player player) {
super(player);
}
@@ -77,7 +86,7 @@ public abstract class FireAbility extends ElementalAbility {
loc.getBlock().setType(Material.FIRE);
TEMP_FIRE.put(loc, info);
}
-
+
public double getDayFactor(final double value) {
return this.player != null ? value * getDayFactor() : 1;
}
@@ -141,11 +150,9 @@ public abstract class FireAbility extends ElementalAbility {
try {
sound = Sound.valueOf(getConfig().getString("Properties.Fire.CombustionSound.Sound"));
- }
- catch (final IllegalArgumentException exception) {
+ } catch (final IllegalArgumentException exception) {
ProjectKorra.log.warning("Your current value for 'Properties.Fire.CombustionSound.Sound' is not valid.");
- }
- finally {
+ } finally {
loc.getWorld().playSound(loc, sound, volume, pitch);
}
}
@@ -164,11 +171,9 @@ public abstract class FireAbility extends ElementalAbility {
try {
sound = Sound.valueOf(getConfig().getString("Properties.Fire.FireSound.Sound"));
- }
- catch (final IllegalArgumentException exception) {
+ } catch (final IllegalArgumentException exception) {
ProjectKorra.log.warning("Your current value for 'Properties.Fire.FireSound.Sound' is not valid.");
- }
- finally {
+ } finally {
loc.getWorld().playSound(loc, sound, volume, pitch);
}
}
@@ -191,11 +196,9 @@ public abstract class FireAbility extends ElementalAbility {
try {
sound = Sound.valueOf(getConfig().getString("Properties.Fire.LightningSound.Sound"));
- }
- catch (final IllegalArgumentException exception) {
+ } catch (final IllegalArgumentException exception) {
ProjectKorra.log.warning("Your current value for 'Properties.Fire.LightningSound.Sound' is not valid.");
- }
- finally {
+ } finally {
loc.getWorld().playSound(loc, sound, volume, pitch);
}
}
diff --git a/src/com/projectkorra/projectkorra/ability/PassiveAbility.java b/src/com/projectkorra/projectkorra/ability/PassiveAbility.java
index 93ee299d..f664f5e5 100644
--- a/src/com/projectkorra/projectkorra/ability/PassiveAbility.java
+++ b/src/com/projectkorra/projectkorra/ability/PassiveAbility.java
@@ -6,14 +6,14 @@ public interface PassiveAbility {
* This is a check to see if the passive requires some form of activation,
* such as sneaking, clicking, etc.
* If false, the passive should not call start!
- *
+ *
* @return false if this passive should always be on
*/
public boolean isInstantiable();
/**
* This is used if the passive should progress
- *
+ *
* @return false if progress() shouldn't be called;
*/
public boolean isProgressable();
diff --git a/src/com/projectkorra/projectkorra/ability/WaterAbility.java b/src/com/projectkorra/projectkorra/ability/WaterAbility.java
index b2fb938f..da332392 100644
--- a/src/com/projectkorra/projectkorra/ability/WaterAbility.java
+++ b/src/com/projectkorra/projectkorra/ability/WaterAbility.java
@@ -1,5 +1,19 @@
package com.projectkorra.projectkorra.ability;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.Tag;
+import org.bukkit.World;
+import org.bukkit.block.Block;
+import org.bukkit.block.BlockFace;
+import org.bukkit.block.data.Levelled;
+import org.bukkit.entity.Player;
+import org.bukkit.util.Vector;
+
import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.GeneralMethods;
@@ -15,15 +29,6 @@ import com.projectkorra.projectkorra.waterbending.Torrent;
import com.projectkorra.projectkorra.waterbending.WaterSpout;
import com.projectkorra.projectkorra.waterbending.ice.PhaseChange;
import com.projectkorra.projectkorra.waterbending.multiabilities.WaterArms;
-import org.bukkit.*;
-import org.bukkit.block.Block;
-import org.bukkit.block.BlockFace;
-import org.bukkit.block.data.Levelled;
-import org.bukkit.entity.Player;
-import org.bukkit.util.Vector;
-
-import java.util.HashSet;
-import java.util.Set;
public abstract class WaterAbility extends ElementalAbility {
@@ -73,7 +78,7 @@ public abstract class WaterAbility extends ElementalAbility {
ParticleEffect.BLOCK_CRACK.display(collision.getLocationFirst(), 10, 1, 1, 1, 0.1, collision.getLocationFirst().getBlock().getBlockData());
}
}
-
+
public double getNightFactor(final double value) {
return this.player != null ? value * getNightFactor() : 1;
}
@@ -143,7 +148,7 @@ public abstract class WaterAbility extends ElementalAbility {
}
return null;
}
-
+
public static double getNightFactor() {
return getConfig().getDouble("Properties.Water.NightFactor");
}
@@ -152,7 +157,7 @@ public abstract class WaterAbility extends ElementalAbility {
if (isNight(world)) {
return value * getNightFactor();
}
-
+
return value;
}
@@ -194,19 +199,19 @@ public abstract class WaterAbility extends ElementalAbility {
final Vector vector = location.getDirection().clone().normalize();
final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
- Set trans = getTransparentMaterialSet();
-
+ final Set trans = getTransparentMaterialSet();
+
if (plantbending) {
- Set remove = new HashSet<>();
- for (Material m : trans) {
+ final Set remove = new HashSet<>();
+ for (final Material m : trans) {
if (isPlant(m)) {
remove.add(m);
}
}
-
+
trans.removeAll(remove);
}
-
+
final Block testBlock = player.getTargetBlock(trans, range > 3 ? 3 : (int) range);
if (bPlayer == null) {
return null;
@@ -276,7 +281,7 @@ public abstract class WaterAbility extends ElementalAbility {
}
if (TempBlock.isTempBlock(block) && !isBendableWaterTempBlock(block)) {
return false;
- } else if (isWater(block) && block.getBlockData() instanceof Levelled && ((Levelled)block.getBlockData()).getLevel() == 0) {
+ } else if (isWater(block) && block.getBlockData() instanceof Levelled && ((Levelled) block.getBlockData()).getLevel() == 0) {
return true;
} else if (isIce(block) && !bPlayer.canIcebend()) {
return false;
@@ -299,11 +304,9 @@ public abstract class WaterAbility extends ElementalAbility {
try {
sound = Sound.valueOf(getConfig().getString("Properties.Water.IceSound.Sound"));
- }
- catch (final IllegalArgumentException exception) {
+ } catch (final IllegalArgumentException exception) {
ProjectKorra.log.warning("Your current value for 'Properties.Water.IceSound.Sound' is not valid.");
- }
- finally {
+ } finally {
loc.getWorld().playSound(loc, sound, volume, pitch);
}
}
@@ -318,11 +321,9 @@ public abstract class WaterAbility extends ElementalAbility {
try {
sound = Sound.valueOf(getConfig().getString("Properties.Water.PlantSound.Sound"));
- }
- catch (final IllegalArgumentException exception) {
+ } catch (final IllegalArgumentException exception) {
ProjectKorra.log.warning("Your current value for 'Properties.Water.PlantSound.Sound' is not valid.");
- }
- finally {
+ } finally {
loc.getWorld().playSound(loc, sound, volume, pitch);
}
}
@@ -337,11 +338,9 @@ public abstract class WaterAbility extends ElementalAbility {
try {
sound = Sound.valueOf(getConfig().getString("Properties.Water.WaterSound.Sound"));
- }
- catch (final IllegalArgumentException exception) {
+ } catch (final IllegalArgumentException exception) {
ProjectKorra.log.warning("Your current value for 'Properties.Water.WaterSound.Sound' is not valid.");
- }
- finally {
+ } finally {
loc.getWorld().playSound(loc, sound, volume, pitch);
}
}
diff --git a/src/com/projectkorra/projectkorra/ability/util/AbilityLoader.java b/src/com/projectkorra/projectkorra/ability/util/AbilityLoader.java
index cea08e7d..c3752719 100644
--- a/src/com/projectkorra/projectkorra/ability/util/AbilityLoader.java
+++ b/src/com/projectkorra/projectkorra/ability/util/AbilityLoader.java
@@ -12,14 +12,14 @@ import java.util.List;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
+import sun.reflect.ReflectionFactory;
+
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.event.AbilityLoadEvent;
-import sun.reflect.ReflectionFactory;
-
public class AbilityLoader {
private final Plugin plugin;
@@ -47,8 +47,7 @@ public class AbilityLoader {
this.jar = new JarFile(new File(s));
- }
- catch (final IOException e) {
+ } catch (final IOException e) {
e.printStackTrace();
}
}
@@ -102,8 +101,7 @@ public class AbilityLoader {
loadables.add(loadable);
final AbilityLoadEvent event = new AbilityLoadEvent(this.plugin, loadable, this.jar);
this.plugin.getServer().getPluginManager().callEvent(event);
- }
- catch (Exception | Error e) {
+ } catch (Exception | Error e) {
continue;
}
}
diff --git a/src/com/projectkorra/projectkorra/ability/util/AddonAbilityLoader.java b/src/com/projectkorra/projectkorra/ability/util/AddonAbilityLoader.java
index cf787f3a..795b1b66 100644
--- a/src/com/projectkorra/projectkorra/ability/util/AddonAbilityLoader.java
+++ b/src/com/projectkorra/projectkorra/ability/util/AddonAbilityLoader.java
@@ -14,13 +14,13 @@ import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.logging.Level;
+import sun.reflect.ReflectionFactory;
+
import org.bukkit.plugin.Plugin;
import com.projectkorra.projectkorra.event.AbilityLoadEvent;
import com.projectkorra.projectkorra.util.FileExtensionFilter;
-import sun.reflect.ReflectionFactory;
-
public class AddonAbilityLoader {
private final Plugin plugin;
@@ -45,8 +45,7 @@ public class AddonAbilityLoader {
for (final File file : this.files) {
try {
urls.add(file.toURI().toURL());
- }
- catch (final MalformedURLException e) {
+ } catch (final MalformedURLException e) {
e.printStackTrace();
}
}
@@ -79,8 +78,7 @@ public class AddonAbilityLoader {
Class> clazz = null;
try {
clazz = Class.forName(className, true, this.loader);
- }
- catch (Exception | Error e) {
+ } catch (Exception | Error e) {
continue;
}
@@ -98,18 +96,15 @@ public class AddonAbilityLoader {
this.plugin.getServer().getPluginManager().callEvent(event);
}
- }
- catch (Exception | Error e) {
+ } catch (Exception | Error e) {
e.printStackTrace();
this.plugin.getLogger().log(Level.WARNING, "Unknown cause");
this.plugin.getLogger().log(Level.WARNING, "The JAR file " + file.getName() + " failed to load");
- }
- finally {
+ } finally {
if (jarFile != null) {
try {
jarFile.close();
- }
- catch (final IOException e) {
+ } catch (final IOException e) {
e.printStackTrace();
}
}
diff --git a/src/com/projectkorra/projectkorra/ability/util/ComboManager.java b/src/com/projectkorra/projectkorra/ability/util/ComboManager.java
index cbf3a49c..94ce54ff 100644
--- a/src/com/projectkorra/projectkorra/ability/util/ComboManager.java
+++ b/src/com/projectkorra/projectkorra/ability/util/ComboManager.java
@@ -71,8 +71,7 @@ public class ComboManager {
final Class> clazz = (Class>) comboAbil.getComboType();
try {
ReflectionHandler.instantiateObject(clazz, player);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
}
} else {
diff --git a/src/com/projectkorra/projectkorra/ability/util/PassiveManager.java b/src/com/projectkorra/projectkorra/ability/util/PassiveManager.java
index 84c2f869..e8fc5dad 100644
--- a/src/com/projectkorra/projectkorra/ability/util/PassiveManager.java
+++ b/src/com/projectkorra/projectkorra/ability/util/PassiveManager.java
@@ -44,12 +44,11 @@ public class PassiveManager {
}
try {
- final Class extends CoreAbility> clazz = PASSIVE_CLASSES.get((PassiveAbility) ability);
+ final Class extends CoreAbility> clazz = PASSIVE_CLASSES.get(ability);
final Constructor> constructor = clazz.getConstructor(Player.class);
final Object object = constructor.newInstance(player);
((CoreAbility) object).start();
- }
- catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
+ } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
e.printStackTrace();
}
}
diff --git a/src/com/projectkorra/projectkorra/airbending/AirBlast.java b/src/com/projectkorra/projectkorra/airbending/AirBlast.java
index 4b7829c1..c31ed585 100644
--- a/src/com/projectkorra/projectkorra/airbending/AirBlast.java
+++ b/src/com/projectkorra/projectkorra/airbending/AirBlast.java
@@ -1,16 +1,11 @@
package com.projectkorra.projectkorra.airbending;
-import com.projectkorra.projectkorra.BendingPlayer;
-import com.projectkorra.projectkorra.GeneralMethods;
-import com.projectkorra.projectkorra.ProjectKorra;
-import com.projectkorra.projectkorra.ability.AirAbility;
-import com.projectkorra.projectkorra.ability.util.Collision;
-import com.projectkorra.projectkorra.attribute.Attribute;
-import com.projectkorra.projectkorra.command.Commands;
-import com.projectkorra.projectkorra.earthbending.lava.LavaFlow;
-import com.projectkorra.projectkorra.object.HorizontalVelocityTracker;
-import com.projectkorra.projectkorra.util.DamageHandler;
-import com.projectkorra.projectkorra.util.TempBlock;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Map;
+import java.util.Random;
+import java.util.concurrent.ConcurrentHashMap;
+
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -27,11 +22,17 @@ import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Map;
-import java.util.Random;
-import java.util.concurrent.ConcurrentHashMap;
+import com.projectkorra.projectkorra.BendingPlayer;
+import com.projectkorra.projectkorra.GeneralMethods;
+import com.projectkorra.projectkorra.ProjectKorra;
+import com.projectkorra.projectkorra.ability.AirAbility;
+import com.projectkorra.projectkorra.ability.util.Collision;
+import com.projectkorra.projectkorra.attribute.Attribute;
+import com.projectkorra.projectkorra.command.Commands;
+import com.projectkorra.projectkorra.earthbending.lava.LavaFlow;
+import com.projectkorra.projectkorra.object.HorizontalVelocityTracker;
+import com.projectkorra.projectkorra.util.DamageHandler;
+import com.projectkorra.projectkorra.util.TempBlock;
public class AirBlast extends AirAbility {
@@ -297,8 +298,8 @@ public class AirBlast extends AirAbility {
return;
}
- Block block = this.location.getBlock();
-
+ final Block block = this.location.getBlock();
+
for (final Block testblock : GeneralMethods.getBlocksAroundPoint(this.location, this.radius)) {
if (testblock.getType() == Material.FIRE) {
testblock.setType(Material.AIR);
@@ -306,23 +307,23 @@ public class AirBlast extends AirAbility {
continue;
} else if (GeneralMethods.isRegionProtectedFromBuild(this, block.getLocation())) {
continue;
- } else if (affectedLevers.contains(testblock)) {
+ } else if (this.affectedLevers.contains(testblock)) {
continue;
}
-
+
if (Arrays.asList(DOORS).contains(testblock.getType())) {
if (testblock.getBlockData() instanceof Door) {
- Door door = (Door) testblock.getBlockData();
- BlockFace face = door.getFacing();
- Vector toPlayer = GeneralMethods.getDirection(block.getLocation(), this.player.getLocation().getBlock().getLocation());
- double[] dims = { toPlayer.getX(), toPlayer.getY(), toPlayer.getZ() };
+ final Door door = (Door) testblock.getBlockData();
+ final BlockFace face = door.getFacing();
+ final Vector toPlayer = GeneralMethods.getDirection(block.getLocation(), this.player.getLocation().getBlock().getLocation());
+ final double[] dims = { toPlayer.getX(), toPlayer.getY(), toPlayer.getZ() };
for (int i = 0; i < 3; i++) {
if (i == 1) {
continue;
}
-
- BlockFace bf = GeneralMethods.getBlockFaceFromValue(i, dims[i]);
+
+ final BlockFace bf = GeneralMethods.getBlockFaceFromValue(i, dims[i]);
if (bf == face) {
if (!door.isOpen()) {
@@ -334,16 +335,16 @@ public class AirBlast extends AirAbility {
}
}
}
-
+
door.setOpen(!door.isOpen());
testblock.setBlockData(door);
testblock.getWorld().playSound(testblock.getLocation(), Sound.valueOf("BLOCK_WOODEN_DOOR_" + (door.isOpen() ? "OPEN" : "CLOSE")), 0.5f, 0);
- affectedLevers.add(testblock);
+ this.affectedLevers.add(testblock);
}
} else if (Arrays.asList(TDOORS).contains(testblock.getType())) {
if (testblock.getBlockData() instanceof TrapDoor) {
- TrapDoor tDoor = (TrapDoor) testblock.getBlockData();
-
+ final TrapDoor tDoor = (TrapDoor) testblock.getBlockData();
+
if (this.origin.getY() < block.getY()) {
if (!tDoor.isOpen()) {
return;
@@ -353,7 +354,7 @@ public class AirBlast extends AirAbility {
return;
}
}
-
+
tDoor.setOpen(!tDoor.isOpen());
testblock.setBlockData(tDoor);
testblock.getWorld().playSound(testblock.getLocation(), Sound.valueOf("BLOCK_WOODEN_TRAPDOOR_" + (tDoor.isOpen() ? "OPEN" : "CLOSE")), 0.5f, 0);
@@ -364,34 +365,34 @@ public class AirBlast extends AirAbility {
if (!button.isPowered()) {
button.setPowered(true);
testblock.setBlockData(button);
- affectedLevers.add(testblock);
-
+ this.affectedLevers.add(testblock);
+
new BukkitRunnable() {
@Override
public void run() {
button.setPowered(false);
testblock.setBlockData(button);
- affectedLevers.remove(testblock);
+ AirBlast.this.affectedLevers.remove(testblock);
testblock.getWorld().playSound(testblock.getLocation(), Sound.BLOCK_WOODEN_BUTTON_CLICK_OFF, 0.5f, 0);
}
-
+
}.runTaskLater(ProjectKorra.plugin, 15);
}
-
+
testblock.getWorld().playSound(testblock.getLocation(), Sound.BLOCK_WOODEN_BUTTON_CLICK_ON, 0.5f, 0);
}
} else if (testblock.getType() == Material.LEVER) {
if (testblock.getBlockData() instanceof Switch) {
- Switch lever = (Switch) testblock.getBlockData();
+ final Switch lever = (Switch) testblock.getBlockData();
lever.setPowered(!lever.isPowered());
testblock.setBlockData(lever);
- affectedLevers.add(testblock);
+ this.affectedLevers.add(testblock);
testblock.getWorld().playSound(testblock.getLocation(), Sound.BLOCK_LEVER_CLICK, 0.5f, 0);
}
}
}
-
+
if ((GeneralMethods.isSolid(block) || block.isLiquid()) && !this.affectedLevers.contains(block) && this.canCoolLava) {
if (block.getType() == Material.LAVA) {
if (LavaFlow.isLavaFlowBlock(block)) {
@@ -422,7 +423,7 @@ public class AirBlast extends AirAbility {
}
for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(this.location, this.radius)) {
- if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){
+ if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))) {
continue;
}
this.affect(entity);
diff --git a/src/com/projectkorra/projectkorra/airbending/AirScooter.java b/src/com/projectkorra/projectkorra/airbending/AirScooter.java
index 3c5064b8..d4059ab2 100644
--- a/src/com/projectkorra/projectkorra/airbending/AirScooter.java
+++ b/src/com/projectkorra/projectkorra/airbending/AirScooter.java
@@ -1,9 +1,8 @@
package com.projectkorra.projectkorra.airbending;
-import com.projectkorra.projectkorra.GeneralMethods;
-import com.projectkorra.projectkorra.ability.AirAbility;
-import com.projectkorra.projectkorra.ability.ElementalAbility;
-import com.projectkorra.projectkorra.attribute.Attribute;
+import java.util.ArrayList;
+import java.util.Random;
+
import org.bukkit.Difficulty;
import org.bukkit.Location;
import org.bukkit.block.Block;
@@ -15,8 +14,10 @@ import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
-import java.util.ArrayList;
-import java.util.Random;
+import com.projectkorra.projectkorra.GeneralMethods;
+import com.projectkorra.projectkorra.ability.AirAbility;
+import com.projectkorra.projectkorra.ability.ElementalAbility;
+import com.projectkorra.projectkorra.attribute.Attribute;
public class AirScooter extends AirAbility {
@@ -62,7 +63,7 @@ public class AirScooter extends AirAbility {
this.random = new Random();
this.angles = new ArrayList<>();
- flightHandler.createInstance(player, this.getName());
+ this.flightHandler.createInstance(player, this.getName());
player.setAllowFlight(true);
player.setFlying(true);
@@ -73,18 +74,18 @@ public class AirScooter extends AirAbility {
this.angles.add((double) (60 * i));
}
if (player.getWorld().getDifficulty() == Difficulty.PEACEFUL) {
- useslime = false;
+ this.useslime = false;
}
- if (useslime) {
- slime = (Slime) player.getWorld().spawnEntity(player.getLocation(), EntityType.SLIME);
- if (slime != null) {
- slime.setSize(1);
- slime.setSilent(true);
- slime.setInvulnerable(true);
- slime.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, true, false));
- slime.addPassenger(player);
+ if (this.useslime) {
+ this.slime = (Slime) player.getWorld().spawnEntity(player.getLocation(), EntityType.SLIME);
+ if (this.slime != null) {
+ this.slime.setSize(1);
+ this.slime.setSilent(true);
+ this.slime.setInvulnerable(true);
+ this.slime.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, true, false));
+ this.slime.addPassenger(player);
} else {
- useslime = false;
+ this.useslime = false;
}
}
@@ -143,7 +144,7 @@ public class AirScooter extends AirAbility {
return;
}
- if (useslime && (slime == null || !slime.getPassengers().contains(player))){
+ if (this.useslime && (this.slime == null || !this.slime.getPassengers().contains(this.player))) {
this.bPlayer.addCooldown(this);
this.remove();
return;
@@ -155,7 +156,7 @@ public class AirScooter extends AirAbility {
* checks the players speed and ends the move if they are going too slow
*/
if (System.currentTimeMillis() > this.getStartTime() + this.interval) {
- if (useslime) {
+ if (this.useslime) {
if (this.slime.getVelocity().length() < this.speed * 0.3) {
this.remove();
return;
@@ -173,7 +174,7 @@ public class AirScooter extends AirAbility {
* lowers the player based on their distance from the ground.
*/
final double distance = this.player.getLocation().getY() - this.floorblock.getY();
- final double dx = Math.abs(distance - 2.4);
+ Math.abs(distance - 2.4);
if (distance > 2.75) {
velocity.setY(-.25);
} else if (distance < 2) {
@@ -199,10 +200,10 @@ public class AirScooter extends AirAbility {
this.player.setSprinting(false);
this.player.removePotionEffect(PotionEffectType.SPEED);
- if (useslime) {
- slime.setVelocity(velocity);
+ if (this.useslime) {
+ this.slime.setVelocity(velocity);
} else {
- player.setVelocity(velocity);
+ this.player.setVelocity(velocity);
}
if (this.random.nextInt(4) == 0) {
@@ -216,10 +217,10 @@ public class AirScooter extends AirAbility {
@Override
public void remove() {
super.remove();
- if (slime != null) {
- slime.remove();
+ if (this.slime != null) {
+ this.slime.remove();
}
- flightHandler.removeInstance(this.player, this.getName());
+ this.flightHandler.removeInstance(this.player, this.getName());
this.bPlayer.addCooldown(this);
}
diff --git a/src/com/projectkorra/projectkorra/airbending/AirShield.java b/src/com/projectkorra/projectkorra/airbending/AirShield.java
index d0791638..80d2d69f 100644
--- a/src/com/projectkorra/projectkorra/airbending/AirShield.java
+++ b/src/com/projectkorra/projectkorra/airbending/AirShield.java
@@ -1,11 +1,9 @@
package com.projectkorra.projectkorra.airbending;
-import com.projectkorra.projectkorra.GeneralMethods;
-import com.projectkorra.projectkorra.ability.AirAbility;
-import com.projectkorra.projectkorra.ability.util.Collision;
-import com.projectkorra.projectkorra.attribute.Attribute;
-import com.projectkorra.projectkorra.avatar.AvatarState;
-import com.projectkorra.projectkorra.command.Commands;
+import java.util.HashMap;
+import java.util.Random;
+import java.util.Set;
+
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -14,9 +12,12 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
-import java.util.HashMap;
-import java.util.Random;
-import java.util.Set;
+import com.projectkorra.projectkorra.GeneralMethods;
+import com.projectkorra.projectkorra.ability.AirAbility;
+import com.projectkorra.projectkorra.ability.util.Collision;
+import com.projectkorra.projectkorra.attribute.Attribute;
+import com.projectkorra.projectkorra.avatar.AvatarState;
+import com.projectkorra.projectkorra.command.Commands;
public class AirShield extends AirAbility {
@@ -44,14 +45,14 @@ public class AirShield extends AirAbility {
this.maxRadius = getConfig().getDouble("Abilities.Air.AirShield.MaxRadius");
this.initialRadius = getConfig().getDouble("Abilities.Air.AirShield.InitialRadius");
this.isToggledByAvatarState = getConfig().getBoolean("Abilities.Avatar.AvatarState.Air.AirShield.IsAvatarStateToggle");
- this.radius = initialRadius;
+ this.radius = this.initialRadius;
this.cooldown = getConfig().getLong("Abilities.Air.AirShield.Cooldown");
this.duration = getConfig().getLong("Abilities.Air.AirShield.Duration");
this.speed = getConfig().getDouble("Abilities.Air.AirShield.Speed");
this.streams = getConfig().getInt("Abilities.Air.AirShield.Streams");
this.particles = getConfig().getInt("Abilities.Air.AirShield.Particles");
this.dynamicCooldown = getConfig().getBoolean("Abilities.Air.AirShield.DynamicCooldown"); //any unused duration from shield is removed from the cooldown
- if (duration == 0) {
+ if (this.duration == 0) {
this.dynamicCooldown = false;
}
this.random = new Random();
@@ -99,8 +100,8 @@ public class AirShield extends AirAbility {
return;
} else if (!this.bPlayer.isAvatarState() || !this.isToggledByAvatarState) {
if (!this.player.isSneaking() || !this.bPlayer.canBend(this)) {
- if (dynamicCooldown) {
- Long reducedCooldown = cooldown - (duration - (System.currentTimeMillis() - this.getStartTime()));
+ if (this.dynamicCooldown) {
+ Long reducedCooldown = this.cooldown - (this.duration - (System.currentTimeMillis() - this.getStartTime()));
if (reducedCooldown < 0L) {
reducedCooldown = 0L;
}
@@ -164,14 +165,14 @@ public class AirShield extends AirAbility {
entity.setFallDistance(0);
}
}
-
+
for (final Block testblock : GeneralMethods.getBlocksAroundPoint(this.player.getLocation(), this.radius)) {
if (testblock.getType() == Material.FIRE) {
testblock.setType(Material.AIR);
testblock.getWorld().playEffect(testblock.getLocation(), Effect.EXTINGUISH, 0);
}
}
-
+
final Set keys = this.angles.keySet();
for (final int i : keys) {
double x, y, z;
diff --git a/src/com/projectkorra/projectkorra/airbending/AirSpout.java b/src/com/projectkorra/projectkorra/airbending/AirSpout.java
index f86175a4..3e0e4ae4 100644
--- a/src/com/projectkorra/projectkorra/airbending/AirSpout.java
+++ b/src/com/projectkorra/projectkorra/airbending/AirSpout.java
@@ -1,18 +1,19 @@
package com.projectkorra.projectkorra.airbending;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+import org.bukkit.Location;
+import org.bukkit.block.Block;
+import org.bukkit.block.BlockFace;
+import org.bukkit.entity.Player;
+
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.AirAbility;
import com.projectkorra.projectkorra.ability.ElementalAbility;
import com.projectkorra.projectkorra.ability.util.Collision;
import com.projectkorra.projectkorra.attribute.Attribute;
-import org.bukkit.Location;
-import org.bukkit.block.Block;
-import org.bukkit.block.BlockFace;
-import org.bukkit.entity.Player;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
public class AirSpout extends AirAbility {
@@ -53,7 +54,7 @@ public class AirSpout extends AirAbility {
return;
}
- flightHandler.createInstance(player, this.getName());
+ this.flightHandler.createInstance(player, this.getName());
if (this.bPlayer.isAvatarState()) {
this.height = getConfig().getDouble("Abilities.Avatar.AvatarState.Air.AirSpout.Height");
@@ -176,7 +177,7 @@ public class AirSpout extends AirAbility {
@Override
public void remove() {
super.remove();
- flightHandler.removeInstance(this.player, this.getName());
+ this.flightHandler.removeInstance(this.player, this.getName());
}
private void rotateAirColumn(final Block block) {
diff --git a/src/com/projectkorra/projectkorra/airbending/AirSuction.java b/src/com/projectkorra/projectkorra/airbending/AirSuction.java
index c04a3905..8a494387 100644
--- a/src/com/projectkorra/projectkorra/airbending/AirSuction.java
+++ b/src/com/projectkorra/projectkorra/airbending/AirSuction.java
@@ -1,14 +1,10 @@
package com.projectkorra.projectkorra.airbending;
-import com.projectkorra.projectkorra.GeneralMethods;
-import com.projectkorra.projectkorra.ProjectKorra;
-import com.projectkorra.projectkorra.ability.AirAbility;
-import com.projectkorra.projectkorra.ability.CoreAbility;
-import com.projectkorra.projectkorra.ability.util.Collision;
-import com.projectkorra.projectkorra.attribute.Attribute;
-import com.projectkorra.projectkorra.command.Commands;
-import com.projectkorra.projectkorra.object.HorizontalVelocityTracker;
-import com.projectkorra.projectkorra.waterbending.WaterSpout;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -20,15 +16,20 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Random;
+import com.projectkorra.projectkorra.GeneralMethods;
+import com.projectkorra.projectkorra.ProjectKorra;
+import com.projectkorra.projectkorra.ability.AirAbility;
+import com.projectkorra.projectkorra.ability.CoreAbility;
+import com.projectkorra.projectkorra.ability.util.Collision;
+import com.projectkorra.projectkorra.attribute.Attribute;
+import com.projectkorra.projectkorra.command.Commands;
+import com.projectkorra.projectkorra.object.HorizontalVelocityTracker;
+import com.projectkorra.projectkorra.waterbending.WaterSpout;
public class AirSuction extends AirAbility {
private final List affectedDoors = new ArrayList<>();
-
+
private boolean progressing;
private int particleCount;
@Attribute(Attribute.COOLDOWN)
@@ -57,12 +58,12 @@ public class AirSuction extends AirAbility {
} else if (hasAbility(player, AirSpout.class) || hasAbility(player, WaterSpout.class)) {
return;
}
-
+
if (hasAbility(player, AirSuction.class)) {
- AirSuction suc = getAbility(player, AirSuction.class);
+ final AirSuction suc = getAbility(player, AirSuction.class);
if (!suc.isProgressing()) {
- Location loc = getTargetLocation();
-
+ final Location loc = this.getTargetLocation();
+
if (!GeneralMethods.isRegionProtectedFromBuild(player, this.getName(), loc)) {
suc.setOrigin(loc);
}
@@ -78,19 +79,19 @@ public class AirSuction extends AirAbility {
this.pushFactor = getConfig().getDouble("Abilities.Air.AirSuction.Push");
this.cooldown = getConfig().getLong("Abilities.Air.AirSuction.Cooldown");
this.random = new Random();
- this.origin = getTargetLocation();
+ this.origin = this.getTargetLocation();
this.canAffectSelf = true;
-
- if (GeneralMethods.isRegionProtectedFromBuild(player, this.getName(), origin)) {
+
+ if (GeneralMethods.isRegionProtectedFromBuild(player, this.getName(), this.origin)) {
return;
}
-
+
this.location = null;
-
+
if (this.bPlayer.isAvatarState()) {
this.pushFactor = getConfig().getDouble("Abilities.Avatar.AvatarState.Air.AirSuction.Push");
}
-
+
this.start();
}
@@ -112,16 +113,16 @@ public class AirSuction extends AirAbility {
boolean open = false;
if (Arrays.asList(AirBlast.DOORS).contains(block.getType())) {
- Door door = (Door) block.getBlockData();
- BlockFace face = door.getFacing();
- Vector toPlayer = GeneralMethods.getDirection(block.getLocation(), this.player.getLocation().getBlock().getLocation());
- double[] dims = { toPlayer.getX(), toPlayer.getY(), toPlayer.getZ() };
+ final Door door = (Door) block.getBlockData();
+ final BlockFace face = door.getFacing();
+ final Vector toPlayer = GeneralMethods.getDirection(block.getLocation(), this.player.getLocation().getBlock().getLocation());
+ final double[] dims = { toPlayer.getX(), toPlayer.getY(), toPlayer.getZ() };
for (int i = 0; i < 3; i++) {
if (i == 1) {
continue;
}
- BlockFace bf = GeneralMethods.getBlockFaceFromValue(i, dims[i]);
+ final BlockFace bf = GeneralMethods.getBlockFaceFromValue(i, dims[i]);
if (bf == face) {
if (!door.isOpen()) {
@@ -133,13 +134,13 @@ public class AirSuction extends AirAbility {
}
}
}
-
+
door.setOpen(!door.isOpen());
block.setBlockData(door);
open = door.isOpen();
} else {
tDoor = true;
- TrapDoor trap = (TrapDoor) block.getBlockData();
+ final TrapDoor trap = (TrapDoor) block.getBlockData();
if (this.origin.getY() < block.getY()) {
if (trap.isOpen()) {
@@ -150,7 +151,7 @@ public class AirSuction extends AirAbility {
return;
}
}
-
+
trap.setOpen(!trap.isOpen());
block.setBlockData(trap);
open = trap.isOpen();
@@ -163,24 +164,24 @@ public class AirSuction extends AirAbility {
private Location getTargetLocation() {
final Material[] ignore = new Material[getTransparentMaterials().length + AirBlast.DOORS.length + AirBlast.TDOORS.length];
-
+
for (int i = 0; i < ignore.length; i++) {
if (i < getTransparentMaterials().length) {
ignore[i] = getTransparentMaterials()[i];
- } else if (i < getTransparentMaterials().length + AirBlast.DOORS.length){
+ } else if (i < getTransparentMaterials().length + AirBlast.DOORS.length) {
ignore[i] = AirBlast.DOORS[i - getTransparentMaterials().length];
} else {
ignore[i] = AirBlast.TDOORS[i - getTransparentMaterials().length - AirBlast.DOORS.length];
}
}
-
- return GeneralMethods.getTargetedLocation(player, getSelectRange(), ignore);
+
+ return GeneralMethods.getTargetedLocation(this.player, getSelectRange(), ignore);
}
@Override
public void progress() {
if (this.player.isDead() || !this.player.isOnline()) {
- this.remove();
+ this.remove();
return;
}
@@ -192,88 +193,88 @@ public class AirSuction extends AirAbility {
this.remove();
return;
}
-
+
for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(this.location, this.radius)) {
- if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){
- continue;
- }
- if((entity.getEntityId() == player.getEntityId()) && !canAffectSelf){
- continue;
- }
- final Vector velocity = entity.getVelocity();
- final double max = this.speed;
- final Vector push = this.direction.clone();
- double factor = this.pushFactor;
-
- if (Math.abs(push.getY()) > max) {
- if (push.getY() < 0) {
- push.setY(-max);
- } else {
- push.setY(max);
- }
- }
-
- if (this.location.getWorld().equals(this.origin.getWorld())) {
- factor *= 1 - this.location.distance(this.origin) / (2 * this.range);
- }
-
- final double comp = velocity.dot(push.clone().normalize());
- if (comp > factor) {
- velocity.multiply(.5);
- velocity.add(push.clone().normalize().multiply(velocity.clone().dot(push.clone().normalize())));
- } else if (comp + factor * .5 > factor) {
- velocity.add(push.clone().multiply(factor - comp));
+ if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))) {
+ continue;
+ }
+ if ((entity.getEntityId() == this.player.getEntityId()) && !this.canAffectSelf) {
+ continue;
+ }
+ final Vector velocity = entity.getVelocity();
+ final double max = this.speed;
+ final Vector push = this.direction.clone();
+ double factor = this.pushFactor;
+
+ if (Math.abs(push.getY()) > max) {
+ if (push.getY() < 0) {
+ push.setY(-max);
} else {
- velocity.add(push.clone().multiply(factor * .5));
+ push.setY(max);
}
-
- GeneralMethods.setVelocity(entity, velocity);
- new HorizontalVelocityTracker(entity, this.player, 200l, this);
- entity.setFallDistance(0);
-
- if (entity.getFireTicks() > 0) {
- entity.getWorld().playEffect(entity.getLocation(), Effect.EXTINGUISH, 0);
- }
- entity.setFireTicks(0);
- breakBreathbendingHold(entity);
+ }
+
+ if (this.location.getWorld().equals(this.origin.getWorld())) {
+ factor *= 1 - this.location.distance(this.origin) / (2 * this.range);
+ }
+
+ final double comp = velocity.dot(push.clone().normalize());
+ if (comp > factor) {
+ velocity.multiply(.5);
+ velocity.add(push.clone().normalize().multiply(velocity.clone().dot(push.clone().normalize())));
+ } else if (comp + factor * .5 > factor) {
+ velocity.add(push.clone().multiply(factor - comp));
+ } else {
+ velocity.add(push.clone().multiply(factor * .5));
+ }
+
+ GeneralMethods.setVelocity(entity, velocity);
+ new HorizontalVelocityTracker(entity, this.player, 200l, this);
+ entity.setFallDistance(0);
+
+ if (entity.getFireTicks() > 0) {
+ entity.getWorld().playEffect(entity.getLocation(), Effect.EXTINGUISH, 0);
+ }
+ entity.setFireTicks(0);
+ breakBreathbendingHold(entity);
}
-
+
this.advanceLocation();
} else {
- playAirbendingParticles(origin, 5, 0.5, 0.5, 0.5);
+ playAirbendingParticles(this.origin, 5, 0.5, 0.5, 0.5);
}
}
-
+
public void shoot() {
Location target;
- Entity entity = GeneralMethods.getTargetedEntity(player, this.range);
+ final Entity entity = GeneralMethods.getTargetedEntity(this.player, this.range);
if (entity != null) {
target = entity.getLocation();
} else {
- target = getTargetLocation();
+ target = this.getTargetLocation();
}
-
+
this.location = target.clone();
this.direction = GeneralMethods.getDirection(this.location, this.origin).normalize();
this.progressing = true;
this.bPlayer.addCooldown(this);
}
-
- public static void shoot(Player player) {
+
+ public static void shoot(final Player player) {
AirSuction suc = null;
-
+
if (CoreAbility.hasAbility(player, AirSuction.class)) {
suc = CoreAbility.getAbility(player, AirSuction.class);
if (suc.isProgressing()) {
return;
- }
+ }
} else {
suc = new AirSuction(player);
suc.setOrigin(player.getEyeLocation().clone());
suc.setCanEffectSelf(false);
}
-
+
if (suc.getOrigin() != null) {
suc.shoot();
}
@@ -327,9 +328,9 @@ public class AirSuction extends AirAbility {
public double getCollisionRadius() {
return this.getRadius();
}
-
+
public boolean isProgressing() {
- return progressing;
+ return this.progressing;
}
public Location getOrigin() {
diff --git a/src/com/projectkorra/projectkorra/airbending/Suffocate.java b/src/com/projectkorra/projectkorra/airbending/Suffocate.java
index 0e2c853d..81623b49 100644
--- a/src/com/projectkorra/projectkorra/airbending/Suffocate.java
+++ b/src/com/projectkorra/projectkorra/airbending/Suffocate.java
@@ -30,12 +30,7 @@ import com.projectkorra.projectkorra.util.DamageHandler;
public class Suffocate extends AirAbility {
public static enum SpiralType {
- HORIZONTAL1,
- HORIZONTAL2,
- VERTICAL1,
- VERTICAL2,
- DIAGONAL1,
- DIAGONAL2
+ HORIZONTAL1, HORIZONTAL2, VERTICAL1, VERTICAL2, DIAGONAL1, DIAGONAL2
};
private boolean started;
diff --git a/src/com/projectkorra/projectkorra/airbending/Tornado.java b/src/com/projectkorra/projectkorra/airbending/Tornado.java
index bff866ed..fc41a7a5 100644
--- a/src/com/projectkorra/projectkorra/airbending/Tornado.java
+++ b/src/com/projectkorra/projectkorra/airbending/Tornado.java
@@ -1,27 +1,28 @@
package com.projectkorra.projectkorra.airbending;
-import com.projectkorra.projectkorra.GeneralMethods;
-import com.projectkorra.projectkorra.ability.AirAbility;
-import com.projectkorra.projectkorra.ability.ElementalAbility;
-import com.projectkorra.projectkorra.attribute.Attribute;
-import com.projectkorra.projectkorra.command.Commands;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.Player;
-import org.bukkit.util.Vector;
-
import java.util.HashSet;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Player;
+import org.bukkit.util.Vector;
+
+import com.projectkorra.projectkorra.GeneralMethods;
+import com.projectkorra.projectkorra.ability.AirAbility;
+import com.projectkorra.projectkorra.ability.ElementalAbility;
+import com.projectkorra.projectkorra.attribute.Attribute;
+import com.projectkorra.projectkorra.command.Commands;
+
public class Tornado extends AirAbility {
@Attribute(Attribute.COOLDOWN)
- private long cooldown;
+ private final long cooldown;
@Attribute(Attribute.DURATION)
- private long duration;
+ private final long duration;
private int numberOfStreams;
private int particleCount;
@Attribute(Attribute.SPEED)
@@ -69,7 +70,7 @@ public class Tornado extends AirAbility {
}
}
- flightHandler.createInstance(player, this.getName());
+ this.flightHandler.createInstance(player, this.getName());
player.setAllowFlight(true);
this.start();
}
@@ -96,7 +97,7 @@ public class Tornado extends AirAbility {
@Override
public void remove() {
super.remove();
- flightHandler.removeInstance(this.player, this.getName());
+ this.flightHandler.removeInstance(this.player, this.getName());
}
private void rotateTornado() {
diff --git a/src/com/projectkorra/projectkorra/airbending/combo/AirStream.java b/src/com/projectkorra/projectkorra/airbending/combo/AirStream.java
index a8b8d4a1..02678172 100644
--- a/src/com/projectkorra/projectkorra/airbending/combo/AirStream.java
+++ b/src/com/projectkorra/projectkorra/airbending/combo/AirStream.java
@@ -1,5 +1,13 @@
package com.projectkorra.projectkorra.airbending.combo;
+import java.util.ArrayList;
+
+import org.bukkit.Location;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Player;
+import org.bukkit.scheduler.BukkitRunnable;
+import org.bukkit.util.Vector;
+
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.ability.AirAbility;
@@ -8,18 +16,9 @@ import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformatio
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.util.ClickType;
-import org.bukkit.Location;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.Player;
-import org.bukkit.scheduler.BukkitRunnable;
-import org.bukkit.util.Vector;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Set;
public class AirStream extends AirAbility implements ComboAbility {
-
+
@Attribute(Attribute.COOLDOWN)
private long cooldown;
private long time;
@@ -162,7 +161,7 @@ public class AirStream extends AirAbility implements ComboAbility {
}
for (final Entity entity : this.affectedEntities) {
- if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){
+ if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))) {
continue;
}
final Vector force = GeneralMethods.getDirection(entity.getLocation(), this.currentLoc);
diff --git a/src/com/projectkorra/projectkorra/airbending/combo/AirSweep.java b/src/com/projectkorra/projectkorra/airbending/combo/AirSweep.java
index 21d2c376..2c2cc797 100644
--- a/src/com/projectkorra/projectkorra/airbending/combo/AirSweep.java
+++ b/src/com/projectkorra/projectkorra/airbending/combo/AirSweep.java
@@ -3,7 +3,6 @@ package com.projectkorra.projectkorra.airbending.combo;
import java.util.ArrayList;
import java.util.List;
-import com.projectkorra.projectkorra.command.Commands;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
@@ -18,6 +17,7 @@ import com.projectkorra.projectkorra.ability.ComboAbility;
import com.projectkorra.projectkorra.ability.util.Collision;
import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation;
import com.projectkorra.projectkorra.attribute.Attribute;
+import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.firebending.combo.FireComboStream;
import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.DamageHandler;
diff --git a/src/com/projectkorra/projectkorra/airbending/combo/Twister.java b/src/com/projectkorra/projectkorra/airbending/combo/Twister.java
index 0ef0f344..9c18fe6f 100644
--- a/src/com/projectkorra/projectkorra/airbending/combo/Twister.java
+++ b/src/com/projectkorra/projectkorra/airbending/combo/Twister.java
@@ -1,5 +1,13 @@
package com.projectkorra.projectkorra.airbending.combo;
+import java.util.ArrayList;
+
+import org.bukkit.Location;
+import org.bukkit.block.Block;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Player;
+import org.bukkit.util.Vector;
+
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.AirAbility;
import com.projectkorra.projectkorra.ability.ComboAbility;
@@ -7,13 +15,6 @@ import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformatio
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.util.ClickType;
-import org.bukkit.Location;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.Player;
-import org.bukkit.util.Vector;
-
-import java.util.ArrayList;
public class Twister extends AirAbility implements ComboAbility {
@@ -141,7 +142,7 @@ public class Twister extends AirAbility implements ComboAbility {
}
for (final Entity entity : this.affectedEntities) {
- if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){
+ if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))) {
continue;
}
final Vector forceDir = GeneralMethods.getDirection(entity.getLocation(), this.currentLoc.clone().add(0, height, 0));
diff --git a/src/com/projectkorra/projectkorra/airbending/flight/FlightMultiAbility.java b/src/com/projectkorra/projectkorra/airbending/flight/FlightMultiAbility.java
index f970a8f2..ac696629 100644
--- a/src/com/projectkorra/projectkorra/airbending/flight/FlightMultiAbility.java
+++ b/src/com/projectkorra/projectkorra/airbending/flight/FlightMultiAbility.java
@@ -113,14 +113,14 @@ public class FlightMultiAbility extends FlightAbility implements MultiAbility {
}
MultiAbilityManager.bindMultiAbility(player, "Flight");
- flightHandler.createInstance(player, ID);
+ this.flightHandler.createInstance(player, ID);
this.hadGlide = player.isGliding();
flying.add(player.getUniqueId());
this.prevDir = player.getEyeLocation().getDirection().clone();
this.duration = getConfig().getLong("Abilities.Air.Flight.Duration");
this.cooldown = getConfig().getLong("Abilities.Air.Flight.Cooldown");
this.baseSpeed = getConfig().getDouble("Abilities.Air.Flight.BaseSpeed");
-
+
this.speed = 1;
this.slowSpeed = this.baseSpeed / 2;
this.fastSpeed = this.baseSpeed * 2;
@@ -130,7 +130,7 @@ public class FlightMultiAbility extends FlightAbility implements MultiAbility {
@Override
public long getCooldown() {
- return cooldown;
+ return this.cooldown;
}
@Override
@@ -221,7 +221,7 @@ public class FlightMultiAbility extends FlightAbility implements MultiAbility {
}
this.prevDir = this.player.getEyeLocation().getDirection().clone();
-
+
for (final Entity e : GeneralMethods.getEntitiesAroundPoint(this.player.getLocation(), this.speed)) {
if (e instanceof LivingEntity && e.getEntityId() != this.player.getEntityId() && !this.player.getPassengers().contains(e)) {
if (!GeneralMethods.isRegionProtectedFromBuild(this.player, e.getLocation())) {
@@ -320,7 +320,7 @@ public class FlightMultiAbility extends FlightAbility implements MultiAbility {
if (this.player.isOnline() && !this.player.isDead()) {
this.player.eject();
}
- flightHandler.removeInstance(this.player, ID);
+ this.flightHandler.removeInstance(this.player, ID);
this.player.setGliding(this.hadGlide);
}
diff --git a/src/com/projectkorra/projectkorra/airbending/passive/AirAgility.java b/src/com/projectkorra/projectkorra/airbending/passive/AirAgility.java
index e4627405..99f796dc 100644
--- a/src/com/projectkorra/projectkorra/airbending/passive/AirAgility.java
+++ b/src/com/projectkorra/projectkorra/airbending/passive/AirAgility.java
@@ -1,13 +1,14 @@
package com.projectkorra.projectkorra.airbending.passive;
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+import org.bukkit.potion.PotionEffect;
+import org.bukkit.potion.PotionEffectType;
+
import com.projectkorra.projectkorra.ability.AirAbility;
import com.projectkorra.projectkorra.ability.PassiveAbility;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.configuration.ConfigManager;
-import org.bukkit.Location;
-import org.bukkit.entity.Player;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
public class AirAgility extends AirAbility implements PassiveAbility {
@@ -17,10 +18,6 @@ public class AirAgility extends AirAbility implements PassiveAbility {
@Attribute(Attribute.SPEED)
private int speedPower;
- // Instance related variables.
- private boolean jumpActivate;
- private boolean speedActivate;
-
public AirAgility(final Player player) {
super(player);
this.setFields();
diff --git a/src/com/projectkorra/projectkorra/airbending/passive/AirSaturation.java b/src/com/projectkorra/projectkorra/airbending/passive/AirSaturation.java
index 434ce514..b64f93fa 100644
--- a/src/com/projectkorra/projectkorra/airbending/passive/AirSaturation.java
+++ b/src/com/projectkorra/projectkorra/airbending/passive/AirSaturation.java
@@ -17,8 +17,7 @@ public class AirSaturation extends AirAbility implements PassiveAbility {
}
@Override
- public void progress() {
- }
+ public void progress() {}
@Override
public boolean isSneakAbility() {
diff --git a/src/com/projectkorra/projectkorra/attribute/AttributeModifier.java b/src/com/projectkorra/projectkorra/attribute/AttributeModifier.java
index 5c2d88ff..4d6b2909 100644
--- a/src/com/projectkorra/projectkorra/attribute/AttributeModifier.java
+++ b/src/com/projectkorra/projectkorra/attribute/AttributeModifier.java
@@ -15,8 +15,7 @@ public enum AttributeModifier {
return oldValue.intValue() + modifier.intValue();
}
return 0;
- }),
- SUBTRACTION((oldValue, modifier) -> {
+ }), SUBTRACTION((oldValue, modifier) -> {
if (oldValue instanceof Double || modifier instanceof Double) {
return oldValue.doubleValue() - modifier.doubleValue();
} else if (oldValue instanceof Float || modifier instanceof Float) {
@@ -27,8 +26,7 @@ public enum AttributeModifier {
return oldValue.intValue() - modifier.intValue();
}
return 0;
- }),
- MULTIPLICATION((oldValue, modifier) -> {
+ }), MULTIPLICATION((oldValue, modifier) -> {
if (oldValue instanceof Double || modifier instanceof Double) {
return oldValue.doubleValue() * modifier.doubleValue();
} else if (oldValue instanceof Float || modifier instanceof Float) {
@@ -39,8 +37,7 @@ public enum AttributeModifier {
return oldValue.intValue() * modifier.intValue();
}
return 0;
- }),
- DIVISION((oldValue, modifier) -> {
+ }), DIVISION((oldValue, modifier) -> {
if (oldValue instanceof Double || modifier instanceof Double) {
return oldValue.doubleValue() / modifier.doubleValue();
} else if (oldValue instanceof Float || modifier instanceof Float) {
@@ -55,15 +52,15 @@ public enum AttributeModifier {
private AttributeModifierMethod modifier;
- private AttributeModifier(AttributeModifierMethod modifier) {
+ private AttributeModifier(final AttributeModifierMethod modifier) {
this.modifier = modifier;
}
public AttributeModifierMethod getModifier() {
- return modifier;
+ return this.modifier;
}
- public Number performModification(Number oldValue, Number modifier) {
+ public Number performModification(final Number oldValue, final Number modifier) {
Validate.isTrue(!(this == DIVISION && modifier.doubleValue() == 0), "modifier cannot be 0");
return this.modifier.performModification(oldValue, modifier);
}
diff --git a/src/com/projectkorra/projectkorra/attribute/AttributePriority.java b/src/com/projectkorra/projectkorra/attribute/AttributePriority.java
index 8be56313..bca4d039 100644
--- a/src/com/projectkorra/projectkorra/attribute/AttributePriority.java
+++ b/src/com/projectkorra/projectkorra/attribute/AttributePriority.java
@@ -2,8 +2,6 @@ package com.projectkorra.projectkorra.attribute;
public enum AttributePriority {
- LOW,
- MEDIUM,
- HIGH;
+ LOW, MEDIUM, HIGH;
}
diff --git a/src/com/projectkorra/projectkorra/avatar/AvatarState.java b/src/com/projectkorra/projectkorra/avatar/AvatarState.java
index 10ecca71..308c0fb3 100644
--- a/src/com/projectkorra/projectkorra/avatar/AvatarState.java
+++ b/src/com/projectkorra/projectkorra/avatar/AvatarState.java
@@ -1,13 +1,14 @@
package com.projectkorra.projectkorra.avatar;
-import com.projectkorra.projectkorra.ability.AvatarAbility;
-import com.projectkorra.projectkorra.attribute.Attribute;
+import java.util.HashMap;
+
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
-import java.util.HashMap;
+import com.projectkorra.projectkorra.ability.AvatarAbility;
+import com.projectkorra.projectkorra.attribute.Attribute;
public class AvatarState extends AvatarAbility {
@@ -80,20 +81,20 @@ public class AvatarState extends AvatarAbility {
private void addPotionEffects() {
if (this.regenEnabled) {
- addProgressPotionEffect(PotionEffectType.REGENERATION, this.regenPower);
+ this.addProgressPotionEffect(PotionEffectType.REGENERATION, this.regenPower);
}
if (this.speedEnabled) {
- addProgressPotionEffect(PotionEffectType.SPEED, this.speedPower);
+ this.addProgressPotionEffect(PotionEffectType.SPEED, this.speedPower);
}
if (this.resistanceEnabled) {
- addProgressPotionEffect(PotionEffectType.DAMAGE_RESISTANCE, this.resistancePower);
+ this.addProgressPotionEffect(PotionEffectType.DAMAGE_RESISTANCE, this.resistancePower);
}
if (this.fireResistanceEnabled) {
- addProgressPotionEffect(PotionEffectType.FIRE_RESISTANCE, this.fireResistancePower);
+ this.addProgressPotionEffect(PotionEffectType.FIRE_RESISTANCE, this.fireResistancePower);
}
}
- private void addProgressPotionEffect(PotionEffectType effect, int power) {
+ private void addProgressPotionEffect(final PotionEffectType effect, final int power) {
if (!this.player.hasPotionEffect(effect) || this.player.getPotionEffect(effect).getAmplifier() < power || (this.player.getPotionEffect(effect).getAmplifier() == power && this.player.getPotionEffect(effect).getDuration() == 1)) {
this.player.addPotionEffect(new PotionEffect(effect, 10, power, true, false), true);
}
diff --git a/src/com/projectkorra/projectkorra/chiblocking/AcrobatStance.java b/src/com/projectkorra/projectkorra/chiblocking/AcrobatStance.java
index d2f563d5..1c7b6063 100644
--- a/src/com/projectkorra/projectkorra/chiblocking/AcrobatStance.java
+++ b/src/com/projectkorra/projectkorra/chiblocking/AcrobatStance.java
@@ -58,7 +58,7 @@ public class AcrobatStance extends ChiAbility {
this.remove();
return;
} else if (this.duration != 0 && System.currentTimeMillis() > this.getStartTime() + this.duration) {
- remove();
+ this.remove();
return;
}
@@ -121,11 +121,11 @@ public class AcrobatStance extends ChiAbility {
public void setJump(final int jump) {
this.jump = jump;
}
-
+
public long getDuration() {
return this.duration;
}
-
+
public void setDuration(final long duration) {
this.duration = duration;
}
diff --git a/src/com/projectkorra/projectkorra/chiblocking/Paralyze.java b/src/com/projectkorra/projectkorra/chiblocking/Paralyze.java
index 58f299bd..a7682dde 100644
--- a/src/com/projectkorra/projectkorra/chiblocking/Paralyze.java
+++ b/src/com/projectkorra/projectkorra/chiblocking/Paralyze.java
@@ -46,7 +46,7 @@ public class Paralyze extends ChiAbility {
return;
}
}
- paralyze(this.target);
+ this.paralyze(this.target);
this.bPlayer.addCooldown(this);
}
this.remove();
@@ -63,7 +63,7 @@ public class Paralyze extends ChiAbility {
}
}
final MovementHandler mh = new MovementHandler((LivingEntity) entity, CoreAbility.getAbility(Paralyze.class));
- mh.stopWithDuration(duration / 1000 * 20, Element.CHI.getColor() + "* Paralyzed *");
+ mh.stopWithDuration(this.duration / 1000 * 20, Element.CHI.getColor() + "* Paralyzed *");
entity.getWorld().playSound(entity.getLocation(), Sound.ENTITY_ENDER_DRAGON_HURT, 2, 0);
}
@@ -101,6 +101,6 @@ public class Paralyze extends ChiAbility {
}
public long getDuration() {
- return duration;
+ return this.duration;
}
}
diff --git a/src/com/projectkorra/projectkorra/chiblocking/SwiftKick.java b/src/com/projectkorra/projectkorra/chiblocking/SwiftKick.java
index e4e05cb9..eb2e6d09 100644
--- a/src/com/projectkorra/projectkorra/chiblocking/SwiftKick.java
+++ b/src/com/projectkorra/projectkorra/chiblocking/SwiftKick.java
@@ -1,13 +1,14 @@
package com.projectkorra.projectkorra.chiblocking;
+import org.bukkit.Location;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Player;
+
import com.projectkorra.projectkorra.ability.ChiAbility;
import com.projectkorra.projectkorra.ability.ElementalAbility;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.chiblocking.passive.ChiPassive;
import com.projectkorra.projectkorra.util.DamageHandler;
-import org.bukkit.Location;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.Player;
public class SwiftKick extends ChiAbility {
diff --git a/src/com/projectkorra/projectkorra/chiblocking/WarriorStance.java b/src/com/projectkorra/projectkorra/chiblocking/WarriorStance.java
index 32130c47..6d6d0e8a 100644
--- a/src/com/projectkorra/projectkorra/chiblocking/WarriorStance.java
+++ b/src/com/projectkorra/projectkorra/chiblocking/WarriorStance.java
@@ -21,7 +21,6 @@ public class WarriorStance extends ChiAbility {
private int strength;
@Attribute("Resistance")
private int resistance;
-
public WarriorStance(final Player player) {
super(player);
@@ -53,7 +52,7 @@ public class WarriorStance extends ChiAbility {
this.remove();
return;
} else if (this.duration != 0 && System.currentTimeMillis() > this.getStartTime() + this.duration) {
- remove();
+ this.remove();
return;
}
diff --git a/src/com/projectkorra/projectkorra/chiblocking/combo/Immobilize.java b/src/com/projectkorra/projectkorra/chiblocking/combo/Immobilize.java
index 9a05ce4a..0ebef009 100644
--- a/src/com/projectkorra/projectkorra/chiblocking/combo/Immobilize.java
+++ b/src/com/projectkorra/projectkorra/chiblocking/combo/Immobilize.java
@@ -1,5 +1,12 @@
package com.projectkorra.projectkorra.chiblocking.combo;
+import java.util.ArrayList;
+
+import org.bukkit.Location;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+
import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.ChiAbility;
@@ -10,12 +17,6 @@ import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.MovementHandler;
-import org.bukkit.Location;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-
-import java.util.ArrayList;
public class Immobilize extends ChiAbility implements ComboAbility {
@@ -38,7 +39,7 @@ public class Immobilize extends ChiAbility implements ComboAbility {
this.remove();
return;
} else {
- if (GeneralMethods.isRegionProtectedFromBuild(this, target.getLocation()) || ((target instanceof Player) && Commands.invincible.contains(((Player) target).getName()))){
+ if (GeneralMethods.isRegionProtectedFromBuild(this, this.target.getLocation()) || ((this.target instanceof Player) && Commands.invincible.contains(((Player) this.target).getName()))) {
return;
}
paralyze(this.target, this.duration);
@@ -64,8 +65,7 @@ public class Immobilize extends ChiAbility implements ComboAbility {
}
@Override
- public void progress() {
- }
+ public void progress() {}
@Override
public boolean isSneakAbility() {
diff --git a/src/com/projectkorra/projectkorra/chiblocking/passive/Acrobatics.java b/src/com/projectkorra/projectkorra/chiblocking/passive/Acrobatics.java
index 02bfdaa2..7c5daace 100644
--- a/src/com/projectkorra/projectkorra/chiblocking/passive/Acrobatics.java
+++ b/src/com/projectkorra/projectkorra/chiblocking/passive/Acrobatics.java
@@ -17,8 +17,7 @@ public class Acrobatics extends ChiAbility implements PassiveAbility {
}
@Override
- public void progress() {
- }
+ public void progress() {}
@Override
public boolean isSneakAbility() {
diff --git a/src/com/projectkorra/projectkorra/chiblocking/passive/ChiAgility.java b/src/com/projectkorra/projectkorra/chiblocking/passive/ChiAgility.java
index 161e918c..4c4af02e 100644
--- a/src/com/projectkorra/projectkorra/chiblocking/passive/ChiAgility.java
+++ b/src/com/projectkorra/projectkorra/chiblocking/passive/ChiAgility.java
@@ -1,13 +1,14 @@
package com.projectkorra.projectkorra.chiblocking.passive;
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+import org.bukkit.potion.PotionEffect;
+import org.bukkit.potion.PotionEffectType;
+
import com.projectkorra.projectkorra.ability.ChiAbility;
import com.projectkorra.projectkorra.ability.PassiveAbility;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.configuration.ConfigManager;
-import org.bukkit.Location;
-import org.bukkit.entity.Player;
-import org.bukkit.potion.PotionEffect;
-import org.bukkit.potion.PotionEffectType;
public class ChiAgility extends ChiAbility implements PassiveAbility {
diff --git a/src/com/projectkorra/projectkorra/chiblocking/passive/ChiSaturation.java b/src/com/projectkorra/projectkorra/chiblocking/passive/ChiSaturation.java
index 24b2f46b..af5ec688 100644
--- a/src/com/projectkorra/projectkorra/chiblocking/passive/ChiSaturation.java
+++ b/src/com/projectkorra/projectkorra/chiblocking/passive/ChiSaturation.java
@@ -17,8 +17,7 @@ public class ChiSaturation extends ChiAbility implements PassiveAbility {
}
@Override
- public void progress() {
- }
+ public void progress() {}
@Override
public boolean isSneakAbility() {
diff --git a/src/com/projectkorra/projectkorra/command/BindCommand.java b/src/com/projectkorra/projectkorra/command/BindCommand.java
index c71ebed6..980d2284 100644
--- a/src/com/projectkorra/projectkorra/command/BindCommand.java
+++ b/src/com/projectkorra/projectkorra/command/BindCommand.java
@@ -69,8 +69,7 @@ public class BindCommand extends PKCommand {
if (args.size() == 2) {
try {
this.bind(sender, args.get(0), Integer.parseInt(args.get(1)));
- }
- catch (final NumberFormatException ex) {
+ } catch (final NumberFormatException ex) {
GeneralMethods.sendBrandingMessage(sender, ChatColor.RED + this.wrongNumber);
}
}
diff --git a/src/com/projectkorra/projectkorra/command/ClearCommand.java b/src/com/projectkorra/projectkorra/command/ClearCommand.java
index 98d4ad1e..3963554e 100644
--- a/src/com/projectkorra/projectkorra/command/ClearCommand.java
+++ b/src/com/projectkorra/projectkorra/command/ClearCommand.java
@@ -67,8 +67,7 @@ public class ClearCommand extends PKCommand {
} else {
GeneralMethods.sendBrandingMessage(sender, ChatColor.YELLOW + this.alreadyEmpty);
}
- }
- catch (final NumberFormatException e) {
+ } catch (final NumberFormatException e) {
GeneralMethods.sendBrandingMessage(sender, ChatColor.RED + this.wrongNumber);
}
}
diff --git a/src/com/projectkorra/projectkorra/command/Commands.java b/src/com/projectkorra/projectkorra/command/Commands.java
index ae2fd2fd..8d23bcdc 100644
--- a/src/com/projectkorra/projectkorra/command/Commands.java
+++ b/src/com/projectkorra/projectkorra/command/Commands.java
@@ -6,9 +6,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
-import org.bukkit.command.CommandSender;
import org.bukkit.command.PluginCommand;
import com.projectkorra.projectkorra.ProjectKorra;
@@ -98,26 +96,23 @@ public class Commands {
new VersionCommand();
new WhoCommand();
- final CommandExecutor exe = new CommandExecutor() {
- @Override
- public boolean onCommand(final CommandSender s, final Command c, final String label, final String[] args) {
- if (Arrays.asList(commandaliases).contains(label.toLowerCase())) {
- if (args.length > 0) {
- final List sendingArgs = Arrays.asList(args).subList(1, args.length);
- for (final PKCommand command : PKCommand.instances.values()) {
- if (Arrays.asList(command.getAliases()).contains(args[0].toLowerCase())) {
- command.execute(s, sendingArgs);
- return true;
- }
+ final CommandExecutor exe = (s, c, label, args) -> {
+ if (Arrays.asList(commandaliases).contains(label.toLowerCase())) {
+ if (args.length > 0) {
+ final List sendingArgs = Arrays.asList(args).subList(1, args.length);
+ for (final PKCommand command : PKCommand.instances.values()) {
+ if (Arrays.asList(command.getAliases()).contains(args[0].toLowerCase())) {
+ command.execute(s, sendingArgs);
+ return true;
}
}
-
- PKCommand.instances.get("help").execute(s, new ArrayList());
- return true;
}
- return false;
+ PKCommand.instances.get("help").execute(s, new ArrayList());
+ return true;
}
+
+ return false;
};
projectkorra.setExecutor(exe);
projectkorra.setTabCompleter(new BendingTabComplete());
diff --git a/src/com/projectkorra/projectkorra/command/HelpCommand.java b/src/com/projectkorra/projectkorra/command/HelpCommand.java
index 5d428259..81093262 100644
--- a/src/com/projectkorra/projectkorra/command/HelpCommand.java
+++ b/src/com/projectkorra/projectkorra/command/HelpCommand.java
@@ -73,13 +73,13 @@ public class HelpCommand extends PKCommand {
}
}
if (GeneralMethods.hasItems()) {
- strings.add(itemsUsage);
+ strings.add(this.itemsUsage);
}
if (GeneralMethods.hasRPG()) {
- strings.add(rpgUsage);
+ strings.add(this.rpgUsage);
}
if (GeneralMethods.hasSpirits()) {
- strings.add(spiritsUsage);
+ strings.add(this.spiritsUsage);
}
Collections.sort(strings);
Collections.reverse(strings);
@@ -105,13 +105,13 @@ public class HelpCommand extends PKCommand {
strings.add(command.getProperUse());
}
if (GeneralMethods.hasItems()) {
- strings.add(itemsUsage);
+ strings.add(this.itemsUsage);
}
if (GeneralMethods.hasRPG()) {
- strings.add(rpgUsage);
+ strings.add(this.rpgUsage);
}
if (GeneralMethods.hasSpirits()) {
- strings.add(spiritsUsage);
+ strings.add(this.spiritsUsage);
}
for (final String s : this.getPage(strings, ChatColor.GOLD + "Commands: <" + this.required + "> [" + this.optional + "]", Integer.valueOf(arg), true)) {
if (firstMessage) {
diff --git a/src/com/projectkorra/projectkorra/command/StatsCommand.java b/src/com/projectkorra/projectkorra/command/StatsCommand.java
index 9f84ae9f..cef2aa8f 100644
--- a/src/com/projectkorra/projectkorra/command/StatsCommand.java
+++ b/src/com/projectkorra/projectkorra/command/StatsCommand.java
@@ -5,7 +5,6 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
-import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -93,9 +92,7 @@ public class StatsCommand extends PKCommand {
int page = 1;
try {
page = Integer.parseInt(args.get(3));
- }
- catch (IndexOutOfBoundsException | NumberFormatException e) {
- }
+ } catch (IndexOutOfBoundsException | NumberFormatException e) {}
final Object o = object;
final int p = page;
new BukkitRunnable() {
@@ -160,8 +157,7 @@ public class StatsCommand extends PKCommand {
final int minIndex = maxIndex - 9;
try {
uuids.get(minIndex);
- }
- catch (final IndexOutOfBoundsException e) {
+ } catch (final IndexOutOfBoundsException e) {
messages.add("&7No statistics found.");
return messages;
}
@@ -201,8 +197,7 @@ public class StatsCommand extends PKCommand {
}
}
}
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
}
for (final Player player : ProjectKorra.plugin.getServer().getOnlinePlayers()) {
@@ -218,20 +213,17 @@ public class StatsCommand extends PKCommand {
}
}
final List list = new ArrayList<>(uuids);
- Collections.sort(list, new Comparator() {
- @Override
- public int compare(final UUID u1, final UUID u2) {
- long value1 = 0;
- long value2 = 0;
- if (object == null) {
- value1 = StatisticsMethods.getStatisticTotal(u1, statistic);
- value2 = StatisticsMethods.getStatisticTotal(u2, statistic);
- } else {
- value1 = StatisticsMethods.getStatistic(u1, object, statistic);
- value2 = StatisticsMethods.getStatistic(u2, object, statistic);
- }
- return (int) (value2 - value1);
+ Collections.sort(list, (u1, u2) -> {
+ long value1 = 0;
+ long value2 = 0;
+ if (object == null) {
+ value1 = StatisticsMethods.getStatisticTotal(u1, statistic);
+ value2 = StatisticsMethods.getStatisticTotal(u2, statistic);
+ } else {
+ value1 = StatisticsMethods.getStatistic(u1, object, statistic);
+ value2 = StatisticsMethods.getStatistic(u2, object, statistic);
}
+ return (int) (value2 - value1);
});
return list;
}
diff --git a/src/com/projectkorra/projectkorra/command/WhoCommand.java b/src/com/projectkorra/projectkorra/command/WhoCommand.java
index f6ab6810..bf49ff86 100644
--- a/src/com/projectkorra/projectkorra/command/WhoCommand.java
+++ b/src/com/projectkorra/projectkorra/command/WhoCommand.java
@@ -70,14 +70,11 @@ public class WhoCommand extends PKCommand {
in.close();
WhoCommand.this.staff.clear();
WhoCommand.this.staff.putAll(updatedstaff);
- }
- catch (final SocketException e) {
+ } catch (final SocketException e) {
ProjectKorra.log.info("Could not update staff list.");
- }
- catch (final MalformedURLException e) {
+ } catch (final MalformedURLException e) {
e.printStackTrace();
- }
- catch (final IOException e) {
+ } catch (final IOException e) {
e.printStackTrace();
}
}
@@ -175,8 +172,7 @@ public class WhoCommand extends PKCommand {
count++;
try {
Thread.sleep(delay);
- }
- catch (final InterruptedException e) {
+ } catch (final InterruptedException e) {
e.printStackTrace();
GeneralMethods.sendBrandingMessage(sender, ChatColor.DARK_RED + WhoCommand.this.databaseOverload);
break;
diff --git a/src/com/projectkorra/projectkorra/configuration/Config.java b/src/com/projectkorra/projectkorra/configuration/Config.java
index bb63cd01..84f2e499 100644
--- a/src/com/projectkorra/projectkorra/configuration/Config.java
+++ b/src/com/projectkorra/projectkorra/configuration/Config.java
@@ -40,8 +40,7 @@ public class Config {
try {
this.file.getParentFile().mkdir();
this.plugin.getLogger().info("Generating new directory for " + this.file.getName() + "!");
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
this.plugin.getLogger().info("Failed to generate directory!");
e.printStackTrace();
}
@@ -51,8 +50,7 @@ public class Config {
try {
this.file.createNewFile();
this.plugin.getLogger().info("Generating new " + this.file.getName() + "!");
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
this.plugin.getLogger().info("Failed to generate " + this.file.getName() + "!");
e.printStackTrace();
}
@@ -76,8 +74,7 @@ public class Config {
this.create();
try {
this.config.load(this.file);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
}
}
@@ -91,8 +88,7 @@ public class Config {
try {
this.config.options().copyDefaults(true);
this.config.save(this.file);
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
}
}
diff --git a/src/com/projectkorra/projectkorra/configuration/ConfigManager.java b/src/com/projectkorra/projectkorra/configuration/ConfigManager.java
index c2c46ba5..7a0b08a3 100644
--- a/src/com/projectkorra/projectkorra/configuration/ConfigManager.java
+++ b/src/com/projectkorra/projectkorra/configuration/ConfigManager.java
@@ -1,11 +1,11 @@
package com.projectkorra.projectkorra.configuration;
-import org.bukkit.Material;
-import org.bukkit.configuration.file.FileConfiguration;
-
import java.io.File;
import java.util.ArrayList;
+import org.bukkit.Material;
+import org.bukkit.configuration.file.FileConfiguration;
+
public class ConfigManager {
public static Config presetConfig;
diff --git a/src/com/projectkorra/projectkorra/earthbending/Catapult.java b/src/com/projectkorra/projectkorra/earthbending/Catapult.java
index a86413a0..838c8abc 100644
--- a/src/com/projectkorra/projectkorra/earthbending/Catapult.java
+++ b/src/com/projectkorra/projectkorra/earthbending/Catapult.java
@@ -40,17 +40,17 @@ public class Catapult extends EarthAbility {
if (!(isEarth(b) || isSand(b) || isMetal(b))) {
return;
}
-
+
this.bentBlockData = b.getBlockData();
-
+
if (!this.bPlayer.canBend(this)) {
return;
}
-
+
if (this.bPlayer.isAvatarState()) {
this.cooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.Catapult.Cooldown");
}
-
+
this.charging = sneak;
this.start();
}
@@ -81,13 +81,13 @@ public class Catapult extends EarthAbility {
this.remove();
return;
}
-
+
final Block b = this.player.getLocation().getBlock().getRelative(BlockFace.DOWN, 1);
if (!(isEarth(b) || isSand(b) || isMetal(b))) {
this.remove();
return;
}
-
+
this.bentBlockData = b.getBlockData();
if (this.charging) {
@@ -98,8 +98,8 @@ public class Catapult extends EarthAbility {
this.stage++;
this.stageStart = System.currentTimeMillis();
final Random random = new Random();
- ParticleEffect.BLOCK_DUST.display(this.player.getLocation(), 15, random.nextFloat(), random.nextFloat(), random.nextFloat(), bentBlockData);
- ParticleEffect.BLOCK_DUST.display(this.player.getLocation().add(0, 0.5, 0), 10, random.nextFloat(), random.nextFloat(), random.nextFloat(), bentBlockData);
+ ParticleEffect.BLOCK_DUST.display(this.player.getLocation(), 15, random.nextFloat(), random.nextFloat(), random.nextFloat(), this.bentBlockData);
+ ParticleEffect.BLOCK_DUST.display(this.player.getLocation().add(0, 0.5, 0), 10, random.nextFloat(), random.nextFloat(), random.nextFloat(), this.bentBlockData);
this.player.getWorld().playEffect(this.player.getLocation(), Effect.GHAST_SHOOT, 0, 10);
}
}
diff --git a/src/com/projectkorra/projectkorra/earthbending/CollapseWall.java b/src/com/projectkorra/projectkorra/earthbending/CollapseWall.java
index 3e2bb691..ff316ff2 100644
--- a/src/com/projectkorra/projectkorra/earthbending/CollapseWall.java
+++ b/src/com/projectkorra/projectkorra/earthbending/CollapseWall.java
@@ -97,8 +97,7 @@ public class CollapseWall extends EarthAbility {
}
@Override
- public void progress() {
- }
+ public void progress() {}
@Override
public Location getLocation() {
diff --git a/src/com/projectkorra/projectkorra/earthbending/EarthArmor.java b/src/com/projectkorra/projectkorra/earthbending/EarthArmor.java
index 260ad8c1..07bb6393 100644
--- a/src/com/projectkorra/projectkorra/earthbending/EarthArmor.java
+++ b/src/com/projectkorra/projectkorra/earthbending/EarthArmor.java
@@ -1,15 +1,12 @@
package com.projectkorra.projectkorra.earthbending;
-import com.projectkorra.projectkorra.GeneralMethods;
-import com.projectkorra.projectkorra.ProjectKorra;
-import com.projectkorra.projectkorra.ability.EarthAbility;
-import com.projectkorra.projectkorra.ability.ElementalAbility;
-import com.projectkorra.projectkorra.attribute.Attribute;
-import com.projectkorra.projectkorra.command.Commands;
-import com.projectkorra.projectkorra.util.ParticleEffect;
-import com.projectkorra.projectkorra.util.TempArmor;
-import com.projectkorra.projectkorra.util.TempBlock;
-import org.bukkit.*;
+import java.util.List;
+
+import org.bukkit.Color;
+import org.bukkit.GameMode;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
@@ -20,7 +17,15 @@ import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
-import java.util.List;
+import com.projectkorra.projectkorra.GeneralMethods;
+import com.projectkorra.projectkorra.ProjectKorra;
+import com.projectkorra.projectkorra.ability.EarthAbility;
+import com.projectkorra.projectkorra.ability.ElementalAbility;
+import com.projectkorra.projectkorra.attribute.Attribute;
+import com.projectkorra.projectkorra.command.Commands;
+import com.projectkorra.projectkorra.util.ParticleEffect;
+import com.projectkorra.projectkorra.util.TempArmor;
+import com.projectkorra.projectkorra.util.TempBlock;
public class EarthArmor extends EarthAbility {
@@ -229,8 +234,8 @@ public class EarthArmor extends EarthAbility {
this.player.getLocation().getWorld().playSound(this.player.getLocation(), Sound.BLOCK_STONE_BREAK, 2, 1);
this.player.getLocation().getWorld().playSound(this.player.getLocation(), Sound.BLOCK_STONE_BREAK, 2, 1);
- ParticleEffect.BLOCK_CRACK.display(player.getEyeLocation(), 8, 0.1, 0.1, 0.1, headMaterial.createBlockData());
- ParticleEffect.BLOCK_CRACK.display(player.getLocation(), 8, 0.1F, 0.1F, 0.1F, legsMaterial.createBlockData());
+ ParticleEffect.BLOCK_CRACK.display(this.player.getEyeLocation(), 8, 0.1, 0.1, 0.1, this.headMaterial.createBlockData());
+ ParticleEffect.BLOCK_CRACK.display(this.player.getLocation(), 8, 0.1F, 0.1F, 0.1F, this.legsMaterial.createBlockData());
this.bPlayer.addCooldown(this);
this.remove();
@@ -455,8 +460,8 @@ public class EarthArmor extends EarthAbility {
this.player.getLocation().getWorld().playSound(this.player.getLocation(), Sound.BLOCK_STONE_BREAK, 2, 1);
this.player.getLocation().getWorld().playSound(this.player.getLocation(), Sound.BLOCK_STONE_BREAK, 2, 1);
- ParticleEffect.BLOCK_CRACK.display(player.getEyeLocation(), 8, 0.1, 0.1, 0.1, headMaterial.createBlockData());
- ParticleEffect.BLOCK_CRACK.display(player.getLocation(), 8, 0.1F, 0.1F, 0.1F, legsMaterial.createBlockData());
+ ParticleEffect.BLOCK_CRACK.display(this.player.getEyeLocation(), 8, 0.1, 0.1, 0.1, this.headMaterial.createBlockData());
+ ParticleEffect.BLOCK_CRACK.display(this.player.getLocation(), 8, 0.1F, 0.1F, 0.1F, this.legsMaterial.createBlockData());
this.bPlayer.addCooldown(this);
this.remove();
diff --git a/src/com/projectkorra/projectkorra/earthbending/EarthBlast.java b/src/com/projectkorra/projectkorra/earthbending/EarthBlast.java
index dfd194ec..b00cf9ad 100644
--- a/src/com/projectkorra/projectkorra/earthbending/EarthBlast.java
+++ b/src/com/projectkorra/projectkorra/earthbending/EarthBlast.java
@@ -137,8 +137,7 @@ public class EarthBlast extends EarthAbility {
for (int j = 0; j < this.getEarthbendableBlocks().size(); j++) {
try {
trans[i] = Material.valueOf(this.getEarthbendableBlocks().get(j));
- }
- catch (final IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
continue;
}
i++;
@@ -367,9 +366,9 @@ public class EarthBlast extends EarthAbility {
if (target != null) {
this.destination = target.getLocation();
} else {
- this.destination = getTargetLocation();
+ this.destination = this.getTargetLocation();
}
-
+
if (this.sourceBlock == null) {
return;
}
diff --git a/src/com/projectkorra/projectkorra/earthbending/EarthDome.java b/src/com/projectkorra/projectkorra/earthbending/EarthDome.java
index 81cfed24..4ad7b0a9 100644
--- a/src/com/projectkorra/projectkorra/earthbending/EarthDome.java
+++ b/src/com/projectkorra/projectkorra/earthbending/EarthDome.java
@@ -38,7 +38,7 @@ public class EarthDome extends EarthAbility {
this.cooldown = getConfig().getLong("Abilities.Earth.EarthDome.Cooldown");
this.checked = new HashSet<>();
- start();
+ this.start();
}
public EarthDome(final Player player) {
@@ -70,7 +70,7 @@ public class EarthDome extends EarthAbility {
@Override
public void progress() {
for (int i = 0; i < 2; i++) {
- for (final Location check : this.getCircle(center, this.radius + i, 10)) {
+ for (final Location check : this.getCircle(this.center, this.radius + i, 10)) {
Block currBlock = check.getBlock();
if (this.checked.contains(currBlock)) {
continue;
@@ -81,7 +81,7 @@ public class EarthDome extends EarthAbility {
continue;
}
- new RaiseEarth(player, currBlock.getLocation(), Math.round(this.height - i));
+ new RaiseEarth(this.player, currBlock.getLocation(), Math.round(this.height - i));
this.checked.add(currBlock);
}
@@ -103,7 +103,7 @@ public class EarthDome extends EarthAbility {
@Override
public long getCooldown() {
- return cooldown;
+ return this.cooldown;
}
@Override
diff --git a/src/com/projectkorra/projectkorra/earthbending/EarthGrab.java b/src/com/projectkorra/projectkorra/earthbending/EarthGrab.java
index 1b13f1c2..fca580b0 100644
--- a/src/com/projectkorra/projectkorra/earthbending/EarthGrab.java
+++ b/src/com/projectkorra/projectkorra/earthbending/EarthGrab.java
@@ -1,5 +1,28 @@
package com.projectkorra.projectkorra.earthbending;
+import java.util.Arrays;
+import java.util.List;
+
+import org.bukkit.Color;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.block.BlockFace;
+import org.bukkit.block.data.Ageable;
+import org.bukkit.entity.ArmorStand;
+import org.bukkit.entity.Arrow;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Item;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.entity.Skeleton;
+import org.bukkit.entity.Trident;
+import org.bukkit.entity.Zombie;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.LeatherArmorMeta;
+import org.bukkit.metadata.FixedMetadataValue;
+import org.bukkit.util.Vector;
+
import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.GeneralMethods;
@@ -9,21 +32,11 @@ import com.projectkorra.projectkorra.ability.EarthAbility;
import com.projectkorra.projectkorra.ability.ElementalAbility;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.avatar.AvatarState;
-import com.projectkorra.projectkorra.util.*;
-import org.bukkit.Color;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.block.BlockFace;
-import org.bukkit.block.data.Ageable;
-import org.bukkit.entity.*;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.LeatherArmorMeta;
-import org.bukkit.metadata.FixedMetadataValue;
-import org.bukkit.util.Vector;
-
-import java.util.Arrays;
-import java.util.List;
+import com.projectkorra.projectkorra.util.MovementHandler;
+import com.projectkorra.projectkorra.util.ParticleEffect;
+import com.projectkorra.projectkorra.util.TempArmor;
+import com.projectkorra.projectkorra.util.TempArmorStand;
+import com.projectkorra.projectkorra.util.TempBlock;
public class EarthGrab extends EarthAbility {
@@ -295,7 +308,7 @@ public class EarthGrab extends EarthAbility {
if (entity instanceof Trident) {
continue;
} else if (entity instanceof Arrow) {
- Arrow arrow = (Arrow) entity;
+ final Arrow arrow = (Arrow) entity;
if (arrow.getPickupStatus() == Arrow.PickupStatus.ALLOWED) {
final Location l = entity.getLocation();
entity.remove();
diff --git a/src/com/projectkorra/projectkorra/earthbending/EarthSmash.java b/src/com/projectkorra/projectkorra/earthbending/EarthSmash.java
index 34f42f86..88cd0df3 100644
--- a/src/com/projectkorra/projectkorra/earthbending/EarthSmash.java
+++ b/src/com/projectkorra/projectkorra/earthbending/EarthSmash.java
@@ -1,5 +1,19 @@
package com.projectkorra.projectkorra.earthbending;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+import org.bukkit.Effect;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.block.data.BlockData;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.util.Vector;
+
import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.EarthAbility;
@@ -10,19 +24,6 @@ import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.ParticleEffect;
import com.projectkorra.projectkorra.util.TempBlock;
-import org.bukkit.Effect;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.block.data.BlockData;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.util.Vector;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
public class EarthSmash extends EarthAbility {
diff --git a/src/com/projectkorra/projectkorra/earthbending/EarthTunnel.java b/src/com/projectkorra/projectkorra/earthbending/EarthTunnel.java
index c769c3ce..1d3f0682 100644
--- a/src/com/projectkorra/projectkorra/earthbending/EarthTunnel.java
+++ b/src/com/projectkorra/projectkorra/earthbending/EarthTunnel.java
@@ -96,14 +96,14 @@ public class EarthTunnel extends EarthAbility {
if (System.currentTimeMillis() - this.time >= this.interval) {
this.time = System.currentTimeMillis();
- for (int i = 1; i <= blocksPerInterval; i++) {
+ for (int i = 1; i <= this.blocksPerInterval; i++) {
if (Math.abs(Math.toDegrees(this.player.getEyeLocation().getDirection().angle(this.direction))) > 20 || !this.player.isSneaking()) {
this.bPlayer.addCooldown(this);
this.remove();
return;
} else {
- while ((!isEarth(this.block) && !isSand(this.block)) || (ignoreOres && this.isOre(this.block))) {
- if (!this.isTransparent(this.block) && (ignoreOres && !this.isOre(this.block))) {
+ while ((!isEarth(this.block) && !isSand(this.block)) || (this.ignoreOres && this.isOre(this.block))) {
+ if (!this.isTransparent(this.block) && (this.ignoreOres && !this.isOre(this.block))) {
this.remove();
return;
}
@@ -164,7 +164,7 @@ public class EarthTunnel extends EarthAbility {
}
}
- private boolean isOre(Block block) {
+ private boolean isOre(final Block block) {
switch (block.getType()) {
case IRON_ORE:
case GOLD_ORE:
diff --git a/src/com/projectkorra/projectkorra/earthbending/RaiseEarth.java b/src/com/projectkorra/projectkorra/earthbending/RaiseEarth.java
index 06d82c59..fbc88f19 100644
--- a/src/com/projectkorra/projectkorra/earthbending/RaiseEarth.java
+++ b/src/com/projectkorra/projectkorra/earthbending/RaiseEarth.java
@@ -57,8 +57,7 @@ public class RaiseEarth extends EarthAbility {
this.origin = this.block.getLocation();
this.location = this.origin.clone();
this.distance = this.getEarthbendableBlocksLength(this.block, this.direction.clone().multiply(-1), this.height);
- }
- catch (final IllegalStateException e) {
+ } catch (final IllegalStateException e) {
return;
}
diff --git a/src/com/projectkorra/projectkorra/earthbending/RaiseEarthWall.java b/src/com/projectkorra/projectkorra/earthbending/RaiseEarthWall.java
index ddea1fc3..72070e5e 100644
--- a/src/com/projectkorra/projectkorra/earthbending/RaiseEarthWall.java
+++ b/src/com/projectkorra/projectkorra/earthbending/RaiseEarthWall.java
@@ -40,7 +40,7 @@ public class RaiseEarthWall extends EarthAbility {
this.width = getConfig().getInt("Abilities.Avatar.AvatarState.Earth.RaiseEarth.Wall.Width");
}
- start();
+ this.start();
}
private static Vector getDegreeRoundedVector(Vector vec, final double degreeIncrement) {
@@ -74,7 +74,7 @@ public class RaiseEarthWall extends EarthAbility {
@Override
public void progress() {
- final Vector direction = player.getEyeLocation().getDirection().normalize();
+ final Vector direction = this.player.getEyeLocation().getDirection().normalize();
double ox, oy, oz;
direction.setY(0);
ox = -direction.getZ();
@@ -85,7 +85,7 @@ public class RaiseEarthWall extends EarthAbility {
orth = orth.normalize();
orth = getDegreeRoundedVector(orth, 0.25);
- final Block sblock = BlockSource.getEarthSourceBlock(player, this.selectRange, ClickType.SHIFT_DOWN);
+ final Block sblock = BlockSource.getEarthSourceBlock(this.player, this.selectRange, ClickType.SHIFT_DOWN);
if (sblock == null) {
this.location = this.getTargetEarthBlock(this.selectRange).getLocation();
@@ -105,7 +105,7 @@ public class RaiseEarthWall extends EarthAbility {
block = block.getRelative(BlockFace.DOWN);
if (this.isEarthbendable(block)) {
shouldAddCooldown = true;
- new RaiseEarth(player, block.getLocation(), this.height);
+ new RaiseEarth(this.player, block.getLocation(), this.height);
} else if (!this.isTransparent(block)) {
break;
}
@@ -115,14 +115,14 @@ public class RaiseEarthWall extends EarthAbility {
block = block.getRelative(BlockFace.UP);
if (this.isTransparent(block)) {
shouldAddCooldown = true;
- new RaiseEarth(player, block.getRelative(BlockFace.DOWN).getLocation(), this.height);
+ new RaiseEarth(this.player, block.getRelative(BlockFace.DOWN).getLocation(), this.height);
} else if (!this.isEarthbendable(block)) {
break;
}
}
} else if (this.isEarthbendable(block)) {
shouldAddCooldown = true;
- new RaiseEarth(player, block.getLocation(), this.height);
+ new RaiseEarth(this.player, block.getLocation(), this.height);
}
}
diff --git a/src/com/projectkorra/projectkorra/earthbending/Ripple.java b/src/com/projectkorra/projectkorra/earthbending/Ripple.java
index a8e09e33..25fc4bb2 100644
--- a/src/com/projectkorra/projectkorra/earthbending/Ripple.java
+++ b/src/com/projectkorra/projectkorra/earthbending/Ripple.java
@@ -1,12 +1,9 @@
package com.projectkorra.projectkorra.earthbending;
-import com.projectkorra.projectkorra.GeneralMethods;
-import com.projectkorra.projectkorra.ability.AirAbility;
-import com.projectkorra.projectkorra.ability.EarthAbility;
-import com.projectkorra.projectkorra.attribute.Attribute;
-import com.projectkorra.projectkorra.avatar.AvatarState;
-import com.projectkorra.projectkorra.command.Commands;
-import com.projectkorra.projectkorra.util.DamageHandler;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
@@ -16,9 +13,13 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
+import com.projectkorra.projectkorra.GeneralMethods;
+import com.projectkorra.projectkorra.ability.AirAbility;
+import com.projectkorra.projectkorra.ability.EarthAbility;
+import com.projectkorra.projectkorra.attribute.Attribute;
+import com.projectkorra.projectkorra.avatar.AvatarState;
+import com.projectkorra.projectkorra.command.Commands;
+import com.projectkorra.projectkorra.util.DamageHandler;
public class Ripple extends EarthAbility {
@@ -274,7 +275,7 @@ public class Ripple extends EarthAbility {
}
private void affect(final Entity entity) {
- if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){
+ if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))) {
return;
}
if (entity instanceof LivingEntity) {
diff --git a/src/com/projectkorra/projectkorra/earthbending/Tremorsense.java b/src/com/projectkorra/projectkorra/earthbending/Tremorsense.java
index cc6c5c06..5865ea91 100644
--- a/src/com/projectkorra/projectkorra/earthbending/Tremorsense.java
+++ b/src/com/projectkorra/projectkorra/earthbending/Tremorsense.java
@@ -1,10 +1,8 @@
package com.projectkorra.projectkorra.earthbending;
-import com.projectkorra.projectkorra.BendingPlayer;
-import com.projectkorra.projectkorra.GeneralMethods;
-import com.projectkorra.projectkorra.ability.EarthAbility;
-import com.projectkorra.projectkorra.ability.ElementalAbility;
-import com.projectkorra.projectkorra.attribute.Attribute;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -13,8 +11,11 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
+import com.projectkorra.projectkorra.BendingPlayer;
+import com.projectkorra.projectkorra.GeneralMethods;
+import com.projectkorra.projectkorra.ability.EarthAbility;
+import com.projectkorra.projectkorra.ability.ElementalAbility;
+import com.projectkorra.projectkorra.attribute.Attribute;
public class Tremorsense extends EarthAbility {
diff --git a/src/com/projectkorra/projectkorra/earthbending/combo/EarthDomeSelf.java b/src/com/projectkorra/projectkorra/earthbending/combo/EarthDomeSelf.java
index 1ef27124..04fd92d2 100644
--- a/src/com/projectkorra/projectkorra/earthbending/combo/EarthDomeSelf.java
+++ b/src/com/projectkorra/projectkorra/earthbending/combo/EarthDomeSelf.java
@@ -20,8 +20,7 @@ public class EarthDomeSelf extends EarthAbility implements ComboAbility {
}
@Override
- public void progress() {
- }
+ public void progress() {}
@Override
public boolean isSneakAbility() {
diff --git a/src/com/projectkorra/projectkorra/earthbending/combo/EarthPillars.java b/src/com/projectkorra/projectkorra/earthbending/combo/EarthPillars.java
index 288074f2..611c63f4 100644
--- a/src/com/projectkorra/projectkorra/earthbending/combo/EarthPillars.java
+++ b/src/com/projectkorra/projectkorra/earthbending/combo/EarthPillars.java
@@ -23,7 +23,7 @@ import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.ParticleEffect;
public class EarthPillars extends EarthAbility implements ComboAbility {
-
+
@Attribute(Attribute.RADIUS)
private double radius;
@Attribute(Attribute.DAMAGE)
@@ -48,7 +48,7 @@ public class EarthPillars extends EarthAbility implements ComboAbility {
return;
}
}
-
+
this.firstTime = true;
this.start();
@@ -77,21 +77,21 @@ public class EarthPillars extends EarthAbility implements ComboAbility {
@Override
public void progress() {
- if (firstTime) {
- for (final Entity e : GeneralMethods.getEntitiesAroundPoint(player.getLocation(), this.radius)) {
- if (e instanceof LivingEntity && e.getEntityId() != player.getEntityId() && isEarthbendable(e.getLocation().getBlock().getRelative(BlockFace.DOWN).getType(), true, true, false)) {
+ if (this.firstTime) {
+ for (final Entity e : GeneralMethods.getEntitiesAroundPoint(this.player.getLocation(), this.radius)) {
+ if (e instanceof LivingEntity && e.getEntityId() != this.player.getEntityId() && isEarthbendable(e.getLocation().getBlock().getRelative(BlockFace.DOWN).getType(), true, true, false)) {
ParticleEffect.BLOCK_DUST.display(e.getLocation(), 10, 1, 0.1, 1, e.getLocation().getBlock().getRelative(BlockFace.DOWN).getBlockData());
this.affect((LivingEntity) e);
}
}
if (this.entities.isEmpty()) {
- remove();
+ this.remove();
return;
}
- firstTime = false;
+ this.firstTime = false;
}
-
+
final List removal = new ArrayList<>();
for (final RaiseEarth abil : this.entities.keySet()) {
if (abil.isRemoved() && abil.isStarted()) {
diff --git a/src/com/projectkorra/projectkorra/earthbending/lava/LavaFlow.java b/src/com/projectkorra/projectkorra/earthbending/lava/LavaFlow.java
index fede8194..b41bf2ad 100644
--- a/src/com/projectkorra/projectkorra/earthbending/lava/LavaFlow.java
+++ b/src/com/projectkorra/projectkorra/earthbending/lava/LavaFlow.java
@@ -1,12 +1,11 @@
package com.projectkorra.projectkorra.earthbending.lava;
-import com.projectkorra.projectkorra.GeneralMethods;
-import com.projectkorra.projectkorra.ProjectKorra;
-import com.projectkorra.projectkorra.ability.CoreAbility;
-import com.projectkorra.projectkorra.ability.EarthAbility;
-import com.projectkorra.projectkorra.ability.LavaAbility;
-import com.projectkorra.projectkorra.attribute.Attribute;
-import com.projectkorra.projectkorra.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.concurrent.ConcurrentHashMap;
+
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
@@ -15,11 +14,17 @@ import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-import java.util.concurrent.ConcurrentHashMap;
+import com.projectkorra.projectkorra.GeneralMethods;
+import com.projectkorra.projectkorra.ProjectKorra;
+import com.projectkorra.projectkorra.ability.CoreAbility;
+import com.projectkorra.projectkorra.ability.EarthAbility;
+import com.projectkorra.projectkorra.ability.LavaAbility;
+import com.projectkorra.projectkorra.attribute.Attribute;
+import com.projectkorra.projectkorra.util.BlockSource;
+import com.projectkorra.projectkorra.util.ClickType;
+import com.projectkorra.projectkorra.util.Information;
+import com.projectkorra.projectkorra.util.ParticleEffect;
+import com.projectkorra.projectkorra.util.TempBlock;
public class LavaFlow extends LavaAbility {
@@ -383,9 +388,9 @@ public class LavaFlow extends LavaAbility {
*/
public void createLava(final Block block) {
if (isEarth(block) || isSand(block) || isMetal(block)) {
- if (EarthAbility.getMovedEarth().containsKey(block)){
- Information info = EarthAbility.getMovedEarth().get(block);
- if(!info.getBlock().equals(block)) {
+ if (EarthAbility.getMovedEarth().containsKey(block)) {
+ final Information info = EarthAbility.getMovedEarth().get(block);
+ if (!info.getBlock().equals(block)) {
return;
}
}
diff --git a/src/com/projectkorra/projectkorra/earthbending/lava/LavaSurge.java b/src/com/projectkorra/projectkorra/earthbending/lava/LavaSurge.java
index 2ebaed56..fead9aa4 100644
--- a/src/com/projectkorra/projectkorra/earthbending/lava/LavaSurge.java
+++ b/src/com/projectkorra/projectkorra/earthbending/lava/LavaSurge.java
@@ -1,9 +1,13 @@
package com.projectkorra.projectkorra.earthbending.lava;
-import com.projectkorra.projectkorra.GeneralMethods;
-import com.projectkorra.projectkorra.ability.ElementalAbility;
-import com.projectkorra.projectkorra.ability.LavaAbility;
-import com.projectkorra.projectkorra.util.*;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.Random;
+import java.util.concurrent.ConcurrentHashMap;
+
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
@@ -14,8 +18,14 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
+import com.projectkorra.projectkorra.GeneralMethods;
+import com.projectkorra.projectkorra.ability.ElementalAbility;
+import com.projectkorra.projectkorra.ability.LavaAbility;
+import com.projectkorra.projectkorra.util.BlockSource;
+import com.projectkorra.projectkorra.util.ClickType;
+import com.projectkorra.projectkorra.util.DamageHandler;
+import com.projectkorra.projectkorra.util.ParticleEffect;
+import com.projectkorra.projectkorra.util.TempBlock;
public class LavaSurge extends LavaAbility {
@@ -109,9 +119,7 @@ public class LavaSurge extends LavaAbility {
try {
targetLocation = GeneralMethods.getTargetedEntity(this.player, this.travelRange * 2, null).getLocation();
- }
- catch (final NullPointerException e) {
- }
+ } catch (final NullPointerException e) {}
if (targetLocation == null) {
this.remove();
diff --git a/src/com/projectkorra/projectkorra/earthbending/lava/LavaSurgeWall.java b/src/com/projectkorra/projectkorra/earthbending/lava/LavaSurgeWall.java
index d4c4b051..360690f5 100644
--- a/src/com/projectkorra/projectkorra/earthbending/lava/LavaSurgeWall.java
+++ b/src/com/projectkorra/projectkorra/earthbending/lava/LavaSurgeWall.java
@@ -1,5 +1,17 @@
package com.projectkorra.projectkorra.earthbending.lava;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.bukkit.Effect;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.entity.Player;
+import org.bukkit.util.Vector;
+
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.ElementalAbility;
import com.projectkorra.projectkorra.ability.LavaAbility;
@@ -9,17 +21,6 @@ import com.projectkorra.projectkorra.util.BlockSource;
import com.projectkorra.projectkorra.util.BlockSource.BlockSourceType;
import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.TempBlock;
-import org.bukkit.Effect;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Player;
-import org.bukkit.util.Vector;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
public class LavaSurgeWall extends LavaAbility {
diff --git a/src/com/projectkorra/projectkorra/earthbending/lava/LavaSurgeWave.java b/src/com/projectkorra/projectkorra/earthbending/lava/LavaSurgeWave.java
index 1a0991a9..cb3d3145 100644
--- a/src/com/projectkorra/projectkorra/earthbending/lava/LavaSurgeWave.java
+++ b/src/com/projectkorra/projectkorra/earthbending/lava/LavaSurgeWave.java
@@ -1,5 +1,17 @@
package com.projectkorra.projectkorra.earthbending.lava;
+import java.util.ArrayList;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.bukkit.Effect;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.util.Vector;
+
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.ElementalAbility;
import com.projectkorra.projectkorra.ability.LavaAbility;
@@ -9,17 +21,6 @@ import com.projectkorra.projectkorra.util.BlockSource;
import com.projectkorra.projectkorra.util.BlockSource.BlockSourceType;
import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.TempBlock;
-import org.bukkit.Effect;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.util.Vector;
-
-import java.util.ArrayList;
-import java.util.concurrent.ConcurrentHashMap;
public class LavaSurgeWave extends LavaAbility {
diff --git a/src/com/projectkorra/projectkorra/earthbending/metal/Extraction.java b/src/com/projectkorra/projectkorra/earthbending/metal/Extraction.java
index 39b36f97..d5ce3436 100644
--- a/src/com/projectkorra/projectkorra/earthbending/metal/Extraction.java
+++ b/src/com/projectkorra/projectkorra/earthbending/metal/Extraction.java
@@ -1,17 +1,18 @@
package com.projectkorra.projectkorra.earthbending.metal;
-import com.projectkorra.projectkorra.GeneralMethods;
-import com.projectkorra.projectkorra.ability.MetalAbility;
-import com.projectkorra.projectkorra.attribute.Attribute;
-import com.projectkorra.projectkorra.util.TempBlock;
+import java.util.HashSet;
+import java.util.Random;
+
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
-import java.util.HashSet;
-import java.util.Random;
+import com.projectkorra.projectkorra.GeneralMethods;
+import com.projectkorra.projectkorra.ability.MetalAbility;
+import com.projectkorra.projectkorra.attribute.Attribute;
+import com.projectkorra.projectkorra.util.TempBlock;
public class Extraction extends MetalAbility {
@@ -96,8 +97,7 @@ public class Extraction extends MetalAbility {
}
@Override
- public void progress() {
- }
+ public void progress() {}
@Override
public Location getLocation() {
diff --git a/src/com/projectkorra/projectkorra/earthbending/metal/MetalClips.java b/src/com/projectkorra/projectkorra/earthbending/metal/MetalClips.java
index c2b6d6d7..c3b95ca0 100644
--- a/src/com/projectkorra/projectkorra/earthbending/metal/MetalClips.java
+++ b/src/com/projectkorra/projectkorra/earthbending/metal/MetalClips.java
@@ -1,19 +1,29 @@
package com.projectkorra.projectkorra.earthbending.metal;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Item;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.entity.Skeleton;
+import org.bukkit.entity.Zombie;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.util.Vector;
+
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.CoreAbility;
import com.projectkorra.projectkorra.ability.MetalAbility;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.TempArmor;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.entity.*;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.util.Vector;
-
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
public class MetalClips extends MetalAbility {
@@ -401,7 +411,7 @@ public class MetalClips extends MetalAbility {
}
}
- Iterator- it = this.trackedIngots.iterator();
+ final Iterator
- it = this.trackedIngots.iterator();
while (it.hasNext()) {
final Item ii = it.next();
if (ii.isOnGround()) {
@@ -425,7 +435,7 @@ public class MetalClips extends MetalAbility {
ENTITY_CLIPS_COUNT.remove(this.targetEntity);
TARGET_TO_ABILITY.remove(this.targetEntity);
- this.targetEntity = (LivingEntity)e;
+ this.targetEntity = (LivingEntity) e;
TARGET_TO_ABILITY.put(this.targetEntity, this);
this.formArmor();
} else {
diff --git a/src/com/projectkorra/projectkorra/earthbending/passive/DensityShift.java b/src/com/projectkorra/projectkorra/earthbending/passive/DensityShift.java
index 00289329..fded2585 100644
--- a/src/com/projectkorra/projectkorra/earthbending/passive/DensityShift.java
+++ b/src/com/projectkorra/projectkorra/earthbending/passive/DensityShift.java
@@ -1,5 +1,14 @@
package com.projectkorra.projectkorra.earthbending.passive;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.block.BlockFace;
+import org.bukkit.entity.Player;
+
import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.EarthAbility;
@@ -8,18 +17,10 @@ import com.projectkorra.projectkorra.ability.PassiveAbility;
import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.configuration.ConfigManager;
import com.projectkorra.projectkorra.util.TempBlock;
-import com.projectkorra.projectkorra.util.TempBlock.RevertTask;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.block.BlockFace;
-import org.bukkit.entity.Player;
-
-import java.util.HashSet;
-import java.util.Set;
public class DensityShift extends EarthAbility implements PassiveAbility {
private static final Set SAND_BLOCKS = new HashSet<>();
+
public DensityShift(final Player player) {
super(player);
}
@@ -45,20 +46,13 @@ public class DensityShift extends EarthAbility implements PassiveAbility {
if (affectedBlock.getType() == Material.RED_SANDSTONE) {
sand = Material.RED_SAND;
}
-
- TempBlock tb = new TempBlock(affectedBlock, sand);
+
+ final TempBlock tb = new TempBlock(affectedBlock, sand);
if (!SAND_BLOCKS.contains(tb)) {
SAND_BLOCKS.add(tb);
tb.setRevertTime(getDuration());
- tb.setRevertTask(new RevertTask() {
-
- @Override
- public void run() {
- SAND_BLOCKS.remove(tb);
- }
-
- });
+ tb.setRevertTask(() -> SAND_BLOCKS.remove(tb));
}
}
}
@@ -105,8 +99,7 @@ public class DensityShift extends EarthAbility implements PassiveAbility {
}
@Override
- public void progress() {
- }
+ public void progress() {}
@Override
public boolean isSneakAbility() {
diff --git a/src/com/projectkorra/projectkorra/earthbending/passive/FerroControl.java b/src/com/projectkorra/projectkorra/earthbending/passive/FerroControl.java
index 7941f3c7..994235ab 100644
--- a/src/com/projectkorra/projectkorra/earthbending/passive/FerroControl.java
+++ b/src/com/projectkorra/projectkorra/earthbending/passive/FerroControl.java
@@ -21,13 +21,13 @@ public class FerroControl extends MetalAbility implements PassiveAbility {
public FerroControl(final Player player) {
super(player);
- start();
+ this.start();
}
@Override
public void progress() {
if (!this.player.isSneaking() || !this.bPlayer.canUsePassive(this) || !this.bPlayer.canBendPassive(this)) {
- remove();
+ this.remove();
return;
}
@@ -36,19 +36,19 @@ public class FerroControl extends MetalAbility implements PassiveAbility {
if (this.block != null) {
if (this.block.getType() == Material.IRON_DOOR && !GeneralMethods.isRegionProtectedFromBuild(this.player, this.block.getLocation())) {
- Door door = (Door) this.block.getBlockData();
-
+ final Door door = (Door) this.block.getBlockData();
+
door.setOpen(!door.isOpen());
this.block.setBlockData(door);
-
+
open = door.isOpen();
used = true;
} else if (this.block.getType() == Material.IRON_TRAPDOOR && !GeneralMethods.isRegionProtectedFromBuild(this.player, this.block.getLocation())) {
- TrapDoor trap = (TrapDoor) this.block.getBlockData();
-
+ final TrapDoor trap = (TrapDoor) this.block.getBlockData();
+
trap.setOpen(!trap.isOpen());
this.block.setBlockData(trap);
-
+
open = trap.isOpen();
used = true;
tDoor = true;
@@ -61,7 +61,7 @@ public class FerroControl extends MetalAbility implements PassiveAbility {
this.block.getWorld().playSound(this.block.getLocation(), Sound.valueOf(sound), 0.5f, 0);
this.bPlayer.addCooldown(this, 200);
}
- remove();
+ this.remove();
}
@Override
diff --git a/src/com/projectkorra/projectkorra/event/PlayerChangeElementEvent.java b/src/com/projectkorra/projectkorra/event/PlayerChangeElementEvent.java
index b898fb8e..0db15b8a 100644
--- a/src/com/projectkorra/projectkorra/event/PlayerChangeElementEvent.java
+++ b/src/com/projectkorra/projectkorra/event/PlayerChangeElementEvent.java
@@ -76,8 +76,7 @@ public class PlayerChangeElementEvent extends Event {
public static enum Result {
CHOOSE, REMOVE, ADD, PERMAREMOVE;
- private Result() {
- }
+ private Result() {}
}
}
diff --git a/src/com/projectkorra/projectkorra/event/PlayerChangeSubElementEvent.java b/src/com/projectkorra/projectkorra/event/PlayerChangeSubElementEvent.java
index 9dc656a8..4f648512 100644
--- a/src/com/projectkorra/projectkorra/event/PlayerChangeSubElementEvent.java
+++ b/src/com/projectkorra/projectkorra/event/PlayerChangeSubElementEvent.java
@@ -74,7 +74,6 @@ public class PlayerChangeSubElementEvent extends Event {
public static enum Result {
CHOOSE, REMOVE, ADD, PERMAREMOVE;
- private Result() {
- }
+ private Result() {}
}
}
diff --git a/src/com/projectkorra/projectkorra/firebending/Blaze.java b/src/com/projectkorra/projectkorra/firebending/Blaze.java
index 508dc033..280f85bb 100644
--- a/src/com/projectkorra/projectkorra/firebending/Blaze.java
+++ b/src/com/projectkorra/projectkorra/firebending/Blaze.java
@@ -64,8 +64,7 @@ public class Blaze extends FireAbility {
}
@Override
- public void progress() {
- }
+ public void progress() {}
@Override
public Location getLocation() {
diff --git a/src/com/projectkorra/projectkorra/firebending/BlazeArc.java b/src/com/projectkorra/projectkorra/firebending/BlazeArc.java
index 825ffa9b..94184f74 100644
--- a/src/com/projectkorra/projectkorra/firebending/BlazeArc.java
+++ b/src/com/projectkorra/projectkorra/firebending/BlazeArc.java
@@ -89,9 +89,9 @@ public class BlazeArc extends FireAbility {
return;
}
- Block ignitable = getIgnitable(block);
+ final Block ignitable = getIgnitable(block);
if (ignitable != null) {
- ignite(ignitable);
+ this.ignite(ignitable);
}
}
}
@@ -122,15 +122,15 @@ public class BlazeArc extends FireAbility {
public static Block getIgnitable(final Block block) {
Block top = block;
-
+
for (int i = 0; i < 2; i++) {
if (GeneralMethods.isSolid(top.getRelative(BlockFace.DOWN))) {
break;
}
-
+
top = top.getRelative(BlockFace.DOWN);
}
-
+
if (top.getType() == Material.FIRE) {
return top;
} else if (top.getType().isBurnable()) {
@@ -141,7 +141,7 @@ public class BlazeArc extends FireAbility {
return null;
}
}
-
+
public static boolean isIgnitable(final Player player, final Block block) {
if (!BendingPlayer.getBendingPlayer(player).hasElement(Element.FIRE)) {
return false;
diff --git a/src/com/projectkorra/projectkorra/firebending/BlazeRing.java b/src/com/projectkorra/projectkorra/firebending/BlazeRing.java
index 0879fb35..648a4248 100644
--- a/src/com/projectkorra/projectkorra/firebending/BlazeRing.java
+++ b/src/com/projectkorra/projectkorra/firebending/BlazeRing.java
@@ -59,8 +59,7 @@ public class BlazeRing extends FireAbility {
}
@Override
- public void progress() {
- }
+ public void progress() {}
@Override
public Location getLocation() {
diff --git a/src/com/projectkorra/projectkorra/firebending/FireBlast.java b/src/com/projectkorra/projectkorra/firebending/FireBlast.java
index b3eff2dc..4042ea91 100644
--- a/src/com/projectkorra/projectkorra/firebending/FireBlast.java
+++ b/src/com/projectkorra/projectkorra/firebending/FireBlast.java
@@ -1,5 +1,19 @@
package com.projectkorra.projectkorra.firebending;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.block.BlockFace;
+import org.bukkit.block.Furnace;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.util.Vector;
+
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.ability.AirAbility;
@@ -12,19 +26,6 @@ import com.projectkorra.projectkorra.firebending.util.FireDamageTimer;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.ParticleEffect;
import com.projectkorra.projectkorra.waterbending.plant.PlantRegrowth;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.block.BlockFace;
-import org.bukkit.block.Furnace;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.util.Vector;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
public class FireBlast extends FireAbility {
diff --git a/src/com/projectkorra/projectkorra/firebending/FireBlastCharged.java b/src/com/projectkorra/projectkorra/firebending/FireBlastCharged.java
index af2afac1..3702a830 100644
--- a/src/com/projectkorra/projectkorra/firebending/FireBlastCharged.java
+++ b/src/com/projectkorra/projectkorra/firebending/FireBlastCharged.java
@@ -310,9 +310,9 @@ public class FireBlastCharged extends FireAbility {
@Override
public void remove() {
super.remove();
- bPlayer.addCooldown(this);
+ this.bPlayer.addCooldown(this);
}
-
+
@Override
public String getName() {
return "FireBlast";
@@ -325,7 +325,7 @@ public class FireBlastCharged extends FireAbility {
@Override
public long getCooldown() {
- return cooldown;
+ return this.cooldown;
}
@Override
diff --git a/src/com/projectkorra/projectkorra/firebending/FireJet.java b/src/com/projectkorra/projectkorra/firebending/FireJet.java
index 6d19de01..0f492483 100644
--- a/src/com/projectkorra/projectkorra/firebending/FireJet.java
+++ b/src/com/projectkorra/projectkorra/firebending/FireJet.java
@@ -1,19 +1,20 @@
package com.projectkorra.projectkorra.firebending;
-import com.projectkorra.projectkorra.ability.ElementalAbility;
-import com.projectkorra.projectkorra.ability.FireAbility;
-import com.projectkorra.projectkorra.airbending.AirSpout;
-import com.projectkorra.projectkorra.attribute.Attribute;
-import com.projectkorra.projectkorra.util.ParticleEffect;
+import static com.projectkorra.projectkorra.firebending.Illumination.isIlluminationTorch;
+
+import java.util.Random;
+
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
-import java.util.Random;
-
-import static com.projectkorra.projectkorra.firebending.Illumination.isIlluminationTorch;
+import com.projectkorra.projectkorra.ability.ElementalAbility;
+import com.projectkorra.projectkorra.ability.FireAbility;
+import com.projectkorra.projectkorra.airbending.AirSpout;
+import com.projectkorra.projectkorra.attribute.Attribute;
+import com.projectkorra.projectkorra.util.ParticleEffect;
public class FireJet extends FireAbility {
@@ -56,17 +57,7 @@ public class FireJet extends FireAbility {
this.speed = this.getDayFactor(this.speed);
final Block block = player.getLocation().getBlock();
- if (BlazeArc.isIgnitable(player, block) ||
- ElementalAbility.isAir(block.getType()) ||
- block.getType() == Material.STONE_SLAB ||
- block.getType() == Material.ACACIA_SLAB ||
- block.getType() == Material.BIRCH_SLAB ||
- block.getType() == Material.DARK_OAK_SLAB ||
- block.getType() == Material.JUNGLE_SLAB ||
- block.getType() == Material.OAK_SLAB ||
- block.getType() == Material.SPRUCE_SLAB ||
- isIlluminationTorch(block) ||
- this.bPlayer.isAvatarState()) {
+ if (BlazeArc.isIgnitable(player, block) || ElementalAbility.isAir(block.getType()) || block.getType() == Material.STONE_SLAB || block.getType() == Material.ACACIA_SLAB || block.getType() == Material.BIRCH_SLAB || block.getType() == Material.DARK_OAK_SLAB || block.getType() == Material.JUNGLE_SLAB || block.getType() == Material.OAK_SLAB || block.getType() == Material.SPRUCE_SLAB || isIlluminationTorch(block) || this.bPlayer.isAvatarState()) {
player.setVelocity(player.getEyeLocation().getDirection().clone().normalize().multiply(this.speed));
if (!canFireGrief()) {
if (ElementalAbility.isAir(block.getType())) {
@@ -77,13 +68,13 @@ public class FireJet extends FireAbility {
block.setType(Material.FIRE);
}
- flightHandler.createInstance(player, this.getName());
+ this.flightHandler.createInstance(player, this.getName());
player.setAllowFlight(true);
this.time = System.currentTimeMillis();
this.start();
- if (showGliding) {
- previousGlidingState = player.isGliding();
+ if (this.showGliding) {
+ this.previousGlidingState = player.isGliding();
player.setGliding(true);
}
this.bPlayer.addCooldown(this);
@@ -122,10 +113,10 @@ public class FireJet extends FireAbility {
@Override
public void remove() {
super.remove();
- if (showGliding) {
- this.player.setGliding(previousGlidingState);
+ if (this.showGliding) {
+ this.player.setGliding(this.previousGlidingState);
}
- flightHandler.removeInstance(this.player, this.getName());
+ this.flightHandler.removeInstance(this.player, this.getName());
this.player.setFallDistance(0);
}
diff --git a/src/com/projectkorra/projectkorra/firebending/FireManipulation.java b/src/com/projectkorra/projectkorra/firebending/FireManipulation.java
index 0ccc2abf..63d63a57 100644
--- a/src/com/projectkorra/projectkorra/firebending/FireManipulation.java
+++ b/src/com/projectkorra/projectkorra/firebending/FireManipulation.java
@@ -144,7 +144,7 @@ public class FireManipulation extends FireAbility {
final Vector direction = this.focalPoint.toVector().subtract(point.toVector());
point.add(direction.clone().multiply(this.streamSpeed / 5));
ParticleEffect.FLAME.display(point, this.shieldParticles, 0.25, 0.25, 0.25);
- ParticleEffect.SMOKE_NORMAL.display(point, this.shieldParticles/2, 0.25, 0.25, 0.25);
+ ParticleEffect.SMOKE_NORMAL.display(point, this.shieldParticles / 2, 0.25, 0.25, 0.25);
}
} else {
Vector direction = this.player.getLocation().getDirection().clone();
@@ -174,7 +174,7 @@ public class FireManipulation extends FireAbility {
}
ParticleEffect.FLAME.display(this.shotPoint, this.streamParticles, 0.5, 0.5, 0.5, 0.01);
- ParticleEffect.SMOKE_NORMAL.display(this.shotPoint, this.streamParticles/2, 0.5, 0.5, 0.5, 0.01);
+ ParticleEffect.SMOKE_NORMAL.display(this.shotPoint, this.streamParticles / 2, 0.5, 0.5, 0.5, 0.01);
for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(this.shotPoint, 2)) {
if (entity instanceof LivingEntity && entity.getUniqueId() != this.player.getUniqueId()) {
DamageHandler.damageEntity(entity, this.streamDamage, this);
@@ -214,7 +214,7 @@ public class FireManipulation extends FireAbility {
@Override
public List getLocations() {
final List locations = new ArrayList<>();
- if (points != null) {
+ if (this.points != null) {
locations.addAll(this.points.keySet());
}
return locations;
diff --git a/src/com/projectkorra/projectkorra/firebending/FireShield.java b/src/com/projectkorra/projectkorra/firebending/FireShield.java
index be5596b5..1c7ddc0c 100644
--- a/src/com/projectkorra/projectkorra/firebending/FireShield.java
+++ b/src/com/projectkorra/projectkorra/firebending/FireShield.java
@@ -1,11 +1,7 @@
package com.projectkorra.projectkorra.firebending;
-import com.projectkorra.projectkorra.GeneralMethods;
-import com.projectkorra.projectkorra.ability.FireAbility;
-import com.projectkorra.projectkorra.ability.util.Collision;
-import com.projectkorra.projectkorra.attribute.Attribute;
-import com.projectkorra.projectkorra.firebending.util.FireDamageTimer;
-import com.projectkorra.projectkorra.util.ParticleEffect;
+import java.util.Random;
+
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -16,7 +12,12 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.util.Vector;
-import java.util.Random;
+import com.projectkorra.projectkorra.GeneralMethods;
+import com.projectkorra.projectkorra.ability.FireAbility;
+import com.projectkorra.projectkorra.ability.util.Collision;
+import com.projectkorra.projectkorra.attribute.Attribute;
+import com.projectkorra.projectkorra.firebending.util.FireDamageTimer;
+import com.projectkorra.projectkorra.util.ParticleEffect;
public class FireShield extends FireAbility {
diff --git a/src/com/projectkorra/projectkorra/firebending/HeatControl.java b/src/com/projectkorra/projectkorra/firebending/HeatControl.java
index 180ef20d..6cbf61b8 100644
--- a/src/com/projectkorra/projectkorra/firebending/HeatControl.java
+++ b/src/com/projectkorra/projectkorra/firebending/HeatControl.java
@@ -1,5 +1,26 @@
package com.projectkorra.projectkorra.firebending;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.Set;
+
+import org.bukkit.Effect;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.block.Block;
+import org.bukkit.block.data.Levelled;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.scheduler.BukkitRunnable;
+import org.bukkit.util.Vector;
+
import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ProjectKorra;
@@ -15,18 +36,6 @@ import com.projectkorra.projectkorra.waterbending.WaterSpoutWave;
import com.projectkorra.projectkorra.waterbending.combo.IceWave;
import com.projectkorra.projectkorra.waterbending.ice.PhaseChange;
import com.projectkorra.projectkorra.waterbending.multiabilities.WaterArmsSpear;
-import org.bukkit.Effect;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.Sound;
-import org.bukkit.block.Block;
-import org.bukkit.block.data.Levelled;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.scheduler.BukkitRunnable;
-import org.bukkit.util.Vector;
-
-import java.util.*;
public class HeatControl extends FireAbility {
@@ -328,7 +337,7 @@ public class HeatControl extends FireAbility {
new BukkitRunnable() {
@Override
public void run() {
- TempBlock melted = MELTED_BLOCKS.get(block);
+ final TempBlock melted = MELTED_BLOCKS.get(block);
if (melted != null) {
melted.revertBlock();
}
@@ -359,7 +368,7 @@ public class HeatControl extends FireAbility {
final Block b = lava.get(this.randy.nextInt(lava.size()));
- Material tempRevertMaterial = Material.MAGMA_BLOCK;
+ final Material tempRevertMaterial = Material.MAGMA_BLOCK;
final TempBlock tempBlock;
if (TempBlock.isTempBlock(b)) {
diff --git a/src/com/projectkorra/projectkorra/firebending/combo/FireComboStream.java b/src/com/projectkorra/projectkorra/firebending/combo/FireComboStream.java
index d1eb4d51..dd11a98c 100644
--- a/src/com/projectkorra/projectkorra/firebending/combo/FireComboStream.java
+++ b/src/com/projectkorra/projectkorra/firebending/combo/FireComboStream.java
@@ -1,15 +1,8 @@
package com.projectkorra.projectkorra.firebending.combo;
-import com.projectkorra.projectkorra.BendingPlayer;
-import com.projectkorra.projectkorra.GeneralMethods;
-import com.projectkorra.projectkorra.ability.CoreAbility;
-import com.projectkorra.projectkorra.ability.ElementalAbility;
-import com.projectkorra.projectkorra.command.Commands;
-import com.projectkorra.projectkorra.firebending.util.FireDamageTimer;
-import com.projectkorra.projectkorra.util.DamageHandler;
-import com.projectkorra.projectkorra.util.ParticleEffect;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
+
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Sound;
@@ -21,6 +14,15 @@ import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
+import com.projectkorra.projectkorra.BendingPlayer;
+import com.projectkorra.projectkorra.GeneralMethods;
+import com.projectkorra.projectkorra.ability.CoreAbility;
+import com.projectkorra.projectkorra.ability.ElementalAbility;
+import com.projectkorra.projectkorra.command.Commands;
+import com.projectkorra.projectkorra.firebending.util.FireDamageTimer;
+import com.projectkorra.projectkorra.util.DamageHandler;
+import com.projectkorra.projectkorra.util.ParticleEffect;
+
/***
* Is only here for legacy purposes. All fire combos used to use a form of this
* stream for all their progress methods. If someone else was reliant on that,
@@ -170,6 +172,7 @@ public class FireComboStream extends BukkitRunnable {
return this.location;
}
+ @Override
public boolean isCancelled() {
return this.cancelled;
}
@@ -228,8 +231,7 @@ public class FireComboStream extends BukkitRunnable {
}
@Override
- public String toString()
- {
+ public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
diff --git a/src/com/projectkorra/projectkorra/firebending/combo/FireWheel.java b/src/com/projectkorra/projectkorra/firebending/combo/FireWheel.java
index 0db95cca..fcbbda38 100644
--- a/src/com/projectkorra/projectkorra/firebending/combo/FireWheel.java
+++ b/src/com/projectkorra/projectkorra/firebending/combo/FireWheel.java
@@ -1,5 +1,17 @@
package com.projectkorra.projectkorra.firebending.combo;
+import java.util.ArrayList;
+
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.block.Block;
+import org.bukkit.block.BlockFace;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.util.Vector;
+
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.ComboAbility;
import com.projectkorra.projectkorra.ability.ElementalAbility;
@@ -10,17 +22,6 @@ import com.projectkorra.projectkorra.firebending.util.FireDamageTimer;
import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.ParticleEffect;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.Sound;
-import org.bukkit.block.Block;
-import org.bukkit.block.BlockFace;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.util.Vector;
-
-import java.util.ArrayList;
public class FireWheel extends FireAbility implements ComboAbility {
diff --git a/src/com/projectkorra/projectkorra/firebending/combo/JetBlast.java b/src/com/projectkorra/projectkorra/firebending/combo/JetBlast.java
index 2264d9d0..3642ef7d 100644
--- a/src/com/projectkorra/projectkorra/firebending/combo/JetBlast.java
+++ b/src/com/projectkorra/projectkorra/firebending/combo/JetBlast.java
@@ -102,7 +102,7 @@ public class JetBlast extends FireAbility implements ComboAbility {
@Override
public void remove() {
- for(FireComboStream task : tasks) {
+ for (final FireComboStream task : this.tasks) {
task.remove();
}
super.remove();
diff --git a/src/com/projectkorra/projectkorra/firebending/combo/JetBlaze.java b/src/com/projectkorra/projectkorra/firebending/combo/JetBlaze.java
index 1e0cb163..f860aa7a 100644
--- a/src/com/projectkorra/projectkorra/firebending/combo/JetBlaze.java
+++ b/src/com/projectkorra/projectkorra/firebending/combo/JetBlaze.java
@@ -117,7 +117,7 @@ public class JetBlaze extends FireAbility implements ComboAbility {
@Override
public void remove() {
- for(FireComboStream task : tasks) {
+ for (final FireComboStream task : this.tasks) {
task.remove();
}
super.remove();
diff --git a/src/com/projectkorra/projectkorra/firebending/combustion/Combustion.java b/src/com/projectkorra/projectkorra/firebending/combustion/Combustion.java
index 97402d75..000884ef 100644
--- a/src/com/projectkorra/projectkorra/firebending/combustion/Combustion.java
+++ b/src/com/projectkorra/projectkorra/firebending/combustion/Combustion.java
@@ -1,5 +1,12 @@
package com.projectkorra.projectkorra.firebending.combustion;
+import org.bukkit.Location;
+import org.bukkit.block.Block;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.util.Vector;
+
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.ability.AirAbility;
@@ -10,12 +17,6 @@ import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.avatar.AvatarState;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.ParticleEffect;
-import org.bukkit.Location;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.util.Vector;
public class Combustion extends CombustionAbility {
diff --git a/src/com/projectkorra/projectkorra/hooks/PlaceholderAPIHook.java b/src/com/projectkorra/projectkorra/hooks/PlaceholderAPIHook.java
index 470a8cb5..29d50c2f 100644
--- a/src/com/projectkorra/projectkorra/hooks/PlaceholderAPIHook.java
+++ b/src/com/projectkorra/projectkorra/hooks/PlaceholderAPIHook.java
@@ -1,28 +1,32 @@
package com.projectkorra.projectkorra.hooks;
+import static java.util.stream.Collectors.joining;
+
+import org.bukkit.ChatColor;
+import org.bukkit.entity.Player;
+
import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.ability.CoreAbility;
import com.projectkorra.projectkorra.configuration.ConfigManager;
-import me.clip.placeholderapi.expansion.PlaceholderExpansion;
-import org.bukkit.ChatColor;
-import org.bukkit.entity.Player;
-import static java.util.stream.Collectors.joining;
+import me.clip.placeholderapi.expansion.PlaceholderExpansion;
public class PlaceholderAPIHook extends PlaceholderExpansion {
- private ProjectKorra plugin;
+ private final ProjectKorra plugin;
- public PlaceholderAPIHook(ProjectKorra plugin) {
+ public PlaceholderAPIHook(final ProjectKorra plugin) {
this.plugin = plugin;
}
@Override
- public String onPlaceholderRequest(Player player, String params) {
- BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
- if (bPlayer == null) { return ""; }
+ public String onPlaceholderRequest(final Player player, final String params) {
+ final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
+ if (bPlayer == null) {
+ return "";
+ }
if (params.startsWith("slot")) {
final String ability = bPlayer.getAbilities().get(Integer.parseInt(params.substring(params.length() - 1)));
@@ -44,7 +48,7 @@ public class PlaceholderAPIHook extends PlaceholderExpansion {
final String element = ConfigManager.languageConfig.get().getString("Chat.Prefixes." + e);
if (params.equals("element")) {
return c + element + ChatColor.RESET;
- } else if(params.equals("elementcolor")) {
+ } else if (params.equals("elementcolor")) {
return c + "";
}
} else if (params.equals("elements")) {
@@ -55,27 +59,27 @@ public class PlaceholderAPIHook extends PlaceholderExpansion {
}
@Override
- public boolean persist(){
+ public boolean persist() {
return true;
}
@Override
- public boolean canRegister(){
+ public boolean canRegister() {
return true;
}
@Override
- public String getAuthor(){
- return plugin.getDescription().getAuthors().toString();
+ public String getAuthor() {
+ return this.plugin.getDescription().getAuthors().toString();
}
@Override
- public String getIdentifier(){
+ public String getIdentifier() {
return "ProjectKorra";
}
@Override
- public String getVersion(){
- return plugin.getDescription().getVersion();
+ public String getVersion() {
+ return this.plugin.getDescription().getVersion();
}
}
diff --git a/src/com/projectkorra/projectkorra/hooks/WorldGuardFlag.java b/src/com/projectkorra/projectkorra/hooks/WorldGuardFlag.java
index e91584d5..0614adda 100644
--- a/src/com/projectkorra/projectkorra/hooks/WorldGuardFlag.java
+++ b/src/com/projectkorra/projectkorra/hooks/WorldGuardFlag.java
@@ -1,17 +1,18 @@
package com.projectkorra.projectkorra.hooks;
-import com.projectkorra.projectkorra.ProjectKorra;
import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.protection.flags.StateFlag;
import com.sk89q.worldguard.protection.flags.registry.FlagConflictException;
import com.sk89q.worldguard.protection.flags.registry.FlagRegistry;
+import com.projectkorra.projectkorra.ProjectKorra;
+
public class WorldGuardFlag {
public static void registerBendingWorldGuardFlag() {
- FlagRegistry registry = WorldGuard.getInstance().getFlagRegistry();
+ final FlagRegistry registry = WorldGuard.getInstance().getFlagRegistry();
try {
registry.register(new StateFlag("bending", false));
- } catch (FlagConflictException e) {
+ } catch (final FlagConflictException e) {
ProjectKorra.log.severe("unable to register bending WorldGuard Flag");
}
}
diff --git a/src/com/projectkorra/projectkorra/object/HorizontalVelocityTracker.java b/src/com/projectkorra/projectkorra/object/HorizontalVelocityTracker.java
index 81a88de9..7a9cb453 100644
--- a/src/com/projectkorra/projectkorra/object/HorizontalVelocityTracker.java
+++ b/src/com/projectkorra/projectkorra/object/HorizontalVelocityTracker.java
@@ -6,6 +6,7 @@ import java.util.concurrent.ConcurrentHashMap;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
+
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
@@ -140,8 +141,7 @@ public class HorizontalVelocityTracker {
}
@Override
- public String toString()
- {
+ public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
diff --git a/src/com/projectkorra/projectkorra/object/Preset.java b/src/com/projectkorra/projectkorra/object/Preset.java
index bc82b77c..f57cf592 100644
--- a/src/com/projectkorra/projectkorra/object/Preset.java
+++ b/src/com/projectkorra/projectkorra/object/Preset.java
@@ -103,12 +103,10 @@ public class Preset {
}
new Preset(uuid, rs.getString("name"), moves);
i++;
- }
- while (rs.next());
+ } while (rs.next());
ProjectKorra.log.info("Loaded " + i + " presets for " + player.getName());
}
- }
- catch (final SQLException ex) {
+ } catch (final SQLException ex) {
ex.printStackTrace();
}
}
@@ -273,8 +271,7 @@ public class Preset {
ps.setString(2, this.name);
ps.execute();
presets.get(this.uuid).remove(this);
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
}
}
@@ -303,8 +300,7 @@ public class Preset {
ps.setString(2, this.name);
ps.execute();
}
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
}
for (final Integer i : this.abilities.keySet()) {
@@ -319,8 +315,7 @@ public class Preset {
this.ps.setString(2, Preset.this.uuid.toString());
this.ps.setString(3, Preset.this.name);
this.ps.execute();
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
}
}
@@ -334,8 +329,7 @@ public class Preset {
try {
Thread.sleep(1500);
reloadPreset(player);
- }
- catch (final InterruptedException e) {
+ } catch (final InterruptedException e) {
e.printStackTrace();
}
}
diff --git a/src/com/projectkorra/projectkorra/storage/DBConnection.java b/src/com/projectkorra/projectkorra/storage/DBConnection.java
index a1dc1e57..e1f32d1a 100644
--- a/src/com/projectkorra/projectkorra/storage/DBConnection.java
+++ b/src/com/projectkorra/projectkorra/storage/DBConnection.java
@@ -1,12 +1,12 @@
package com.projectkorra.projectkorra.storage;
+import java.sql.DatabaseMetaData;
+import java.sql.SQLException;
+
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.configuration.ConfigManager;
-import java.sql.DatabaseMetaData;
-import java.sql.SQLException;
-
public class DBConnection {
public static Database sql;
@@ -49,8 +49,7 @@ public class DBConnection {
sql.getConnection().setAutoCommit(true);
ProjectKorra.log.info("Database Updated.");
}
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
}
}
@@ -94,8 +93,7 @@ public class DBConnection {
ProjectKorra.log.info("Database Updated.");
}
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
}
}
diff --git a/src/com/projectkorra/projectkorra/storage/Database.java b/src/com/projectkorra/projectkorra/storage/Database.java
index efa2d52e..75352a48 100644
--- a/src/com/projectkorra/projectkorra/storage/Database.java
+++ b/src/com/projectkorra/projectkorra/storage/Database.java
@@ -71,8 +71,7 @@ public abstract class Database {
if (this.connection != null) {
try {
this.connection.close();
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
}
} else {
@@ -124,8 +123,7 @@ public abstract class Database {
final ResultSet rs = stmt.executeQuery();
return rs;
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
return null;
}
@@ -146,8 +144,7 @@ public abstract class Database {
final ResultSet rs = dmd.getTables(null, null, table, null);
return rs.next();
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
return false;
}
@@ -168,8 +165,7 @@ public abstract class Database {
final DatabaseMetaData dmd = this.connection.getMetaData();
final ResultSet rs = dmd.getColumns(null, null, table, column);
return rs.next();
- }
- catch (final Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
return false;
}
@@ -183,8 +179,7 @@ public abstract class Database {
final PreparedStatement stmt = this.connection.prepareStatement(query);
stmt.execute();
stmt.close();
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
}
}
diff --git a/src/com/projectkorra/projectkorra/storage/MySQL.java b/src/com/projectkorra/projectkorra/storage/MySQL.java
index cbf49015..a0a869cb 100644
--- a/src/com/projectkorra/projectkorra/storage/MySQL.java
+++ b/src/com/projectkorra/projectkorra/storage/MySQL.java
@@ -40,12 +40,10 @@ public class MySQL extends Database {
this.printInfo("Connection established!");
return this.connection;
- }
- catch (final ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
this.printErr("JDBC driver not found!", true);
return null;
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
this.printErr("MYSQL exception during connection.", true);
return null;
diff --git a/src/com/projectkorra/projectkorra/storage/SQLite.java b/src/com/projectkorra/projectkorra/storage/SQLite.java
index a891d109..82c22669 100644
--- a/src/com/projectkorra/projectkorra/storage/SQLite.java
+++ b/src/com/projectkorra/projectkorra/storage/SQLite.java
@@ -34,12 +34,10 @@ public class SQLite extends Database {
this.printInfo("Connection established!");
return this.connection;
- }
- catch (final ClassNotFoundException e) {
+ } catch (final ClassNotFoundException e) {
this.printErr("JDBC driver not found!", true);
return null;
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
this.printErr("SQLite exception during connection.", true);
return null;
}
diff --git a/src/com/projectkorra/projectkorra/util/ActionBar.java b/src/com/projectkorra/projectkorra/util/ActionBar.java
index 24fa7120..90579d76 100644
--- a/src/com/projectkorra/projectkorra/util/ActionBar.java
+++ b/src/com/projectkorra/projectkorra/util/ActionBar.java
@@ -31,8 +31,7 @@ public class ActionBar {
playerConnection = ReflectionHandler.getField("EntityPlayer", PackageType.MINECRAFT_SERVER, false, "playerConnection");
sendPacket = ReflectionHandler.getMethod(playerConnection.getType(), "sendPacket", PackageType.MINECRAFT_SERVER.getClass("Packet"));
initialised = true;
- }
- catch (final ReflectiveOperationException e) {
+ } catch (final ReflectiveOperationException e) {
initialised = false;
}
}
@@ -54,8 +53,7 @@ public class ActionBar {
packet = packetChat.newInstance(o, (byte) 2);
}
sendTo(packet, player);
- }
- catch (final ReflectiveOperationException e) {
+ } catch (final ReflectiveOperationException e) {
e.printStackTrace();
initialised = false;
}
diff --git a/src/com/projectkorra/projectkorra/util/BlockSource.java b/src/com/projectkorra/projectkorra/util/BlockSource.java
index d156313e..5a56abbb 100644
--- a/src/com/projectkorra/projectkorra/util/BlockSource.java
+++ b/src/com/projectkorra/projectkorra/util/BlockSource.java
@@ -1,17 +1,18 @@
package com.projectkorra.projectkorra.util;
+import java.util.HashMap;
+
+import org.bukkit.Location;
+import org.bukkit.block.Block;
+import org.bukkit.configuration.file.FileConfiguration;
+import org.bukkit.entity.Player;
+
import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.ability.CoreAbility;
import com.projectkorra.projectkorra.ability.EarthAbility;
import com.projectkorra.projectkorra.ability.ElementalAbility;
import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.configuration.ConfigManager;
-import org.bukkit.Location;
-import org.bukkit.block.Block;
-import org.bukkit.configuration.file.FileConfiguration;
-import org.bukkit.entity.Player;
-
-import java.util.HashMap;
/**
* BlockSource is a class that handles water and earth bending sources. When a
diff --git a/src/com/projectkorra/projectkorra/util/ColoredParticle.java b/src/com/projectkorra/projectkorra/util/ColoredParticle.java
index 70861452..91672cdd 100644
--- a/src/com/projectkorra/projectkorra/util/ColoredParticle.java
+++ b/src/com/projectkorra/projectkorra/util/ColoredParticle.java
@@ -6,17 +6,17 @@ import org.bukkit.Particle.DustOptions;
public class ColoredParticle {
- private DustOptions dust;
-
- public ColoredParticle(Color color, float size) {
- dust = new DustOptions(color, size);
+ private final DustOptions dust;
+
+ public ColoredParticle(final Color color, final float size) {
+ this.dust = new DustOptions(color, size);
}
-
+
public DustOptions getDustOptions() {
- return dust;
+ return this.dust;
}
-
- public void display(Location loc, int amount, double offsetX, double offsetY, double offsetZ) {
- ParticleEffect.REDSTONE.display(loc, amount, offsetX, offsetY, offsetZ, dust);
+
+ public void display(final Location loc, final int amount, final double offsetX, final double offsetY, final double offsetZ) {
+ ParticleEffect.REDSTONE.display(loc, amount, offsetX, offsetY, offsetZ, this.dust);
}
}
diff --git a/src/com/projectkorra/projectkorra/util/DBCooldownManager.java b/src/com/projectkorra/projectkorra/util/DBCooldownManager.java
index 03216568..07db9daf 100644
--- a/src/com/projectkorra/projectkorra/util/DBCooldownManager.java
+++ b/src/com/projectkorra/projectkorra/util/DBCooldownManager.java
@@ -1,17 +1,16 @@
package com.projectkorra.projectkorra.util;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
import com.projectkorra.projectkorra.Manager;
import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.storage.DBConnection;
import com.projectkorra.projectkorra.storage.MySQL;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
public class DBCooldownManager extends Manager {
- private DBCooldownManager() {
- }
+ private DBCooldownManager() {}
@Override
public void onActivate() {
@@ -47,8 +46,7 @@ public class DBCooldownManager extends Manager {
DBConnection.sql.modifyQuery("INSERT INTO pk_cooldown_ids (cooldown_name) VALUES ('" + cooldown + "')", async);
return this.getCooldownId(cooldown, async);
}
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
}
return -1;
@@ -59,8 +57,7 @@ public class DBCooldownManager extends Manager {
if (rs.next()) {
return rs.getString("cooldown_name");
}
- }
- catch (final SQLException e) {
+ } catch (final SQLException e) {
e.printStackTrace();
}
return "";
diff --git a/src/com/projectkorra/projectkorra/util/FlightHandler.java b/src/com/projectkorra/projectkorra/util/FlightHandler.java
index 359f78ff..07cf029c 100644
--- a/src/com/projectkorra/projectkorra/util/FlightHandler.java
+++ b/src/com/projectkorra/projectkorra/util/FlightHandler.java
@@ -1,6 +1,5 @@
package com.projectkorra.projectkorra.util;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.PriorityQueue;
@@ -23,15 +22,9 @@ public class FlightHandler extends Manager {
* duration. This is used to reduce the number of iterations when cleaning
* up dead instances.
*/
- private final PriorityQueue CLEANUP = new PriorityQueue<>(100, new Comparator() {
- @Override
- public int compare(final FlightAbility f1, final FlightAbility f2) {
- return (int) (f1.duration - f2.duration);
- }
- });
+ private final PriorityQueue CLEANUP = new PriorityQueue<>(100, (f1, f2) -> (int) (f1.duration - f2.duration));
- private FlightHandler() {
- }
+ private FlightHandler() {}
@Override
public void onActivate() {
diff --git a/src/com/projectkorra/projectkorra/util/Metrics.java b/src/com/projectkorra/projectkorra/util/Metrics.java
index 693defee..25f1f579 100644
--- a/src/com/projectkorra/projectkorra/util/Metrics.java
+++ b/src/com/projectkorra/projectkorra/util/Metrics.java
@@ -19,12 +19,13 @@ import java.util.zip.GZIPOutputStream;
import javax.net.ssl.HttpsURLConnection;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.ServicePriority;
import org.bukkit.plugin.java.JavaPlugin;
-import org.json.simple.JSONArray;
-import org.json.simple.JSONObject;
/**
* bStats collects some data for plugin authors.
@@ -91,9 +92,7 @@ public class Metrics {
config.options().header("bStats collects some data for plugin authors like how many servers are using their plugins.\n" + "To honor their work, you should not disable it.\n" + "This has nearly no effect on the server performance!\n" + "Check out https://bStats.org/ to learn more :)").copyDefaults(true);
try {
config.save(configFile);
- }
- catch (final IOException ignored) {
- }
+ } catch (final IOException ignored) {}
}
// Load the data.
@@ -107,9 +106,7 @@ public class Metrics {
service.getField("B_STATS_VERSION"); // Our identifier :)
found = true; // We aren't the first.
break;
- }
- catch (final NoSuchFieldException ignored) {
- }
+ } catch (final NoSuchFieldException ignored) {}
}
// Register our service.
Bukkit.getServicesManager().register(Metrics.class, this, plugin, ServicePriority.Normal);
@@ -146,12 +143,7 @@ public class Metrics {
}
// Nevertheless we want our code to run in the Bukkit main thread, so we have to use the Bukkit scheduler.
// Don't be afraid! The connection to the bStats server is still async, only the stats collection is sync.
- Bukkit.getScheduler().runTask(Metrics.this.plugin, new Runnable() {
- @Override
- public void run() {
- Metrics.this.submitData();
- }
- });
+ Bukkit.getScheduler().runTask(Metrics.this.plugin, (Runnable) () -> Metrics.this.submitData());
}
}, 1000 * 60 * 5, 1000 * 60 * 30);
// Submit the data every 30 minutes, first time after 5 minutes to give other plugins enough time to start.
@@ -233,33 +225,26 @@ public class Metrics {
for (final Class> service : Bukkit.getServicesManager().getKnownServices()) {
try {
service.getField("B_STATS_VERSION"); // Our identifier.
- }
- catch (final NoSuchFieldException ignored) {
+ } catch (final NoSuchFieldException ignored) {
continue; // Continue "searching".
}
// Found one!
try {
pluginData.add(service.getMethod("getPluginData").invoke(Bukkit.getServicesManager().load(service)));
- }
- catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) {
- }
+ } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) {}
}
data.put("plugins", pluginData);
// Create a new thread for the connection to the bStats server.
- new Thread(new Runnable() {
- @Override
- public void run() {
- try {
- // Send the data.
- sendData(data);
- }
- catch (final Exception e) {
- // Something went wrong! :(
- if (logFailedRequests) {
- Metrics.this.plugin.getLogger().log(Level.WARNING, "Could not submit plugin stats of " + Metrics.this.plugin.getName(), e);
- }
+ new Thread(() -> {
+ try {
+ // Send the data.
+ sendData(data);
+ } catch (final Exception e) {
+ // Something went wrong! :(
+ if (logFailedRequests) {
+ Metrics.this.plugin.getLogger().log(Level.WARNING, "Could not submit plugin stats of " + Metrics.this.plugin.getName(), e);
}
}
}).start();
@@ -350,8 +335,7 @@ public class Metrics {
return null;
}
chart.put("data", data);
- }
- catch (final Throwable t) {
+ } catch (final Throwable t) {
if (logFailedRequests) {
Bukkit.getLogger().log(Level.WARNING, "Failed to get data for custom chart with id " + this.chartId, t);
}
diff --git a/src/com/projectkorra/projectkorra/util/MovementHandler.java b/src/com/projectkorra/projectkorra/util/MovementHandler.java
index 5f30b374..61b1d621 100644
--- a/src/com/projectkorra/projectkorra/util/MovementHandler.java
+++ b/src/com/projectkorra/projectkorra/util/MovementHandler.java
@@ -1,15 +1,16 @@
package com.projectkorra.projectkorra.util;
-import com.projectkorra.projectkorra.ProjectKorra;
-import com.projectkorra.projectkorra.ability.CoreAbility;
+import java.util.HashSet;
+import java.util.Set;
+
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.scheduler.BukkitRunnable;
-import java.util.HashSet;
-import java.util.Set;
+import com.projectkorra.projectkorra.ProjectKorra;
+import com.projectkorra.projectkorra.ability.CoreAbility;
/**
* An object to control how an entity moves.
@@ -129,7 +130,7 @@ public class MovementHandler {
if (this.runnable != null) {
try {
this.runnable.cancel();
- } catch (IllegalStateException e) { //if a player hasn't landed on the ground yet this runnable wont be scheduled, and will give an error on server shutdown
+ } catch (final IllegalStateException e) { //if a player hasn't landed on the ground yet this runnable wont be scheduled, and will give an error on server shutdown
this.runnable = null;
}
}
diff --git a/src/com/projectkorra/projectkorra/util/ParticleEffect.java b/src/com/projectkorra/projectkorra/util/ParticleEffect.java
index ab050153..92b9538b 100644
--- a/src/com/projectkorra/projectkorra/util/ParticleEffect.java
+++ b/src/com/projectkorra/projectkorra/util/ParticleEffect.java
@@ -2,9 +2,10 @@ package com.projectkorra.projectkorra.util;
import org.bukkit.Location;
import org.bukkit.Particle;
+import org.bukkit.Particle.DustOptions;
+import org.bukkit.inventory.ItemStack;
public enum ParticleEffect {
-
BARRIER (Particle.BARRIER),
/**
diff --git a/src/com/projectkorra/projectkorra/util/ReflectionHandler.java b/src/com/projectkorra/projectkorra/util/ReflectionHandler.java
index 04f7d261..d83c87a9 100644
--- a/src/com/projectkorra/projectkorra/util/ReflectionHandler.java
+++ b/src/com/projectkorra/projectkorra/util/ReflectionHandler.java
@@ -30,8 +30,7 @@ import org.bukkit.Bukkit;
*/
public final class ReflectionHandler {
// Prevent accidental construction.
- private ReflectionHandler() {
- }
+ private ReflectionHandler() {}
/**
* Returns the constructor of a given class with the given parameter types
diff --git a/src/com/projectkorra/projectkorra/util/RevertChecker.java b/src/com/projectkorra/projectkorra/util/RevertChecker.java
index 4d5502da..df122483 100644
--- a/src/com/projectkorra/projectkorra/util/RevertChecker.java
+++ b/src/com/projectkorra/projectkorra/util/RevertChecker.java
@@ -8,7 +8,6 @@ import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Future;
-import io.papermc.lib.PaperLib;
import org.bukkit.Server;
import org.bukkit.block.Block;
import org.bukkit.configuration.file.FileConfiguration;
@@ -18,6 +17,8 @@ import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.ability.EarthAbility;
import com.projectkorra.projectkorra.configuration.ConfigManager;
+import io.papermc.lib.PaperLib;
+
public class RevertChecker implements Runnable {
private final ProjectKorra plugin;
@@ -35,23 +36,19 @@ public class RevertChecker implements Runnable {
public static void revertAirBlocks() {
for (final int ID : airRevertQueue.keySet()) {
- PaperLib.getChunkAtAsync(EarthAbility.getTempAirLocations().get(ID).getState().getBlock().getLocation()).thenAccept(result ->
- EarthAbility.revertAirBlock(ID)
- );
+ PaperLib.getChunkAtAsync(EarthAbility.getTempAirLocations().get(ID).getState().getBlock().getLocation()).thenAccept(result -> EarthAbility.revertAirBlock(ID));
RevertChecker.airRevertQueue.remove(ID);
}
}
public static void revertEarthBlocks() {
for (final Block block : earthRevertQueue.keySet()) {
- PaperLib.getChunkAtAsync(block.getLocation()).thenAccept(result ->
- EarthAbility.revertBlock(block)
- );
+ PaperLib.getChunkAtAsync(block.getLocation()).thenAccept(result -> EarthAbility.revertBlock(block));
earthRevertQueue.remove(block);
}
}
- private Future>> returnFuture;
+ private Future>> returnFuture;
private void addToAirRevertQueue(final int i) {
if (!airRevertQueue.containsKey(i)) {
@@ -77,7 +74,7 @@ public class RevertChecker implements Runnable {
try {
this.returnFuture = this.plugin.getServer().getScheduler().callSyncMethod(this.plugin, new getOccupiedChunks(this.plugin.getServer()));
- final Set