forked from Upstream/mmocore
mmocoreManager code cleanup
This commit is contained in:
parent
c1f3829e63
commit
e92cb8e67a
@ -70,7 +70,6 @@ public class MMOCore extends LuminePlugin {
|
||||
public final SkillManager skillManager = new SkillManager();
|
||||
public final ClassManager classManager = new ClassManager();
|
||||
public final DropTableManager dropTableManager = new DropTableManager();
|
||||
public final CustomBlockManager mineManager = new CustomBlockManager();
|
||||
public final BoosterManager boosterManager = new BoosterManager();
|
||||
public final AttributeManager attributeManager = new AttributeManager();
|
||||
public final PartyManager partyManager = new PartyManager();
|
||||
@ -79,9 +78,8 @@ public class MMOCore extends LuminePlugin {
|
||||
public final net.Indyuce.mmocore.manager.ExperienceManager experience = new net.Indyuce.mmocore.manager.ExperienceManager();
|
||||
public final LootChestManager lootChests = new LootChestManager();
|
||||
|
||||
/*
|
||||
* professions
|
||||
*/
|
||||
// Profession managers
|
||||
public final net.Indyuce.mmocore.manager.profession.CustomBlockManager mineManager = new net.Indyuce.mmocore.manager.profession.CustomBlockManager();
|
||||
public final FishingManager fishingManager = new FishingManager();
|
||||
public final AlchemyManager alchemyManager = new AlchemyManager();
|
||||
public final EnchantManager enchantManager = new EnchantManager();
|
||||
@ -206,7 +204,7 @@ public class MMOCore extends LuminePlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
reloadPlugin();
|
||||
initializePlugin(false);
|
||||
|
||||
if (getConfig().getBoolean("vanilla-exp-redirection.enabled"))
|
||||
Bukkit.getPluginManager().registerEvents(new RedirectVanillaExp(getConfig().getDouble("vanilla-exp-redirection.ratio")), this);
|
||||
@ -336,45 +334,39 @@ public class MMOCore extends LuminePlugin {
|
||||
lootChests.getActive().forEach(chest -> chest.unregister(false));
|
||||
}
|
||||
|
||||
public void reloadPlugin() {
|
||||
/**
|
||||
* Called either when the server starts when initializing the manager for
|
||||
* the first time, or when issuing a plugin reload; in that case, stuff
|
||||
* like listeners must all be cleared before.
|
||||
*
|
||||
* Also see {@link MMOCoreManager}
|
||||
*
|
||||
* @param clearBefore True when issuing a plugin reload
|
||||
*/
|
||||
public void initializePlugin(boolean clearBefore) {
|
||||
reloadConfig();
|
||||
|
||||
configManager = new ConfigManager();
|
||||
|
||||
skillManager.reload();
|
||||
|
||||
mineManager.clear();
|
||||
mineManager.reload();
|
||||
mineManager.initialize(clearBefore);
|
||||
partyManager.initialize(clearBefore);
|
||||
attributeManager.initialize(clearBefore);
|
||||
|
||||
fishingManager.clear();
|
||||
alchemyManager.clear();
|
||||
smithingManager.clear();
|
||||
// Experience must be loaded before professions and classes
|
||||
experience.initialize(clearBefore);
|
||||
|
||||
partyManager.clear();
|
||||
partyManager.reload();
|
||||
// Drop tables must be loaded before professions
|
||||
dropTableManager.initialize(clearBefore);
|
||||
|
||||
attributeManager.clear();
|
||||
attributeManager.reload();
|
||||
|
||||
// experience must be loaded before professions and classes
|
||||
experience.reload();
|
||||
|
||||
// drop tables must be loaded before professions
|
||||
dropTableManager.clear();
|
||||
dropTableManager.reload();
|
||||
|
||||
professionManager.clear();
|
||||
professionManager.reload();
|
||||
|
||||
classManager.clear();
|
||||
classManager.reload();
|
||||
professionManager.initialize(clearBefore);
|
||||
classManager.initialize(clearBefore);
|
||||
|
||||
InventoryManager.load();
|
||||
|
||||
questManager.clear();
|
||||
questManager.reload();
|
||||
|
||||
lootChests.reload();
|
||||
questManager.initialize(clearBefore);
|
||||
lootChests.initialize(clearBefore);
|
||||
|
||||
waypointManager = new WaypointManager(new ConfigFile("waypoints").getConfig());
|
||||
restrictionManager = new RestrictionManager(new ConfigFile("restrictions").getConfig());
|
||||
|
@ -91,20 +91,31 @@ public class PlayerData extends OfflinePlayerData implements Closable {
|
||||
*/
|
||||
private boolean fullyLoaded = false;
|
||||
|
||||
/**
|
||||
* If the player data was loaded using temporary data.
|
||||
* See {@link TemporaryPlayerData} for more info
|
||||
*/
|
||||
private final boolean usingTemporaryData;
|
||||
|
||||
public PlayerData(MMOPlayerData mmoData) {
|
||||
this(mmoData, false);
|
||||
}
|
||||
|
||||
public PlayerData(MMOPlayerData mmoData, TemporaryPlayerData tempData) {
|
||||
this(mmoData, true);
|
||||
|
||||
mana = tempData.getDouble("mana");
|
||||
stamina = tempData.getDouble("stamina");
|
||||
stellium = tempData.getDouble("stellium");
|
||||
}
|
||||
|
||||
private PlayerData(MMOPlayerData mmoData, boolean usingTemporaryData) {
|
||||
super(mmoData.getUniqueId());
|
||||
|
||||
this.mmoData = mmoData;
|
||||
this.playerStats = new PlayerStats(this);
|
||||
this.questData = new PlayerQuests(this);
|
||||
}
|
||||
|
||||
public PlayerData(MMOPlayerData mmoData, TemporaryPlayerData tempData) {
|
||||
this(mmoData);
|
||||
|
||||
mana = tempData.getDouble("mana");
|
||||
stamina = tempData.getDouble("stamina");
|
||||
stellium = tempData.getDouble("stellium");
|
||||
this.usingTemporaryData = usingTemporaryData;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -660,6 +671,10 @@ public class PlayerData extends OfflinePlayerData implements Closable {
|
||||
this.fullyLoaded = true;
|
||||
}
|
||||
|
||||
public boolean hasUsedTemporaryData() {
|
||||
return usingTemporaryData;
|
||||
}
|
||||
|
||||
public boolean isCasting() {
|
||||
return skillCasting != null;
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ public class PlayerClass extends PostLoadObject {
|
||||
actionBarFormat = config.contains("action-bar", true) ? config.getString("action-bar") : null;
|
||||
|
||||
expCurve = config.contains("exp-curve")
|
||||
? MMOCore.plugin.experience.getOrThrow(
|
||||
? MMOCore.plugin.experience.getCurveOrThrow(
|
||||
config.get("exp-curve").toString().toLowerCase().replace("_", "-").replace(" ", "-"))
|
||||
: ExpCurve.DEFAULT;
|
||||
|
||||
@ -129,7 +129,7 @@ public class PlayerClass extends PostLoadObject {
|
||||
for (String key : config.getStringList("main-exp-sources"))
|
||||
try {
|
||||
ExperienceSource<?> source = MMOCore.plugin.loadManager.loadExperienceSource(new MMOLineConfig(key), dispenser);
|
||||
MMOCore.plugin.professionManager.registerExpSource(source);
|
||||
MMOCore.plugin.experience.registerSource(source);
|
||||
} catch (IllegalArgumentException exception) {
|
||||
MMOCore.plugin.getLogger().log(Level.WARNING, "Could not load exp source '" + key + "' from class '"
|
||||
+ id + "': " + exception.getMessage());
|
||||
|
@ -1,16 +1,21 @@
|
||||
package net.Indyuce.mmocore.api.player.profess.event;
|
||||
|
||||
import io.lumine.mythic.lib.api.MMOLineConfig;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.quest.trigger.Trigger;
|
||||
import net.Indyuce.mmocore.experience.droptable.ExperienceTable;
|
||||
import org.apache.commons.lang.Validate;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.quest.trigger.Trigger;
|
||||
import io.lumine.mythic.lib.api.MMOLineConfig;
|
||||
|
||||
/**
|
||||
* @deprecated Replaced by {@link ExperienceTable} and will
|
||||
* be removed in 1.8.4
|
||||
*/
|
||||
@Deprecated
|
||||
public class EventTrigger {
|
||||
private final String event;
|
||||
private final Set<Trigger> triggers = new LinkedHashSet<>();
|
||||
|
@ -1,7 +1,13 @@
|
||||
package net.Indyuce.mmocore.api.player.profess.event;
|
||||
|
||||
import net.Indyuce.mmocore.experience.droptable.ExperienceTable;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
/**
|
||||
* @deprecated Replaced by {@link ExperienceTable} and will
|
||||
* be removed in 1.8.4
|
||||
*/
|
||||
@Deprecated
|
||||
public interface EventTriggerHandler extends Listener {
|
||||
boolean handles(String event);
|
||||
}
|
||||
|
@ -62,13 +62,13 @@ public class Party {
|
||||
|
||||
reopenInventories();
|
||||
|
||||
// disband the party if no member left
|
||||
// Disband the party if no member left
|
||||
if (members.count() < 1) {
|
||||
MMOCore.plugin.partyManager.unregisterParty(this);
|
||||
return;
|
||||
}
|
||||
|
||||
// transfer ownership
|
||||
// Transfer ownership
|
||||
if (owner.equals(data)) {
|
||||
owner = members.get(0);
|
||||
if (notify && owner.isOnline())
|
||||
|
@ -19,7 +19,7 @@ public class ReloadCommandTreeNode extends CommandTreeNode {
|
||||
long ms = System.currentTimeMillis();
|
||||
|
||||
MMOCore.plugin.reloadConfig();
|
||||
MMOCore.plugin.reloadPlugin();
|
||||
MMOCore.plugin.initializePlugin(true);
|
||||
|
||||
PlayerData.getAll().forEach(PlayerData::update);
|
||||
|
||||
|
@ -7,6 +7,7 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import org.apache.commons.lang.Validate;
|
||||
|
||||
public class ExpCurve {
|
||||
@ -21,7 +22,9 @@ public class ExpCurve {
|
||||
/**
|
||||
* Purely arbitrary but MMOCore needs a default exp curve for everything
|
||||
* otherwise there might be divisions by 0 when trying to update the vanilla
|
||||
* exp bar which requires a 0.0 -> 1.0 float as parameter
|
||||
* exp bar which requires a 0.0 -> 1.0 float as parameter.
|
||||
*
|
||||
* See {@link PlayerData#refreshVanillaExp()}
|
||||
*/
|
||||
public static final ExpCurve DEFAULT = new ExpCurve("default", 100, 200, 300, 400, 500);
|
||||
|
||||
|
@ -22,7 +22,15 @@ public interface ExperienceDispenser {
|
||||
*/
|
||||
void giveExperience(PlayerData playerData, double experience, @Nullable Location hologramLocation);
|
||||
|
||||
boolean matches(PlayerData playerData);
|
||||
/**
|
||||
* Experience sources handle both CLASS experience sources and PROFESSION
|
||||
* experience sources. Professions have no problem because whatever
|
||||
* class the player has chosen, he can get exp in that profession.
|
||||
* <p>
|
||||
* But class experience sources must first make sure that the player has
|
||||
* the right class before giving exp to the player
|
||||
*/
|
||||
boolean shouldHandle(PlayerData playerData);
|
||||
|
||||
default Location getPlayerLocation(PlayerData player) {
|
||||
return player.isOnline() ? player.getPlayer().getLocation() : null;
|
||||
|
@ -23,7 +23,7 @@ public class MainExperienceDispenser implements ExperienceDispenser {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(PlayerData playerData) {
|
||||
public boolean shouldHandle(PlayerData playerData) {
|
||||
return playerData.getProfess().equals(profess);
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public class ProfessionExperienceDispenser implements ExperienceDispenser {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(PlayerData playerData) {
|
||||
public boolean shouldHandle(PlayerData playerData) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public abstract class ExperienceSource<T> {
|
||||
public abstract ExperienceSourceManager<?> newManager();
|
||||
|
||||
public boolean matches(PlayerData player, T obj) {
|
||||
return getDispenser().matches(player) && matchesParameter(player, obj);
|
||||
return getDispenser().shouldHandle(player) && matchesParameter(player, obj);
|
||||
}
|
||||
|
||||
public abstract boolean matchesParameter(PlayerData player, T obj);
|
||||
|
@ -9,7 +9,7 @@ import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.ConfigFile;
|
||||
import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute;
|
||||
|
||||
public class AttributeManager implements MMOManager {
|
||||
public class AttributeManager implements MMOCoreManager {
|
||||
private final Map<String, PlayerAttribute> map = new HashMap<>();
|
||||
|
||||
public PlayerAttribute get(String id) {
|
||||
@ -23,9 +23,11 @@ public class AttributeManager implements MMOManager {
|
||||
public Collection<PlayerAttribute> getAll() {
|
||||
return map.values();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void reload() {
|
||||
public void initialize(boolean clearBefore) {
|
||||
if (clearBefore)
|
||||
map.clear();
|
||||
|
||||
ConfigFile config = new ConfigFile("attributes");
|
||||
for (String key : config.getConfig().getKeys(false))
|
||||
@ -36,9 +38,4 @@ public class AttributeManager implements MMOManager {
|
||||
MMOCore.log(Level.WARNING, "Could not load attribute '" + key + "': " + exception.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
map.clear();
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ import net.Indyuce.mmocore.api.player.profess.event.trigger.ClassChosenEventTrig
|
||||
import net.Indyuce.mmocore.api.player.profess.event.trigger.LevelUpEventTrigger;
|
||||
import net.Indyuce.mmocore.api.player.profess.event.trigger.MultipleLevelUpEventTrigger;
|
||||
|
||||
public class ClassManager implements MMOManager {
|
||||
public class ClassManager implements MMOCoreManager {
|
||||
private final Map<String, PlayerClass> map = new HashMap<>();
|
||||
|
||||
/*
|
||||
@ -84,7 +84,17 @@ public class ClassManager implements MMOManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reload() {
|
||||
public void initialize(boolean clearBefore) {
|
||||
if (clearBefore) {
|
||||
map.clear();
|
||||
triggerHandlers.forEach(HandlerList::unregisterAll);
|
||||
|
||||
/*
|
||||
* Do not clear the list of trigger listeners, since it's only setup
|
||||
* once the server loads and it is never modified.
|
||||
*/
|
||||
}
|
||||
|
||||
for (File file : new File(MMOCore.plugin.getDataFolder() + "/classes").listFiles())
|
||||
try {
|
||||
String id = file.getName().substring(0, file.getName().length() - 4);
|
||||
@ -104,19 +114,8 @@ public class ClassManager implements MMOManager {
|
||||
.orElse(new PlayerClass("HUMAN", "Human", Material.LEATHER_BOOTS));
|
||||
|
||||
/*
|
||||
* register event triggers
|
||||
* Register event triggers
|
||||
*/
|
||||
triggerHandlers.forEach(handler -> Bukkit.getPluginManager().registerEvents(handler, MMOCore.plugin));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
map.clear();
|
||||
triggerHandlers.forEach(HandlerList::unregisterAll);
|
||||
|
||||
/*
|
||||
* do not clear the list of trigger listeners, since it's only setup
|
||||
* once the server loads and it is never modified.
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.loot.droptable.DropTable;
|
||||
|
||||
public class DropTableManager implements MMOManager {
|
||||
public class DropTableManager implements MMOCoreManager {
|
||||
private final Map<String, DropTable> map = new HashMap<>();
|
||||
|
||||
public void register(DropTable table) {
|
||||
@ -59,7 +59,10 @@ public class DropTableManager implements MMOManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reload() {
|
||||
public void initialize(boolean clearBefore) {
|
||||
if (clearBefore)
|
||||
map.clear();
|
||||
|
||||
for (File file : new File(MMOCore.plugin.getDataFolder() + "/drop-tables").listFiles())
|
||||
try {
|
||||
|
||||
@ -77,9 +80,4 @@ public class DropTableManager implements MMOManager {
|
||||
|
||||
Bukkit.getScheduler().runTask(MMOCore.plugin, () -> map.values().forEach(PostLoadObject::postLoad));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
map.clear();
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import net.Indyuce.mmocore.api.ConfigFile;
|
||||
import net.Indyuce.mmocore.loot.chest.LootChest;
|
||||
import net.Indyuce.mmocore.loot.chest.LootChestRegion;
|
||||
|
||||
public class LootChestManager {
|
||||
public class LootChestManager implements MMOCoreManager {
|
||||
|
||||
/*
|
||||
* all active loot chests in the server
|
||||
@ -57,9 +57,12 @@ public class LootChestManager {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
regions.values().forEach(region -> region.getRunnable().cancel());
|
||||
regions.clear();
|
||||
@Override
|
||||
public void initialize(boolean clearBefore) {
|
||||
if (clearBefore) {
|
||||
regions.values().forEach(region -> region.getRunnable().cancel());
|
||||
regions.clear();
|
||||
}
|
||||
|
||||
FileConfiguration config = new ConfigFile("loot-chests").getConfig();
|
||||
for (String key : config.getKeys(false))
|
||||
|
@ -1,7 +0,0 @@
|
||||
package net.Indyuce.mmocore.manager;
|
||||
|
||||
public interface MMOManager {
|
||||
void reload();
|
||||
|
||||
void clear();
|
||||
}
|
@ -13,7 +13,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.quest.Quest;
|
||||
|
||||
public class QuestManager implements MMOManager {
|
||||
public class QuestManager implements MMOCoreManager {
|
||||
private final Map<String, Quest> quests = new LinkedHashMap<>();
|
||||
|
||||
public void load(File file) {
|
||||
@ -45,7 +45,10 @@ public class QuestManager implements MMOManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reload() {
|
||||
public void initialize(boolean clearBefore) {
|
||||
if (clearBefore)
|
||||
quests.clear();
|
||||
|
||||
load(new File(MMOCore.plugin.getDataFolder() + "/quests"));
|
||||
for (Quest quest : quests.values())
|
||||
try {
|
||||
@ -54,9 +57,4 @@ public class QuestManager implements MMOManager {
|
||||
MMOCore.plugin.getLogger().log(Level.WARNING, "Could not post-load quest '" + quest.getId() + "': " + exception.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
quests.clear();
|
||||
}
|
||||
}
|
||||
|
@ -24,8 +24,32 @@ import net.Indyuce.mmocore.comp.mythicmobs.MythicSkill;
|
||||
public class SkillManager {
|
||||
private final Map<String, Skill> skills = new LinkedHashMap<>();
|
||||
|
||||
public void register(Skill skill) {
|
||||
skills.put(skill.getId().toUpperCase(), skill);
|
||||
}
|
||||
|
||||
public Skill get(String id) {
|
||||
return skills.get(id.toUpperCase());
|
||||
}
|
||||
|
||||
public boolean has(String id) {
|
||||
return skills.containsKey(id.toUpperCase());
|
||||
}
|
||||
|
||||
public Collection<Skill> getAll() {
|
||||
return skills.values();
|
||||
}
|
||||
|
||||
public Set<Skill> getActive() {
|
||||
return skills.values().stream().filter(skill -> !skill.isPassive()).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
public Set<String> getKeys() {
|
||||
return skills.keySet();
|
||||
}
|
||||
|
||||
/*
|
||||
* skills are initialized when MMOCore enables but SkillManager must be
|
||||
* Skills are initialized when MMOCore enables but SkillManager must be
|
||||
* instanced when MMOCore loads so that extra plugins can register skills
|
||||
* before CLASSES are loaded
|
||||
*/
|
||||
@ -53,9 +77,7 @@ public class SkillManager {
|
||||
if (!mythicMobs.exists())
|
||||
mythicMobs.mkdir();
|
||||
|
||||
/*
|
||||
* load MythicMobs addon skills
|
||||
*/
|
||||
// Load MythicMobs addon skills
|
||||
if (Bukkit.getPluginManager().getPlugin("MythicMobs") != null)
|
||||
for (File file : mythicMobs.listFiles()) {
|
||||
try {
|
||||
@ -96,28 +118,4 @@ public class SkillManager {
|
||||
config.save();
|
||||
}
|
||||
}
|
||||
|
||||
public void register(Skill skill) {
|
||||
skills.put(skill.getId().toUpperCase(), skill);
|
||||
}
|
||||
|
||||
public Skill get(String id) {
|
||||
return skills.get(id.toUpperCase());
|
||||
}
|
||||
|
||||
public boolean has(String id) {
|
||||
return skills.containsKey(id.toUpperCase());
|
||||
}
|
||||
|
||||
public Collection<Skill> getAll() {
|
||||
return skills.values();
|
||||
}
|
||||
|
||||
public Set<Skill> getActive() {
|
||||
return skills.values().stream().filter(skill -> !skill.isPassive()).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
public Set<String> getKeys() {
|
||||
return skills.keySet();
|
||||
}
|
||||
}
|
||||
|
@ -44,11 +44,14 @@ public class MySQLPlayerDataManager extends PlayerDataManager {
|
||||
data.setAttributePoints(getDefaultData().getAttributePoints());
|
||||
data.setAttributeReallocationPoints(getDefaultData().getAttrReallocPoints());
|
||||
data.setExperience(0);
|
||||
data.setMana(data.getStats().getStat(StatType.MAX_MANA));
|
||||
data.setStamina(data.getStats().getStat(StatType.MAX_STAMINA));
|
||||
data.setStellium(data.getStats().getStat(StatType.MAX_STELLIUM));
|
||||
data.getQuestData().updateBossBar();
|
||||
|
||||
if (!data.hasUsedTemporaryData()) {
|
||||
data.setMana(data.getStats().getStat(StatType.MAX_MANA));
|
||||
data.setStamina(data.getStats().getStat(StatType.MAX_STAMINA));
|
||||
data.setStellium(data.getStats().getStat(StatType.MAX_STELLIUM));
|
||||
}
|
||||
|
||||
data.setFullyLoaded();
|
||||
MMOCore.sqlDebug("Loaded DEFAULT data for: '" + data.getUniqueId() + "' as no saved data was found.");
|
||||
return;
|
||||
@ -62,9 +65,13 @@ public class MySQLPlayerDataManager extends PlayerDataManager {
|
||||
data.setExperience(result.getInt("experience"));
|
||||
if (!isEmpty(result.getString("class")))
|
||||
data.setClass(MMOCore.plugin.classManager.get(result.getString("class")));
|
||||
data.setMana(data.getStats().getStat(StatType.MAX_MANA));
|
||||
data.setStamina(data.getStats().getStat(StatType.MAX_STAMINA));
|
||||
data.setStellium(data.getStats().getStat(StatType.MAX_STELLIUM));
|
||||
|
||||
if (!data.hasUsedTemporaryData()) {
|
||||
data.setMana(data.getStats().getStat(StatType.MAX_MANA));
|
||||
data.setStamina(data.getStats().getStat(StatType.MAX_STAMINA));
|
||||
data.setStellium(data.getStats().getStat(StatType.MAX_STELLIUM));
|
||||
}
|
||||
|
||||
if (!isEmpty(result.getString("guild")))
|
||||
data.setGuild(MMOCore.plugin.dataProvider.getGuildManager().stillInGuild(data.getUniqueId(), result.getString("guild")));
|
||||
if (!isEmpty(result.getString("attributes"))) data.getAttributes().load(result.getString("attributes"));
|
||||
|
@ -32,9 +32,13 @@ public class YAMLPlayerDataManager extends PlayerDataManager {
|
||||
data.setExperience(config.getInt("experience"));
|
||||
if (config.contains("class"))
|
||||
data.setClass(MMOCore.plugin.classManager.get(config.getString("class")));
|
||||
data.setMana(data.getStats().getStat(StatType.MAX_MANA));
|
||||
data.setStamina(data.getStats().getStat(StatType.MAX_STAMINA));
|
||||
data.setStellium(data.getStats().getStat(StatType.MAX_STELLIUM));
|
||||
|
||||
if (!data.hasUsedTemporaryData()) {
|
||||
data.setMana(data.getStats().getStat(StatType.MAX_MANA));
|
||||
data.setStamina(data.getStats().getStat(StatType.MAX_STAMINA));
|
||||
data.setStellium(data.getStats().getStat(StatType.MAX_STELLIUM));
|
||||
}
|
||||
|
||||
if (config.contains("guild"))
|
||||
data.setGuild(MMOCore.plugin.dataProvider.getGuildManager().stillInGuild(data.getUniqueId(), config.getString("guild")));
|
||||
if (config.contains("attribute"))
|
||||
@ -55,9 +59,7 @@ public class YAMLPlayerDataManager extends PlayerDataManager {
|
||||
if (data.getProfess().hasSkill(id))
|
||||
data.getBoundSkills().add(data.getProfess().getSkill(id));
|
||||
|
||||
/*
|
||||
* load class slots, use try so the player can log in.
|
||||
*/
|
||||
// Load class slots, use try so the player can log in.
|
||||
if (config.contains("class-info"))
|
||||
for (String key : config.getConfigurationSection("class-info").getKeys(false))
|
||||
try {
|
||||
@ -67,6 +69,7 @@ public class YAMLPlayerDataManager extends PlayerDataManager {
|
||||
} catch (IllegalArgumentException exception) {
|
||||
MMOCore.log(Level.WARNING, "Could not load class info '" + key + "': " + exception.getMessage());
|
||||
}
|
||||
|
||||
data.setFullyLoaded();
|
||||
}
|
||||
|
||||
|
@ -1,18 +1,39 @@
|
||||
package net.Indyuce.mmocore.manager.profession;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.potion.PotionType;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.potion.PotionType;
|
||||
|
||||
import net.Indyuce.mmocore.manager.MMOManager;
|
||||
|
||||
public class AlchemyManager implements MMOManager {
|
||||
public class AlchemyManager extends SpecificProfessionManager {
|
||||
public double splash, lingering, upgrade, extend;
|
||||
|
||||
// private Map<PotionEffectType, Double> custom = new HashMap<>();
|
||||
private final Map<PotionType, Double> base = new HashMap<>();
|
||||
|
||||
public AlchemyManager() {
|
||||
super("alchemy-experience");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadProfessionConfiguration(ConfigurationSection config) {
|
||||
splash = 1 + config.getDouble("special.splash") / 100;
|
||||
lingering = 1 + config.getDouble("special.lingering") / 100;
|
||||
extend = 1 + config.getDouble("special.extend") / 100;
|
||||
upgrade = 1 + config.getDouble("special.upgrade") / 100;
|
||||
|
||||
for (String key : config.getConfigurationSection("effects").getKeys(false))
|
||||
try {
|
||||
PotionType type = PotionType.valueOf(key.toUpperCase().replace("-", "_").replace(" ", "_"));
|
||||
MMOCore.plugin.alchemyManager.registerBaseExperience(type, config.getDouble("effects." + key));
|
||||
} catch (IllegalArgumentException exception) {
|
||||
MMOCore.log(Level.WARNING, "Could not read potion type from " + key);
|
||||
}
|
||||
}
|
||||
|
||||
// public double getWeight(PotionEffectType type) {
|
||||
// return custom.containsKey(type) ? custom.get(type) : 0;
|
||||
// }
|
||||
@ -39,15 +60,11 @@ public class AlchemyManager implements MMOManager {
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void reload() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
splash = lingering = upgrade = extend = 1;
|
||||
base.clear();
|
||||
}
|
||||
@Override
|
||||
public void initialize(boolean clearBefore) {
|
||||
if (clearBefore) {
|
||||
splash = lingering = upgrade = extend = 1;
|
||||
base.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package net.Indyuce.mmocore.manager;
|
||||
package net.Indyuce.mmocore.manager.profession;
|
||||
|
||||
import io.papermc.lib.PaperLib;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
@ -11,6 +11,7 @@ import net.Indyuce.mmocore.loot.droptable.condition.Condition;
|
||||
import net.Indyuce.mmocore.loot.droptable.condition.ConditionInstance;
|
||||
import net.Indyuce.mmocore.api.util.MMOCoreUtils;
|
||||
import io.lumine.mythic.lib.api.MMOLineConfig;
|
||||
import net.Indyuce.mmocore.manager.profession.SpecificProfessionManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
@ -22,7 +23,7 @@ import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class CustomBlockManager implements MMOManager {
|
||||
public class CustomBlockManager extends SpecificProfessionManager {
|
||||
|
||||
/**
|
||||
* Registered block infos
|
||||
@ -49,6 +50,8 @@ public class CustomBlockManager implements MMOManager {
|
||||
private boolean protect;
|
||||
|
||||
public CustomBlockManager() {
|
||||
super("on-mine");
|
||||
|
||||
registerBlockType(block -> MMOCoreUtils.isPlayerHead(block.getType()) ? Optional.of(new SkullBlockType(block)) : Optional.empty());
|
||||
}
|
||||
|
||||
@ -160,7 +163,8 @@ public class CustomBlockManager implements MMOManager {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void loadDropTables(ConfigurationSection config) {
|
||||
@Override
|
||||
public void loadProfessionConfiguration(ConfigurationSection config) {
|
||||
for (String key : config.getKeys(false))
|
||||
try {
|
||||
register(new BlockInfo(config.getConfigurationSection(key)));
|
||||
@ -177,8 +181,11 @@ public class CustomBlockManager implements MMOManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reload() {
|
||||
customMineConditions.clear();
|
||||
public void initialize(boolean clearBefore) {
|
||||
if (clearBefore) {
|
||||
customMineConditions.clear();
|
||||
map.clear();
|
||||
}
|
||||
|
||||
this.protect = MMOCore.plugin.getConfig().getBoolean("protect-custom-mine");
|
||||
|
||||
@ -189,9 +196,4 @@ public class CustomBlockManager implements MMOManager {
|
||||
MMOCore.plugin.getLogger().log(Level.WARNING, "Could not load custom mining condition '" + key + "': " + exception.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
map.clear();
|
||||
}
|
||||
}
|
@ -1,15 +1,32 @@
|
||||
package net.Indyuce.mmocore.manager.profession;
|
||||
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
|
||||
import net.Indyuce.mmocore.manager.MMOManager;
|
||||
|
||||
public class EnchantManager implements MMOManager {
|
||||
public class EnchantManager extends SpecificProfessionManager {
|
||||
private final Map<Enchantment, Double> base = new HashMap<>();
|
||||
|
||||
public EnchantManager() {
|
||||
super("base-enchant-exp");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadProfessionConfiguration(ConfigurationSection config) {
|
||||
for (String key : config.getKeys(false))
|
||||
try {
|
||||
Enchantment enchant = MythicLib.plugin.getVersion().getWrapper().getEnchantmentFromString(key.toLowerCase().replace("-", "_"));
|
||||
MMOCore.plugin.enchantManager.registerBaseExperience(enchant, config.getDouble(key));
|
||||
} catch (IllegalArgumentException exception) {
|
||||
MMOCore.log(Level.WARNING, "Could not find enchant with name '" + key + "'");
|
||||
}
|
||||
}
|
||||
|
||||
public void registerBaseExperience(Enchantment enchant, double value) {
|
||||
base.put(enchant, value);
|
||||
}
|
||||
@ -19,13 +36,8 @@ public class EnchantManager implements MMOManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reload() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
base.clear();
|
||||
public void initialize(boolean clearBefore) {
|
||||
if (clearBefore)
|
||||
base.clear();
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,14 @@
|
||||
package net.Indyuce.mmocore.manager.profession;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.experience.source.type.ExperienceSource;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class ExperienceSourceManager<T> implements Listener {
|
||||
public abstract class ExperienceSourceManager<T extends ExperienceSource> implements Listener {
|
||||
|
||||
/**
|
||||
* List of all active experience sources
|
||||
@ -20,8 +21,6 @@ public abstract class ExperienceSourceManager<T> implements Listener {
|
||||
|
||||
public void registerSource(T source) {
|
||||
sources.add(source);
|
||||
|
||||
getSources();
|
||||
}
|
||||
|
||||
public Set<T> getSources() {
|
||||
|
@ -1,30 +1,28 @@
|
||||
package net.Indyuce.mmocore.manager.profession;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import io.lumine.mythic.lib.api.MMOLineConfig;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.loot.droptable.condition.Condition;
|
||||
import net.Indyuce.mmocore.loot.droptable.condition.ConditionInstance;
|
||||
import net.Indyuce.mmocore.loot.droptable.dropitem.fishing.FishingDropItem;
|
||||
import net.Indyuce.mmocore.manager.MMOManager;
|
||||
import io.lumine.mythic.lib.api.MMOLineConfig;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
public class FishingManager implements MMOManager {
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class FishingManager extends SpecificProfessionManager {
|
||||
private final Set<FishingDropTable> tables = new LinkedHashSet<>();
|
||||
|
||||
private static final Random random = new Random();
|
||||
|
||||
public void loadDropTables(ConfigurationSection config) {
|
||||
public FishingManager() {
|
||||
super("on-fish");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadProfessionConfiguration(ConfigurationSection config) {
|
||||
for (String key : config.getKeys(false))
|
||||
try {
|
||||
tables.add(new FishingDropTable(config.getConfigurationSection(key)));
|
||||
@ -107,12 +105,8 @@ public class FishingManager implements MMOManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reload() {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
tables.clear();
|
||||
public void initialize(boolean clearBefore) {
|
||||
if (clearBefore)
|
||||
tables.clear();
|
||||
}
|
||||
}
|
||||
|
@ -1,50 +1,41 @@
|
||||
package net.Indyuce.mmocore.manager.profession;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import io.lumine.mythic.lib.api.util.PostLoadObject;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.experience.Profession;
|
||||
import net.Indyuce.mmocore.experience.source.type.ExperienceSource;
|
||||
import net.Indyuce.mmocore.manager.MMOManager;
|
||||
import net.Indyuce.mmocore.manager.MMOCoreManager;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ProfessionManager implements MMOManager {
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* Loaded professions.
|
||||
*/
|
||||
public class ProfessionManager implements MMOCoreManager {
|
||||
private final Map<String, Profession> professions = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Saves different experience sources based on experience source type.
|
||||
*/
|
||||
private final Map<Class<?>, ExperienceSourceManager<?>> managers = new HashMap<>();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> ExperienceSourceManager<T> getManager(Class<T> t) {
|
||||
return (ExperienceSourceManager<T>) managers.get(t);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends ExperienceSource<?>> void registerExpSource(T source) {
|
||||
Class<T> path = (Class<T>) source.getClass();
|
||||
|
||||
if (!managers.containsKey(path))
|
||||
managers.put(path, source.newManager());
|
||||
getManager(path).registerSource(source);
|
||||
}
|
||||
private final Set<SpecificProfessionManager> professionManagers = new HashSet<>();
|
||||
|
||||
public void register(Profession profession) {
|
||||
professions.put(profession.getId(), profession);
|
||||
}
|
||||
|
||||
public void registerProfessionManager(@NotNull SpecificProfessionManager professionManager) {
|
||||
Validate.notNull(professionManager);
|
||||
|
||||
professionManagers.add(professionManager);
|
||||
}
|
||||
|
||||
public void loadProfessionConfigurations(ConfigurationSection config) {
|
||||
for (SpecificProfessionManager manager : professionManagers)
|
||||
if (config.contains(manager.getStringKey()))
|
||||
try {
|
||||
manager.loadProfessionConfiguration(config.getConfigurationSection(manager.getStringKey()));
|
||||
} catch (RuntimeException exception) {
|
||||
MMOCore.plugin.getLogger().log(Level.WARNING, "Could not load profession config '" + manager.getStringKey() + "': " + exception.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public Profession get(String id) {
|
||||
return professions.get(id);
|
||||
}
|
||||
@ -58,7 +49,20 @@ public class ProfessionManager implements MMOManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reload() {
|
||||
public void initialize(boolean clearBefore) {
|
||||
if (clearBefore)
|
||||
professions.clear();
|
||||
|
||||
// Load default profession managers (can't be done on constructor because MMOCore.plugin is null)
|
||||
if (professionManagers.isEmpty()) {
|
||||
registerProfessionManager(MMOCore.plugin.alchemyManager);
|
||||
registerProfessionManager(MMOCore.plugin.enchantManager);
|
||||
registerProfessionManager(MMOCore.plugin.fishingManager);
|
||||
registerProfessionManager(MMOCore.plugin.smithingManager);
|
||||
}
|
||||
|
||||
professionManagers.forEach(manager -> manager.initialize(clearBefore));
|
||||
|
||||
for (File file : new File(MMOCore.plugin.getDataFolder() + "/professions").listFiles())
|
||||
try {
|
||||
String id = file.getName().substring(0, file.getName().length() - 4);
|
||||
@ -66,14 +70,5 @@ public class ProfessionManager implements MMOManager {
|
||||
} catch (IllegalArgumentException exception) {
|
||||
MMOCore.plugin.getLogger().log(Level.WARNING, "Could not load profession " + file.getName() + ": " + exception.getMessage());
|
||||
}
|
||||
|
||||
getAll().forEach(PostLoadObject::postLoad);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
managers.values().forEach(HandlerList::unregisterAll);
|
||||
managers.clear();
|
||||
professions.clear();
|
||||
}
|
||||
}
|
||||
|
@ -1,35 +1,44 @@
|
||||
package net.Indyuce.mmocore.manager.profession;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Material;
|
||||
public class SmithingManager extends SpecificProfessionManager {
|
||||
private final Map<Material, Double> base = new HashMap<>();
|
||||
|
||||
import net.Indyuce.mmocore.manager.MMOManager;
|
||||
public SmithingManager() {
|
||||
super("repair-exp");
|
||||
}
|
||||
|
||||
public class SmithingManager implements MMOManager {
|
||||
private final Map<Material, Double> base = new HashMap<>();
|
||||
public void registerBaseExperience(Material material, double value) {
|
||||
base.put(material, value);
|
||||
}
|
||||
|
||||
public void registerBaseExperience(Material material, double value) {
|
||||
base.put(material, value);
|
||||
}
|
||||
public double getBaseExperience(Material material) {
|
||||
return base.get(material);
|
||||
}
|
||||
|
||||
public double getBaseExperience(Material material) {
|
||||
return base.get(material);
|
||||
}
|
||||
|
||||
public boolean hasExperience(Material material) {
|
||||
return base.containsKey(material);
|
||||
}
|
||||
public boolean hasExperience(Material material) {
|
||||
return base.containsKey(material);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reload() {
|
||||
// TODO Auto-generated method stub
|
||||
@Override
|
||||
public void loadProfessionConfiguration(ConfigurationSection config) {
|
||||
for (String key : config.getKeys(false))
|
||||
try {
|
||||
Material material = Material.valueOf(key.toUpperCase().replace("-", "_").replace(" ", "_"));
|
||||
registerBaseExperience(material, config.getDouble(key));
|
||||
} catch (IllegalArgumentException exception) {
|
||||
throw new RuntimeException("Could not read material from '" + key + "'");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
base.clear();
|
||||
}
|
||||
@Override
|
||||
public void initialize(boolean clearBefore) {
|
||||
if (clearBefore)
|
||||
base.clear();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
package net.Indyuce.mmocore.manager.profession;
|
||||
|
||||
import net.Indyuce.mmocore.manager.MMOCoreManager;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
public abstract class SpecificProfessionManager implements MMOCoreManager {
|
||||
|
||||
/**
|
||||
* String key used to detect and load profession config in any
|
||||
* profession.yml config
|
||||
*/
|
||||
private final String key;
|
||||
|
||||
public SpecificProfessionManager(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getStringKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public abstract void loadProfessionConfiguration(ConfigurationSection config);
|
||||
}
|
@ -5,7 +5,7 @@ import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.social.Party;
|
||||
import net.Indyuce.mmocore.api.player.stats.StatType;
|
||||
import net.Indyuce.mmocore.manager.MMOManager;
|
||||
import net.Indyuce.mmocore.manager.MMOCoreManager;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import java.util.HashMap;
|
||||
@ -14,8 +14,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
||||
public class PartyManager implements MMOManager {
|
||||
public class PartyManager implements MMOCoreManager {
|
||||
private final Set<Party> parties = new HashSet<>();
|
||||
private final Map<StatType, StatModifier> buffs = new HashMap<>();
|
||||
|
||||
@ -34,7 +33,7 @@ public class PartyManager implements MMOManager {
|
||||
}
|
||||
|
||||
public void unregisterParty(Party party) {
|
||||
// IMPORTANT: clears all party stats before unregistering the party
|
||||
// IMPORTANT: clears all party members before unregistering the party
|
||||
party.getMembers().forEach(party::removeMember);
|
||||
parties.remove(party);
|
||||
}
|
||||
@ -52,7 +51,10 @@ public class PartyManager implements MMOManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reload() {
|
||||
public void initialize(boolean clearBefore) {
|
||||
if (clearBefore)
|
||||
buffs.clear();
|
||||
|
||||
ConfigurationSection config = MMOCore.plugin.getConfig().getConfigurationSection("party.buff");
|
||||
if (config != null)
|
||||
for (String key : config.getKeys(false))
|
||||
@ -63,9 +65,4 @@ public class PartyManager implements MMOManager {
|
||||
MMOCore.log(Level.WARNING, "Could not load party buff '" + key + "': " + exception.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
buffs.clear();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user