From c6438684fabdadd4e203602356ac7d2fa6d0f6ca Mon Sep 17 00:00:00 2001 From: Zrips Date: Mon, 21 Mar 2022 14:58:50 +0200 Subject: [PATCH] Stats command fix --- .../java/com/gamingmesh/jobs/PlayerManager.java | 8 ++++++-- .../com/gamingmesh/jobs/commands/list/stats.java | 6 ++---- .../container/blockOwnerShip/BlockOwnerShip.java | 14 +++++++------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/PlayerManager.java b/src/main/java/com/gamingmesh/jobs/PlayerManager.java index a5e70ba2..9f4f7cff 100644 --- a/src/main/java/com/gamingmesh/jobs/PlayerManager.java +++ b/src/main/java/com/gamingmesh/jobs/PlayerManager.java @@ -18,7 +18,12 @@ package com.gamingmesh.jobs; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ThreadLocalRandom; @@ -59,7 +64,6 @@ import com.gamingmesh.jobs.stuff.Util; import net.Zrips.CMILib.ActionBar.CMIActionBar; import net.Zrips.CMILib.Items.CMIItemStack; -import net.Zrips.CMILib.Logs.CMIDebug; import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.NBT.CMINBT; import net.Zrips.CMILib.Version.Version; diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/stats.java b/src/main/java/com/gamingmesh/jobs/commands/list/stats.java index fa6822a3..8d285a63 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/stats.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/stats.java @@ -9,13 +9,13 @@ import com.gamingmesh.jobs.commands.JobsCommands; import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobsPlayer; -import net.Zrips.CMILib.Logs.CMIDebug; import net.Zrips.CMILib.RawMessages.RawMessage; public class stats implements Cmd { @Override public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { + JobsPlayer jPlayer = null; if (args.length >= 1) { if (!Jobs.hasPermission(sender, "jobs.command.admin.stats", true)) @@ -44,13 +44,11 @@ public class stats implements Cmd { String pref = JobsCommands.LABEL + " " + info.class.getSimpleName() + " "; - RawMessage rm = new RawMessage(); for (JobProgression jobProg : jPlayer.progression) { for (String msg : Jobs.getCommandManager().jobStatsMessage(jobProg).split("\n")) { - rm.addText(msg).addHover(leftClick).addCommand(pref + jobProg.getJob().getName()); + new RawMessage().addText(msg).addHover(leftClick).addCommand(pref + jobProg.getJob().getName()).show(sender); } } - rm.show(sender); sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator")); return true; diff --git a/src/main/java/com/gamingmesh/jobs/container/blockOwnerShip/BlockOwnerShip.java b/src/main/java/com/gamingmesh/jobs/container/blockOwnerShip/BlockOwnerShip.java index 3b912c04..8ae0fbe3 100644 --- a/src/main/java/com/gamingmesh/jobs/container/blockOwnerShip/BlockOwnerShip.java +++ b/src/main/java/com/gamingmesh/jobs/container/blockOwnerShip/BlockOwnerShip.java @@ -89,7 +89,7 @@ public class BlockOwnerShip { blockLoc old = records.get(CMILocation.toString(loc, ":", true, true)); if (old == null) return false; - + return old.isDisabled(); } @@ -202,13 +202,13 @@ public class BlockOwnerShip { } HashMap ls = blockOwnerShips.getOrDefault(uuid, new HashMap()); String blockLoc = CMILocation.toString(block.getLocation(), ":", true, true); - com.gamingmesh.jobs.stuff.blockLoc record = ls.get(blockLoc); - if (record != null) { - - if (record.isDisabled()) + blockLoc rec = ls.get(blockLoc); + if (rec != null) { + + if (rec.isDisabled()) return false; - - record.setDisabled(true); + + rec.setDisabled(true); return true; } return false;