diff --git a/src/main/java/net/Indyuce/mmocore/api/experience/PlayerProfessions.java b/src/main/java/net/Indyuce/mmocore/api/experience/PlayerProfessions.java index 6d889e8f..f00152de 100644 --- a/src/main/java/net/Indyuce/mmocore/api/experience/PlayerProfessions.java +++ b/src/main/java/net/Indyuce/mmocore/api/experience/PlayerProfessions.java @@ -23,7 +23,6 @@ import net.Indyuce.mmocore.api.event.PlayerLevelUpEvent; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.util.math.particle.SmallParticleEffect; -@SuppressWarnings("ALL") public class PlayerProfessions { private final Map exp = new HashMap<>(); private final Map level = new HashMap<>(); @@ -98,8 +97,7 @@ public class PlayerProfessions { } public int getLevelUpExperience(String id) { - if(!MMOCore.plugin.professionManager.has(id)) return 0; - return MMOCore.plugin.professionManager.get(id).getExpCurve().getExperience(getLevel(id) + 1); + return MMOCore.plugin.professionManager.has(id) ? MMOCore.plugin.professionManager.get(id).getExpCurve().getExperience(getLevel(id) + 1) : 0; } public void setLevel(Profession profession, int value) { @@ -131,7 +129,7 @@ public class PlayerProfessions { } public void giveExperience(Profession profession, int value, Location loc, EXPSource source) { - if(hasReachedMaxLevel(profession)) { + if (hasReachedMaxLevel(profession)) { setExperience(profession, 0); return; } @@ -148,13 +146,13 @@ public class PlayerProfessions { Bukkit.getPluginManager().callEvent(event); if (event.isCancelled()) return; - + exp.put(profession.getId(), exp.containsKey(profession.getId()) ? exp.get(profession.getId()) + value : value); int needed, exp, level, oldLevel = getLevel(profession); /* - * loop for exp overload when leveling up, - * will continue looping until exp is 0 or max level has been reached + * loop for exp overload when leveling up, will continue looping until + * exp is 0 or max level has been reached */ boolean check = false; while ((exp = this.exp.get(profession.getId())) >= (needed = profession.getExpCurve().getExperience((level = getLevel(profession)) + 1))) { @@ -183,8 +181,8 @@ public class PlayerProfessions { int chars = (int) ((double) exp / needed * 20); for (int j = 0; j < 20; j++) bar.append(j == chars ? "" + ChatColor.WHITE + ChatColor.BOLD : "").append("|"); - if(playerData.isOnline()) + if (playerData.isOnline()) MMOCore.plugin.configManager.getSimpleMessage("exp-notification", "profession", profession.getName(), "progress", bar.toString(), "ratio", - MMOLib.plugin.getMMOConfig().decimal.format((double) exp / needed * 100)).send(playerData.getPlayer()); + MMOLib.plugin.getMMOConfig().decimal.format((double) exp / needed * 100)).send(playerData.getPlayer()); } } diff --git a/src/main/java/net/Indyuce/mmocore/api/loot/LootChest.java b/src/main/java/net/Indyuce/mmocore/api/loot/LootChest.java index cfed3383..4d242d58 100644 --- a/src/main/java/net/Indyuce/mmocore/api/loot/LootChest.java +++ b/src/main/java/net/Indyuce/mmocore/api/loot/LootChest.java @@ -1,10 +1,8 @@ package net.Indyuce.mmocore.api.loot; -import net.Indyuce.mmocore.manager.SoundManager; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Particle; -import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.Chest; import org.bukkit.block.data.BlockData; @@ -12,6 +10,7 @@ import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.manager.SoundManager; public class LootChest { private final ChestTier tier; diff --git a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java index 4fb107b5..0568786a 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -10,7 +10,6 @@ import java.util.Set; import java.util.UUID; import java.util.logging.Level; -import net.Indyuce.mmocore.manager.SoundManager; import org.bukkit.Bukkit; import org.bukkit.Color; import org.bukkit.Location; @@ -51,10 +50,10 @@ import net.Indyuce.mmocore.api.skill.SkillResult; import net.Indyuce.mmocore.api.skill.SkillResult.CancelReason; import net.Indyuce.mmocore.api.util.math.particle.SmallParticleEffect; import net.Indyuce.mmocore.listener.SpellCast.SkillCasting; +import net.Indyuce.mmocore.manager.SoundManager; import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.TextComponent; import net.mmogroup.mmolib.api.player.MMOPlayerData; -import net.mmogroup.mmolib.version.VersionSound; public class PlayerData extends OfflinePlayerData { diff --git a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicMobsDrops.java b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicMobsDrops.java index bd7dbdce..30944d24 100644 --- a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicMobsDrops.java +++ b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicMobsDrops.java @@ -1,15 +1,15 @@ package net.Indyuce.mmocore.comp.mythicmobs; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; + import io.lumine.xikage.mythicmobs.MythicMobs; import io.lumine.xikage.mythicmobs.api.bukkit.events.MythicDropLoadEvent; import io.lumine.xikage.mythicmobs.api.bukkit.events.MythicReloadedEvent; import io.lumine.xikage.mythicmobs.skills.placeholders.Placeholder; -import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.comp.mythicmobs.load.CurrencyItemDrop; import net.Indyuce.mmocore.comp.mythicmobs.load.GoldPouchDrop; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; public class MythicMobsDrops implements Listener { public MythicMobsDrops() { diff --git a/src/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java b/src/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java index 82808103..03686acf 100644 --- a/src/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java +++ b/src/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java @@ -1,5 +1,12 @@ package net.Indyuce.mmocore.comp.placeholder; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.OfflinePlayer; +import org.bukkit.attribute.Attribute; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import me.clip.placeholderapi.expansion.PlaceholderExpansion; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.experience.PlayerProfessions; @@ -9,12 +16,6 @@ import net.Indyuce.mmocore.api.player.stats.StatType; import net.Indyuce.mmocore.api.quest.PlayerQuests; import net.mmogroup.mmolib.MMOLib; import net.mmogroup.mmolib.api.util.AltChar; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.OfflinePlayer; -import org.bukkit.attribute.Attribute; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; public class RPGPlaceholders extends PlaceholderExpansion { @Override @@ -103,7 +104,7 @@ public class RPGPlaceholders extends PlaceholderExpansion { else if (identifier.startsWith("profession_next_level_")) return "" + PlayerData.get(player).getCollectionSkills() - .getLevelUpExperience(identifier.substring(21).replace(" ", "-").replace("_", "-").toLowerCase()); + .getLevelUpExperience(identifier.substring(22).replace(" ", "-").replace("_", "-").toLowerCase()); else if (identifier.startsWith("profession_")) return "" + PlayerData.get(player).getCollectionSkills() diff --git a/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java b/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java index a42e4e97..07fcca19 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java +++ b/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java @@ -1,7 +1,5 @@ package net.Indyuce.mmocore.gui; -import net.Indyuce.mmocore.manager.SoundManager; -import org.bukkit.Sound; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.event.inventory.InventoryClickEvent; @@ -16,6 +14,7 @@ import net.Indyuce.mmocore.gui.api.item.InventoryItem; import net.Indyuce.mmocore.gui.api.item.InventoryPlaceholderItem; import net.Indyuce.mmocore.gui.api.item.NoPlaceholderItem; import net.Indyuce.mmocore.gui.api.item.Placeholders; +import net.Indyuce.mmocore.manager.SoundManager; public class AttributeView extends EditableInventory { public AttributeView() { diff --git a/src/main/java/net/Indyuce/mmocore/gui/ClassConfirmation.java b/src/main/java/net/Indyuce/mmocore/gui/ClassConfirmation.java index b4ec60d5..4ae22c8d 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/ClassConfirmation.java +++ b/src/main/java/net/Indyuce/mmocore/gui/ClassConfirmation.java @@ -1,10 +1,8 @@ package net.Indyuce.mmocore.gui; -import net.Indyuce.mmocore.manager.SoundManager; import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.ChatColor; -import org.bukkit.Sound; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.inventory.ItemStack; @@ -21,6 +19,7 @@ import net.Indyuce.mmocore.gui.api.item.InventoryItem; import net.Indyuce.mmocore.gui.api.item.InventoryPlaceholderItem; import net.Indyuce.mmocore.gui.api.item.NoPlaceholderItem; import net.Indyuce.mmocore.gui.api.item.Placeholders; +import net.Indyuce.mmocore.manager.SoundManager; public class ClassConfirmation extends EditableInventory { public ClassConfirmation() { diff --git a/src/main/java/net/Indyuce/mmocore/gui/ClassSelect.java b/src/main/java/net/Indyuce/mmocore/gui/ClassSelect.java index 76b1f6bd..a28b1510 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/ClassSelect.java +++ b/src/main/java/net/Indyuce/mmocore/gui/ClassSelect.java @@ -5,9 +5,7 @@ import java.util.Comparator; import java.util.List; import java.util.stream.Collectors; -import net.Indyuce.mmocore.manager.SoundManager; import org.bukkit.Material; -import org.bukkit.Sound; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.inventory.ItemFlag; @@ -24,6 +22,7 @@ import net.Indyuce.mmocore.gui.api.GeneratedInventory; import net.Indyuce.mmocore.gui.api.item.InventoryItem; import net.Indyuce.mmocore.gui.api.item.NoPlaceholderItem; import net.Indyuce.mmocore.manager.InventoryManager; +import net.Indyuce.mmocore.manager.SoundManager; import net.mmogroup.mmolib.MMOLib; import net.mmogroup.mmolib.api.item.ItemTag; import net.mmogroup.mmolib.api.item.NBTItem; diff --git a/src/main/java/net/Indyuce/mmocore/gui/QuestViewer.java b/src/main/java/net/Indyuce/mmocore/gui/QuestViewer.java index e3eb6d51..51b48584 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/QuestViewer.java +++ b/src/main/java/net/Indyuce/mmocore/gui/QuestViewer.java @@ -1,5 +1,19 @@ package net.Indyuce.mmocore.gui; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import org.apache.commons.lang.Validate; +import org.bukkit.ChatColor; +import org.bukkit.configuration.ConfigurationSection; +import org.bukkit.event.inventory.InventoryAction; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.inventory.ItemFlag; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; + import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.experience.Profession; import net.Indyuce.mmocore.api.player.PlayerData; @@ -14,20 +28,6 @@ import net.Indyuce.mmocore.gui.api.item.Placeholders; import net.Indyuce.mmocore.manager.SoundManager; import net.mmogroup.mmolib.api.item.ItemTag; import net.mmogroup.mmolib.api.item.NBTItem; -import org.apache.commons.lang.Validate; -import org.bukkit.ChatColor; -import org.bukkit.Sound; -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.event.inventory.InventoryAction; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.inventory.ItemFlag; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; - -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; public class QuestViewer extends EditableInventory { public QuestViewer() { diff --git a/src/main/java/net/Indyuce/mmocore/gui/SubclassConfirmation.java b/src/main/java/net/Indyuce/mmocore/gui/SubclassConfirmation.java index 03664da7..efddf657 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/SubclassConfirmation.java +++ b/src/main/java/net/Indyuce/mmocore/gui/SubclassConfirmation.java @@ -1,8 +1,6 @@ package net.Indyuce.mmocore.gui; -import net.Indyuce.mmocore.manager.SoundManager; import org.bukkit.Bukkit; -import org.bukkit.Sound; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.event.inventory.InventoryClickEvent; @@ -17,6 +15,7 @@ import net.Indyuce.mmocore.gui.api.item.InventoryItem; import net.Indyuce.mmocore.gui.api.item.InventoryPlaceholderItem; import net.Indyuce.mmocore.gui.api.item.NoPlaceholderItem; import net.Indyuce.mmocore.gui.api.item.Placeholders; +import net.Indyuce.mmocore.manager.SoundManager; public class SubclassConfirmation extends EditableInventory { public SubclassConfirmation() { diff --git a/src/main/java/net/Indyuce/mmocore/gui/SubclassSelect.java b/src/main/java/net/Indyuce/mmocore/gui/SubclassSelect.java index cf42737d..f0f6b402 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/SubclassSelect.java +++ b/src/main/java/net/Indyuce/mmocore/gui/SubclassSelect.java @@ -4,8 +4,6 @@ import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; -import net.Indyuce.mmocore.manager.SoundManager; -import org.bukkit.Sound; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.inventory.ItemStack; @@ -21,6 +19,7 @@ import net.Indyuce.mmocore.gui.api.GeneratedInventory; import net.Indyuce.mmocore.gui.api.item.InventoryItem; import net.Indyuce.mmocore.gui.api.item.NoPlaceholderItem; import net.Indyuce.mmocore.manager.InventoryManager; +import net.Indyuce.mmocore.manager.SoundManager; import net.mmogroup.mmolib.MMOLib; import net.mmogroup.mmolib.api.item.ItemTag; import net.mmogroup.mmolib.api.item.NBTItem; diff --git a/src/main/java/net/Indyuce/mmocore/listener/SpellCast.java b/src/main/java/net/Indyuce/mmocore/listener/SpellCast.java index 6ae4229a..5d09e644 100644 --- a/src/main/java/net/Indyuce/mmocore/listener/SpellCast.java +++ b/src/main/java/net/Indyuce/mmocore/listener/SpellCast.java @@ -1,10 +1,7 @@ package net.Indyuce.mmocore.listener; -import net.Indyuce.mmocore.manager.ConfigManager; -import net.Indyuce.mmocore.manager.SoundManager; import org.bukkit.Bukkit; import org.bukkit.GameMode; -import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.HandlerList; @@ -17,6 +14,8 @@ import org.bukkit.scheduler.BukkitRunnable; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.skill.Skill.SkillInfo; +import net.Indyuce.mmocore.manager.ConfigManager; +import net.Indyuce.mmocore.manager.SoundManager; public class SpellCast implements Listener { @EventHandler