forked from Upstream/mmocore
!Cleanup + placeholder bug fix
This commit is contained in:
parent
56257c442d
commit
1596f7e964
@ -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<String, Integer> exp = new HashMap<>();
|
||||
private final Map<String, Integer> 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());
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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()
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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;
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user