forked from Upstream/mmocore
Fixed exp bar frozen when reloading MMOCore
This commit is contained in:
parent
056d1f57ec
commit
4e72967321
@ -111,11 +111,11 @@ public class MMOCore extends JavaPlugin {
|
|||||||
MythicLib.plugin.getEntities().registerRestriction(new MMOCoreTargetRestriction());
|
MythicLib.plugin.getEntities().registerRestriction(new MMOCoreTargetRestriction());
|
||||||
MythicLib.plugin.getModifiers().registerModifierType("attribute", configObject -> new AttributeModifier(configObject));
|
MythicLib.plugin.getModifiers().registerModifierType("attribute", configObject -> new AttributeModifier(configObject));
|
||||||
|
|
||||||
// Skill creation
|
// Custom scripts
|
||||||
MythicLib.plugin.getSkills().registerMechanic("mana", config -> new ManaMechanic(config));
|
MythicLib.plugin.getSkills().registerMechanic("mana", config -> new ManaMechanic(config));
|
||||||
MythicLib.plugin.getSkills().registerMechanic("stamina", config -> new StaminaMechanic(config));
|
MythicLib.plugin.getSkills().registerMechanic("stamina", config -> new StaminaMechanic(config));
|
||||||
MythicLib.plugin.getSkills().registerMechanic("stellium", config -> new StelliumMechanic(config));
|
MythicLib.plugin.getSkills().registerMechanic("stellium", config -> new StelliumMechanic(config));
|
||||||
MythicLib.plugin.getSkills().registerMechanic("experience", config -> new ExperienceMechanic(config));
|
MythicLib.plugin.getSkills().registerMechanic("mmocore_experience", config -> new ExperienceMechanic(config));
|
||||||
|
|
||||||
// Register extra objective, drop items...
|
// Register extra objective, drop items...
|
||||||
if (Bukkit.getPluginManager().getPlugin("WorldGuard") != null)
|
if (Bukkit.getPluginManager().getPlugin("WorldGuard") != null)
|
||||||
|
@ -4,7 +4,6 @@ import io.lumine.mythic.lib.MythicLib;
|
|||||||
import io.lumine.mythic.lib.api.player.MMOPlayerData;
|
import io.lumine.mythic.lib.api.player.MMOPlayerData;
|
||||||
import io.lumine.mythic.lib.player.cooldown.CooldownMap;
|
import io.lumine.mythic.lib.player.cooldown.CooldownMap;
|
||||||
import io.lumine.mythic.lib.player.modifier.PlayerModifier;
|
import io.lumine.mythic.lib.player.modifier.PlayerModifier;
|
||||||
import net.Indyuce.mmocore.party.provided.Party;
|
|
||||||
import net.Indyuce.mmocore.MMOCore;
|
import net.Indyuce.mmocore.MMOCore;
|
||||||
import net.Indyuce.mmocore.api.ConfigMessage;
|
import net.Indyuce.mmocore.api.ConfigMessage;
|
||||||
import net.Indyuce.mmocore.api.SoundEvent;
|
import net.Indyuce.mmocore.api.SoundEvent;
|
||||||
@ -32,6 +31,7 @@ import net.Indyuce.mmocore.experience.droptable.ExperienceTable;
|
|||||||
import net.Indyuce.mmocore.guild.provided.Guild;
|
import net.Indyuce.mmocore.guild.provided.Guild;
|
||||||
import net.Indyuce.mmocore.loot.chest.particle.SmallParticleEffect;
|
import net.Indyuce.mmocore.loot.chest.particle.SmallParticleEffect;
|
||||||
import net.Indyuce.mmocore.party.AbstractParty;
|
import net.Indyuce.mmocore.party.AbstractParty;
|
||||||
|
import net.Indyuce.mmocore.party.provided.Party;
|
||||||
import net.Indyuce.mmocore.player.Unlockable;
|
import net.Indyuce.mmocore.player.Unlockable;
|
||||||
import net.Indyuce.mmocore.skill.ClassSkill;
|
import net.Indyuce.mmocore.skill.ClassSkill;
|
||||||
import net.Indyuce.mmocore.skill.RegisteredSkill;
|
import net.Indyuce.mmocore.skill.RegisteredSkill;
|
||||||
@ -416,14 +416,14 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void giveSkillReallocationPoints(int value) {
|
public void giveSkillReallocationPoints(int value) {
|
||||||
skillReallocationPoints+=value;
|
skillReallocationPoints += value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int countSkillPointsWhenReallocate() {
|
public int countSkillPointsWhenReallocate() {
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
for(ClassSkill skill:getProfess().getSkills()) {
|
for (ClassSkill skill : getProfess().getSkills()) {
|
||||||
//0 if the skill is level 1(just unlocked) or 0 locked.
|
//0 if the skill is level 1(just unlocked) or 0 locked.
|
||||||
sum+=Math.max(0,getSkillLevel(skill.getSkill())-1);
|
sum += Math.max(0, getSkillLevel(skill.getSkill()) - 1);
|
||||||
}
|
}
|
||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
@ -526,7 +526,6 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
if (!MMOCore.plugin.configManager.overrideVanillaExp)
|
if (!MMOCore.plugin.configManager.overrideVanillaExp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
getPlayer().sendExperienceChange(0.01f);
|
|
||||||
getPlayer().setLevel(getLevel());
|
getPlayer().setLevel(getLevel());
|
||||||
getPlayer().setExp(Math.max(0, Math.min(1, (float) experience / (float) getLevelUpExperience())));
|
getPlayer().setExp(Math.max(0, Math.min(1, (float) experience / (float) getLevelUpExperience())));
|
||||||
}
|
}
|
||||||
@ -1081,7 +1080,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
* checks if they could potentially upgrade to one of these
|
* checks if they could potentially upgrade to one of these
|
||||||
*
|
*
|
||||||
* @return If the player can change its current class to
|
* @return If the player can change its current class to
|
||||||
* a subclass
|
* a subclass
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean canChooseSubclass() {
|
public boolean canChooseSubclass() {
|
||||||
|
@ -2,8 +2,8 @@ package net.Indyuce.mmocore.manager;
|
|||||||
|
|
||||||
import io.lumine.mythic.lib.MythicLib;
|
import io.lumine.mythic.lib.MythicLib;
|
||||||
import net.Indyuce.mmocore.MMOCore;
|
import net.Indyuce.mmocore.MMOCore;
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
|
||||||
import net.Indyuce.mmocore.api.ConfigFile;
|
import net.Indyuce.mmocore.api.ConfigFile;
|
||||||
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
import net.Indyuce.mmocore.api.util.input.ChatInput;
|
import net.Indyuce.mmocore.api.util.input.ChatInput;
|
||||||
import net.Indyuce.mmocore.api.util.input.PlayerInput;
|
import net.Indyuce.mmocore.api.util.input.PlayerInput;
|
||||||
import net.Indyuce.mmocore.api.util.input.PlayerInput.InputType;
|
import net.Indyuce.mmocore.api.util.input.PlayerInput.InputType;
|
||||||
@ -21,21 +21,14 @@ import java.util.logging.Level;
|
|||||||
|
|
||||||
public class ConfigManager {
|
public class ConfigManager {
|
||||||
public final CommandVerbose commandVerbose = new CommandVerbose();
|
public final CommandVerbose commandVerbose = new CommandVerbose();
|
||||||
|
public final boolean overrideVanillaExp, canCreativeCast, cobbleGeneratorXP, saveDefaultClassInfo, splitProfessionExp, questBossBar;
|
||||||
public boolean overrideVanillaExp, canCreativeCast, cobbleGeneratorXP, saveDefaultClassInfo, attributesAsClassInfo, splitProfessionExp, questBossBar;
|
public final String partyChatPrefix, noSkillBoundPlaceholder;
|
||||||
public String partyChatPrefix, noSkillBoundPlaceholder;
|
public final ChatColor staminaFull, staminaHalf, staminaEmpty;
|
||||||
public ChatColor staminaFull, staminaHalf, staminaEmpty;
|
public final long combatLogTimer, lootChestExpireTime, lootChestPlayerCooldown, globalSkillCooldown;
|
||||||
public long combatLogTimer, lootChestExpireTime, lootChestPlayerCooldown, globalSkillCooldown;
|
public final double lootChestsChanceWeight, fishingDropsChanceWeight;
|
||||||
public double lootChestsChanceWeight, fishingDropsChanceWeight;
|
public final int maxPartyLevelDifference, maxBoundSkills;
|
||||||
public int maxPartyLevelDifference,maxBoundSkills;
|
|
||||||
|
|
||||||
private final FileConfiguration messages;
|
private final FileConfiguration messages;
|
||||||
|
|
||||||
/*
|
|
||||||
* the instance must be created after the other managers since all it does
|
|
||||||
* is to update them based on the config except for the classes which are
|
|
||||||
* already loaded based on the config
|
|
||||||
*/
|
|
||||||
public ConfigManager() {
|
public ConfigManager() {
|
||||||
// loadDefaultFile("recipes", "brewing.yml");
|
// loadDefaultFile("recipes", "brewing.yml");
|
||||||
// loadDefaultFile("recipes", "furnace.yml");
|
// loadDefaultFile("recipes", "furnace.yml");
|
||||||
@ -74,6 +67,7 @@ public class ConfigManager {
|
|||||||
loadDefaultFile("expcurves", "levels.txt");
|
loadDefaultFile("expcurves", "levels.txt");
|
||||||
loadDefaultFile("expcurves", "mining.txt");
|
loadDefaultFile("expcurves", "mining.txt");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!new File(MMOCore.plugin.getDataFolder()+"/skilltree").exists()) {
|
if(!new File(MMOCore.plugin.getDataFolder()+"/skilltree").exists()) {
|
||||||
loadDefaultFile("skilltree","combat.yml");
|
loadDefaultFile("skilltree","combat.yml");
|
||||||
}
|
}
|
||||||
@ -115,7 +109,8 @@ public class ConfigManager {
|
|||||||
canCreativeCast = MMOCore.plugin.getConfig().getBoolean("can-creative-cast");
|
canCreativeCast = MMOCore.plugin.getConfig().getBoolean("can-creative-cast");
|
||||||
cobbleGeneratorXP = MMOCore.plugin.getConfig().getBoolean("should-cobblestone-generators-give-exp");
|
cobbleGeneratorXP = MMOCore.plugin.getConfig().getBoolean("should-cobblestone-generators-give-exp");
|
||||||
saveDefaultClassInfo = MMOCore.plugin.getConfig().getBoolean("save-default-class-info");
|
saveDefaultClassInfo = MMOCore.plugin.getConfig().getBoolean("save-default-class-info");
|
||||||
maxBoundSkills= MMOCore.plugin.getConfig().getInt("max-bound-skills",6);
|
maxBoundSkills = MMOCore.plugin.getConfig().getInt("max-bound-skills",6);
|
||||||
|
overrideVanillaExp = MMOCore.plugin.getConfig().getBoolean("override-vanilla-exp");
|
||||||
}
|
}
|
||||||
|
|
||||||
private ChatColor getColorOrDefault(String key, ChatColor defaultColor) {
|
private ChatColor getColorOrDefault(String key, ChatColor defaultColor) {
|
||||||
|
@ -16,7 +16,7 @@ public class MMOCoreBukkit {
|
|||||||
* all the listeners required for MMOCore to run
|
* all the listeners required for MMOCore to run
|
||||||
*/
|
*/
|
||||||
public MMOCoreBukkit(MMOCore plugin) {
|
public MMOCoreBukkit(MMOCore plugin) {
|
||||||
if (plugin.configManager.overrideVanillaExp = plugin.getConfig().getBoolean("override-vanilla-exp"))
|
if (plugin.configManager.overrideVanillaExp)
|
||||||
Bukkit.getPluginManager().registerEvents(new VanillaExperienceOverride(), plugin);
|
Bukkit.getPluginManager().registerEvents(new VanillaExperienceOverride(), plugin);
|
||||||
|
|
||||||
if (plugin.getConfig().getBoolean("hotbar-swapping.enabled"))
|
if (plugin.getConfig().getBoolean("hotbar-swapping.enabled"))
|
||||||
|
Loading…
Reference in New Issue
Block a user