diff --git a/src/main/java/org/vindicterra/vindicterralib/commandcreator/ChildCommand.java b/src/main/java/org/vindicterra/vindicterralib/commandcreator/ChildCommand.java index 94e6430..f80a67e 100644 --- a/src/main/java/org/vindicterra/vindicterralib/commandcreator/ChildCommand.java +++ b/src/main/java/org/vindicterra/vindicterralib/commandcreator/ChildCommand.java @@ -28,6 +28,7 @@ * @see CommandData Uses an annotation to define the command */ @Getter +@SuppressWarnings("unused") public abstract class ChildCommand { private final Plugin plugin; private final CommandData data; diff --git a/src/main/java/org/vindicterra/vindicterralib/commandcreator/ParentCommand.java b/src/main/java/org/vindicterra/vindicterralib/commandcreator/ParentCommand.java index dddd807..82d6ae4 100644 --- a/src/main/java/org/vindicterra/vindicterralib/commandcreator/ParentCommand.java +++ b/src/main/java/org/vindicterra/vindicterralib/commandcreator/ParentCommand.java @@ -14,6 +14,7 @@ import org.bukkit.command.TabExecutor; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; +import org.jetbrains.annotations.NotNull; import java.lang.reflect.Constructor; import java.util.ArrayList; @@ -36,7 +37,7 @@ * usage = "{@literal } {@literal } [optional param]",
* requiredArgs = 2) */ -@SuppressWarnings("unused") +@SuppressWarnings({"unused", "deprecation"}) @Getter public abstract class ParentCommand extends Command implements TabExecutor { @@ -66,7 +67,7 @@ public ParentCommand(JavaPlugin plugin, CommandData command) { * @return true if the command was executed successfully */ @Override - public boolean execute(CommandSender sender, String label, String[] args) { + public boolean execute(@NotNull CommandSender sender, @NotNull String label, String[] args) { if(!enabled && !sender.isOp()) { sender.sendMessage("§cThis command is currently disabled."); return true; @@ -104,7 +105,7 @@ public boolean execute(CommandSender sender, String label, String[] args) { return true; } - page = Integer.valueOf(args[1]); + page = Integer.parseInt(args[1]); } sendUsage(sender, label, page); @@ -113,7 +114,6 @@ public boolean execute(CommandSender sender, String label, String[] args) { } run(sender, label, args); - //VindicterraFactions.getInstance().getFactionHandler().save(true); return true; } diff --git a/src/main/java/org/vindicterra/vindicterralib/entities/players/ExperienceManager.java b/src/main/java/org/vindicterra/vindicterralib/entities/players/ExperienceManager.java index 89add7f..d162b49 100644 --- a/src/main/java/org/vindicterra/vindicterralib/entities/players/ExperienceManager.java +++ b/src/main/java/org/vindicterra/vindicterralib/entities/players/ExperienceManager.java @@ -14,32 +14,32 @@ @SuppressWarnings("unused") public class ExperienceManager { - private Player player; + private final Player player; public ExperienceManager(Player player) { this.player = player; } public int getTotalExperience() { - int experience = 0; + int experience; int level = player.getLevel(); if(level >= 0 && level <= 15) { experience = (int) Math.ceil(Math.pow(level, 2) + (6 * level)); int requiredExperience = 2 * level + 7; double currentExp = Double.parseDouble(Float.toString(player.getExp())); - experience += Math.ceil(currentExp * requiredExperience); + experience += (int) Math.ceil(currentExp * requiredExperience); return experience; } else if(level > 15 && level <= 30) { experience = (int) Math.ceil((2.5 * Math.pow(level, 2) - (40.5 * level) + 360)); int requiredExperience = 5 * level - 38; double currentExp = Double.parseDouble(Float.toString(player.getExp())); - experience += Math.ceil(currentExp * requiredExperience); + experience += (int) Math.ceil(currentExp * requiredExperience); return experience; } else { experience = (int) Math.ceil(((4.5 * Math.pow(level, 2) - (162.5 * level) + 2220))); int requiredExperience = 9 * level - 158; double currentExp = Double.parseDouble(Float.toString(player.getExp())); - experience += Math.ceil(currentExp * requiredExperience); + experience += (int) Math.ceil(currentExp * requiredExperience); return experience; } } @@ -91,7 +91,7 @@ public void setTotalExperience(int xp) { player.setExp(experience); } } - + @SuppressWarnings("SameParameterValue") private float round(float d, int decimalPlace) { BigDecimal bd = new BigDecimal(Float.toString(d)); bd = bd.setScale(decimalPlace, RoundingMode.HALF_DOWN);