Skip to content

Commit

Permalink
fixed all warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
bearofbusiness committed Oct 7, 2024
1 parent 510a7ee commit 521723f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -36,7 +37,7 @@
* usage = "{@literal <param1>} {@literal <param2|param3>} [optional param]",<br>
* requiredArgs = 2)
*/
@SuppressWarnings("unused")
@SuppressWarnings({"unused", "deprecation"})
@Getter
public abstract class ParentCommand extends Command implements TabExecutor {

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -113,7 +114,6 @@ public boolean execute(CommandSender sender, String label, String[] args) {
}

run(sender, label, args);
//VindicterraFactions.getInstance().getFactionHandler().save(true);
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 521723f

Please sign in to comment.