diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java index c0a140dd..103ebbe6 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/util/MMOCoreUtils.java @@ -128,8 +128,8 @@ public class MMOCoreUtils { * @param message Message to display */ public static void displayIndicator(Location loc, String message) { - Hologram holo = Hologram.create(loc, Arrays.asList(message)); - Bukkit.getScheduler().runTaskLater(MMOCore.plugin, () -> holo.despawn(), 20); + Hologram holo = Hologram.create(loc, Collections.singletonList(message)); + Bukkit.getScheduler().runTaskLater(MMOCore.plugin, holo::despawn, 20); } public static boolean isPlayerHead(Material material) { diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java index 28e0fb9d..956453ac 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/PlayerProfessions.java @@ -155,11 +155,11 @@ public class PlayerProfessions { return profession.hasMaxLevel() && getLevel(profession) >= profession.getMaxLevel(); } - public void giveExperience(Profession profession, double value, EXPSource source) { + public void giveExperience(@NotNull Profession profession, double value, @NotNull EXPSource source) { giveExperience(profession, value, source, null, true); } - public void giveExperience(Profession profession, double value, EXPSource source, @Nullable Location hologramLocation, boolean splitExp) { + public void giveExperience(@NotNull Profession profession, double value, @NotNull EXPSource source, @Nullable Location hologramLocation, boolean splitExp) { Validate.isTrue(playerData.isOnline(), "Cannot give experience to offline player"); if (value <= 0) { exp.put(profession.getId(), Math.max(0, exp.getOrDefault(profession.getId(), 0d) + value)); @@ -190,7 +190,7 @@ public class PlayerProfessions { return; // Display hologram - if (hologramLocation != null) + if (hologramLocation != null && profession.getOption(Profession.ProfessionOption.EXP_HOLOGRAMS)) MMOCoreUtils.displayIndicator(hologramLocation.add(.5, 1.5, .5), ConfigMessage.fromKey("exp-hologram", "exp", MythicLib.plugin.getMMOConfig().decimal.format(event.getExperience())).asLine()); exp.put(profession.getId(), Math.max(0, exp.getOrDefault(profession.getId(), 0d) + event.getExperience())); @@ -228,10 +228,10 @@ public class PlayerProfessions { playerData.getStats().updateStats(); } - StringBuilder bar = new StringBuilder("" + ChatColor.BOLD); + StringBuilder bar = new StringBuilder(ChatColor.BOLD.toString()); int chars = (int) (exp / needed * 20); for (int j = 0; j < 20; j++) - bar.append(j == chars ? "" + ChatColor.WHITE + ChatColor.BOLD : "").append("|"); + bar.append(j == chars ? ChatColor.WHITE.toString() + ChatColor.BOLD : "").append("|"); if (playerData.isOnline()) ConfigMessage.fromKey("exp-notification", "profession", profession.getName(), "progress", bar.toString(), "ratio", MythicLib.plugin.getMMOConfig().decimal.format(exp / needed * 100)).send(playerData.getPlayer()); diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/Profession.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/Profession.java index a5d8dbc7..9ac2cc2a 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/Profession.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/Profession.java @@ -124,8 +124,7 @@ public class Profession extends PostLoadObject implements ExperienceObject { } @Override - public void giveExperience(PlayerData playerData, double experience, @Nullable Location hologramLocation, EXPSource source) { - hologramLocation = !getOption(Profession.ProfessionOption.EXP_HOLOGRAMS) ? null : hologramLocation; + public void giveExperience(@NotNull PlayerData playerData, double experience, @Nullable Location hologramLocation, @NotNull EXPSource source) { playerData.getCollectionSkills().giveExperience(this, experience, EXPSource.SOURCE, hologramLocation, true); } diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/loot/chest/RegionBounds.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/loot/chest/RegionBounds.java index 5b5cf8de..b2949d70 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/loot/chest/RegionBounds.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/loot/chest/RegionBounds.java @@ -19,7 +19,7 @@ public class RegionBounds { String name = config.getString("world"); Validate.notNull(name, "Could not find world name"); - Validate.notNull(world = Bukkit.getWorld(name), "Could not find world " + config.getString("world")); + Validate.notNull(world = Bukkit.getWorld(name), "Could not find world '" + config.getString("world") + "'"); x1 = Math.min(config.getInt("x1"), config.getInt("x2")); x2 = Math.max(config.getInt("x1"), config.getInt("x2")); diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/profession/CustomBlockManager.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/profession/CustomBlockManager.java index acbe4061..cbdd0ec4 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/profession/CustomBlockManager.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/profession/CustomBlockManager.java @@ -69,7 +69,7 @@ public class CustomBlockManager extends SpecificProfessionManager { * @return The new block behaviour or null if no new behaviour */ public @Nullable BlockInfo getInfo(Block block) { - return map.getOrDefault(findBlockType(block).generateKey(), null); + return map.get(findBlockType(block).generateKey()); } public BlockType findBlockType(Block block) {