forked from Upstream/mmocore
Merge remote-tracking branch 'origin/master'
# Conflicts: # MMOCore-Dist/src/main/java/net/Indyuce/mmocore/listener/PlayerListener.java
This commit is contained in:
commit
817d28c602
@ -190,7 +190,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
|
|
||||||
|
|
||||||
public int getPointSpent(SkillTree skillTree) {
|
public int getPointSpent(SkillTree skillTree) {
|
||||||
return pointSpent.get(skillTree);
|
return pointSpent.getOrDefault(skillTree,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void giveSkillTreePoints(String id, int val) {
|
public void giveSkillTreePoints(String id, int val) {
|
||||||
skillTreePoints.put(id, skillTreePoints.get(id) + val);
|
skillTreePoints.put(id, skillTreePoints.getOrDefault(id,0) + val);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int countSkillTreePoints(SkillTree skillTree) {
|
public int countSkillTreePoints(SkillTree skillTree) {
|
||||||
@ -296,7 +296,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getNodeLevel(SkillTreeNode node) {
|
public int getNodeLevel(SkillTreeNode node) {
|
||||||
return nodeLevels.get(node);
|
return nodeLevels.getOrDefault(node,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNodeLevel(SkillTreeNode node, int nodeLevel) {
|
public void setNodeLevel(SkillTreeNode node, int nodeLevel) {
|
||||||
|
@ -97,8 +97,16 @@ public class PlayerStats {
|
|||||||
* This updates the player's PASSIVE skills
|
* This updates the player's PASSIVE skills
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
final PassiveSkillMap skillMap = data.getMMOPlayerData().getPassiveSkillMap();
|
final PassiveSkillMap skillMap = data.getMMOPlayerData().getPassiveSkillMap();
|
||||||
|
|
||||||
|
if(!MMOCore.plugin.configManager.passiveSkillNeedBound) {
|
||||||
|
skillMap.removeModifiers("MMOCorePassiveSkill");
|
||||||
|
for (ClassSkill skill : data.getProfess().getSkills())
|
||||||
|
if (skill.getSkill().getTrigger().isPassive())
|
||||||
|
skillMap.addModifier(skill.toPassive(data));
|
||||||
|
}
|
||||||
|
|
||||||
// This updates the player's class SCRIPTS
|
// This updates the player's class SCRIPTS
|
||||||
skillMap.removeModifiers("MMOCoreClassScript");
|
skillMap.removeModifiers("MMOCoreClassScript");
|
||||||
for (PassiveSkill script : data.getProfess().getScripts())
|
for (PassiveSkill script : data.getProfess().getScripts())
|
||||||
|
@ -101,7 +101,8 @@ public class PlayerProfessions {
|
|||||||
playerData.getItemClaims().put("profession." + entry.getKey(), entry.getValue().getAsInt());
|
playerData.getItemClaims().put("profession." + entry.getKey(), entry.getValue().getAsInt());
|
||||||
|
|
||||||
for (Profession profession : MMOCore.plugin.professionManager.getAll()) {
|
for (Profession profession : MMOCore.plugin.professionManager.getAll()) {
|
||||||
profession.getExperienceTable().claimStatTriggers(playerData, profession);
|
if (profession.hasExperienceTable())
|
||||||
|
profession.getExperienceTable().claimStatTriggers(playerData, profession);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,10 @@ import org.bukkit.inventory.InventoryHolder;
|
|||||||
public abstract class PluginInventory implements InventoryHolder {
|
public abstract class PluginInventory implements InventoryHolder {
|
||||||
protected final Player player;
|
protected final Player player;
|
||||||
protected final PlayerData playerData;
|
protected final PlayerData playerData;
|
||||||
|
/**
|
||||||
|
* If all the clicks sould be cancelled for the inventory
|
||||||
|
*/
|
||||||
|
private boolean shouldCancel = true;
|
||||||
|
|
||||||
public PluginInventory(PlayerData playerData) {
|
public PluginInventory(PlayerData playerData) {
|
||||||
this.playerData = playerData;
|
this.playerData = playerData;
|
||||||
@ -19,6 +23,15 @@ public abstract class PluginInventory implements InventoryHolder {
|
|||||||
this.playerData = player.getOpenInventory() != null && player.getOpenInventory().getTopInventory().getHolder() instanceof PluginInventory ? ((PluginInventory) player.getOpenInventory().getTopInventory().getHolder()).playerData : PlayerData.get(player);
|
this.playerData = player.getOpenInventory() != null && player.getOpenInventory().getTopInventory().getHolder() instanceof PluginInventory ? ((PluginInventory) player.getOpenInventory().getTopInventory().getHolder()).playerData : PlayerData.get(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PluginInventory(Player player, boolean shouldCancel) {
|
||||||
|
this(player);
|
||||||
|
this.shouldCancel=shouldCancel;
|
||||||
|
}
|
||||||
|
public PluginInventory(PlayerData playerData, boolean shouldCancel) {
|
||||||
|
this(playerData);
|
||||||
|
this.shouldCancel=shouldCancel;
|
||||||
|
}
|
||||||
|
|
||||||
public PlayerData getPlayerData() {
|
public PlayerData getPlayerData() {
|
||||||
return playerData;
|
return playerData;
|
||||||
}
|
}
|
||||||
@ -27,6 +40,10 @@ public abstract class PluginInventory implements InventoryHolder {
|
|||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean shouldCancel() {
|
||||||
|
return shouldCancel;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens classic inventory, throws
|
* Opens classic inventory, throws
|
||||||
*/
|
*/
|
||||||
|
@ -30,7 +30,7 @@ public class DepositMenu extends PluginInventory {
|
|||||||
private BukkitRunnable updateRunnable;
|
private BukkitRunnable updateRunnable;
|
||||||
|
|
||||||
public DepositMenu(Player player) {
|
public DepositMenu(Player player) {
|
||||||
super(player);
|
super(player,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -22,7 +22,7 @@ import java.util.logging.Level;
|
|||||||
public class ConfigManager {
|
public class ConfigManager {
|
||||||
public final CommandVerbose commandVerbose = new CommandVerbose();
|
public final CommandVerbose commandVerbose = new CommandVerbose();
|
||||||
|
|
||||||
public boolean overrideVanillaExp, canCreativeCast, cobbleGeneratorXP, saveDefaultClassInfo, attributesAsClassInfo, splitProfessionExp, disableQuestBossBar;
|
public boolean overrideVanillaExp, canCreativeCast, passiveSkillNeedBound, cobbleGeneratorXP, saveDefaultClassInfo, attributesAsClassInfo, splitProfessionExp, disableQuestBossBar;
|
||||||
public String partyChatPrefix, noSkillBoundPlaceholder;
|
public String partyChatPrefix, noSkillBoundPlaceholder;
|
||||||
public ChatColor staminaFull, staminaHalf, staminaEmpty;
|
public ChatColor staminaFull, staminaHalf, staminaEmpty;
|
||||||
public long combatLogTimer, lootChestExpireTime, lootChestPlayerCooldown, globalSkillCooldown;
|
public long combatLogTimer, lootChestExpireTime, lootChestPlayerCooldown, globalSkillCooldown;
|
||||||
@ -115,7 +115,7 @@ public class ConfigManager {
|
|||||||
staminaFull = getColorOrDefault("stamina-whole", ChatColor.GREEN);
|
staminaFull = getColorOrDefault("stamina-whole", ChatColor.GREEN);
|
||||||
staminaHalf = getColorOrDefault("stamina-half", ChatColor.DARK_GREEN);
|
staminaHalf = getColorOrDefault("stamina-half", ChatColor.DARK_GREEN);
|
||||||
staminaEmpty = getColorOrDefault("stamina-empty", ChatColor.WHITE);
|
staminaEmpty = getColorOrDefault("stamina-empty", ChatColor.WHITE);
|
||||||
|
passiveSkillNeedBound = MMOCore.plugin.getConfig().getBoolean("passive-skill-need-bound");
|
||||||
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");
|
||||||
@ -135,7 +135,7 @@ public class ConfigManager {
|
|||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public PlayerInput newPlayerInput(Player player, InputType type, Consumer<String> output) {
|
public PlayerInput newPlayerInput(Player player, InputType type, Consumer<String> output) {
|
||||||
return new ChatInput(player, type, output) ;
|
return new ChatInput(player, type, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadDefaultFile(String name) {
|
public void loadDefaultFile(String name) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.Indyuce.mmocore.manager.data.mysql;
|
package net.Indyuce.mmocore.manager.data.mysql;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
@ -110,7 +111,7 @@ public class MySQLPlayerDataManager extends PlayerDataManager {
|
|||||||
if (!isEmpty(result.getString("friends")))
|
if (!isEmpty(result.getString("friends")))
|
||||||
MMOCoreUtils.jsonArrayToList(result.getString("friends")).forEach(str -> data.getFriends().add(UUID.fromString(str)));
|
MMOCoreUtils.jsonArrayToList(result.getString("friends")).forEach(str -> data.getFriends().add(UUID.fromString(str)));
|
||||||
if (!isEmpty(result.getString("skills"))) {
|
if (!isEmpty(result.getString("skills"))) {
|
||||||
JsonObject object = MythicLib.plugin.getJson().parse(result.getString("skills"), JsonObject.class);
|
JsonObject object=new Gson().fromJson(result.getString("skills"), JsonObject.class);
|
||||||
for (Entry<String, JsonElement> entry : object.entrySet())
|
for (Entry<String, JsonElement> entry : object.entrySet())
|
||||||
data.setSkillLevel(entry.getKey(), entry.getValue().getAsInt());
|
data.setSkillLevel(entry.getKey(), entry.getValue().getAsInt());
|
||||||
}
|
}
|
||||||
|
@ -188,6 +188,12 @@ death-exp-loss:
|
|||||||
#Default max bound active and passive skills.
|
#Default max bound active and passive skills.
|
||||||
#These value can be modified for each class in the class yml.
|
#These value can be modified for each class in the class yml.
|
||||||
max-bound-active-skills: 6
|
max-bound-active-skills: 6
|
||||||
|
|
||||||
|
#If you want players to bound their passive skills.
|
||||||
|
#If false, all the passive skills unlocked will be active
|
||||||
|
#Also set max-bound-passive-skills to 0 if seting passive-skill-need-bound to false.
|
||||||
|
passive-skill-need-bound: true
|
||||||
|
|
||||||
max-bound-passive-skills: 3
|
max-bound-passive-skills: 3
|
||||||
|
|
||||||
# Fun extra RPG feature that switches the player's hotbar with
|
# Fun extra RPG feature that switches the player's hotbar with
|
||||||
|
@ -34,7 +34,7 @@ items:
|
|||||||
lore: { }
|
lore: { }
|
||||||
|
|
||||||
reallocate:
|
reallocate:
|
||||||
slots: [26]
|
slots: [45]
|
||||||
function: reallocation
|
function: reallocation
|
||||||
item: CAULDRON
|
item: CAULDRON
|
||||||
name: '&aReallocate Skill Points'
|
name: '&aReallocate Skill Points'
|
||||||
@ -46,19 +46,7 @@ items:
|
|||||||
- '&eCosts 1 skill reallocation point.'
|
- '&eCosts 1 skill reallocation point.'
|
||||||
- '&e◆ Skill Reallocation Points: &6{points}'
|
- '&e◆ Skill Reallocation Points: &6{points}'
|
||||||
|
|
||||||
#switch:
|
|
||||||
#
|
|
||||||
# slots: [28]
|
|
||||||
# function: switch
|
|
||||||
# item: PLAYER_HEAD
|
|
||||||
# binding:
|
|
||||||
# item: PINK_STAINED_GLASS
|
|
||||||
# name: '&aSwitch to Binding'
|
|
||||||
# lore: {}
|
|
||||||
# upgrading:
|
|
||||||
# item: PINK_STAINED_GLASS
|
|
||||||
# name: '&aSwitch to Upgrading'
|
|
||||||
# lore: {}
|
|
||||||
passive-skill-slot:
|
passive-skill-slot:
|
||||||
slots: [ 7,16,25,34,43,52 ]
|
slots: [ 7,16,25,34,43,52 ]
|
||||||
function: passive-slot
|
function: passive-slot
|
||||||
|
Loading…
Reference in New Issue
Block a user