forked from Upstream/mmocore
!MMOLib update 2
This commit is contained in:
parent
6913e8b0cc
commit
2c5309b417
Binary file not shown.
@ -78,7 +78,7 @@ public class PlayerData {
|
|||||||
private final List<SkillInfo> boundSkills = new ArrayList<>();
|
private final List<SkillInfo> boundSkills = new ArrayList<>();
|
||||||
private final PlayerAttributes attributes = new PlayerAttributes(this);
|
private final PlayerAttributes attributes = new PlayerAttributes(this);
|
||||||
|
|
||||||
private final PlayerStats playerStats = new PlayerStats(this);
|
private final PlayerStats playerStats;
|
||||||
private long lastWaypoint, lastLogin, lastFriendRequest, actionBarTimeOut;
|
private long lastWaypoint, lastLogin, lastFriendRequest, actionBarTimeOut;
|
||||||
|
|
||||||
private final Map<String, Integer> skills = new HashMap<>();
|
private final Map<String, Integer> skills = new HashMap<>();
|
||||||
@ -97,6 +97,7 @@ public class PlayerData {
|
|||||||
private PlayerData(Player player) {
|
private PlayerData(Player player) {
|
||||||
uuid = player.getUniqueId();
|
uuid = player.getUniqueId();
|
||||||
setPlayer(player);
|
setPlayer(player);
|
||||||
|
playerStats = new PlayerStats(this);
|
||||||
|
|
||||||
questData = new PlayerQuests(this);
|
questData = new PlayerQuests(this);
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,8 @@ import net.Indyuce.mmocore.api.player.PlayerData;
|
|||||||
import net.mmogroup.mmolib.MMOLib;
|
import net.mmogroup.mmolib.MMOLib;
|
||||||
import net.mmogroup.mmolib.api.AttackResult;
|
import net.mmogroup.mmolib.api.AttackResult;
|
||||||
import net.mmogroup.mmolib.api.DamageType;
|
import net.mmogroup.mmolib.api.DamageType;
|
||||||
|
import net.mmogroup.mmolib.api.stat.StatInstance;
|
||||||
import net.mmogroup.mmolib.api.stat.StatMap;
|
import net.mmogroup.mmolib.api.stat.StatMap;
|
||||||
import net.mmogroup.mmolib.api.stat.StatMap.StatInstance;
|
|
||||||
|
|
||||||
public class PlayerStats {
|
public class PlayerStats {
|
||||||
private final PlayerData data;
|
private final PlayerData data;
|
||||||
|
@ -13,6 +13,7 @@ import net.Indyuce.mmocore.api.player.stats.StatType;
|
|||||||
import net.mmogroup.mmolib.api.player.MMOData;
|
import net.mmogroup.mmolib.api.player.MMOData;
|
||||||
import net.mmogroup.mmolib.api.stat.SharedStat;
|
import net.mmogroup.mmolib.api.stat.SharedStat;
|
||||||
import net.mmogroup.mmolib.api.stat.StatMap;
|
import net.mmogroup.mmolib.api.stat.StatMap;
|
||||||
|
import net.mmogroup.mmolib.api.stat.instance.MMOCoreStatInstance;
|
||||||
|
|
||||||
public class MMOLibHook {
|
public class MMOLibHook {
|
||||||
public MMOLibHook() {
|
public MMOLibHook() {
|
||||||
@ -27,6 +28,8 @@ public class MMOLibHook {
|
|||||||
Consumer<MMOData> moveSpeed = new MovementSpeedStat();
|
Consumer<MMOData> moveSpeed = new MovementSpeedStat();
|
||||||
StatMap.registerUpdate(SharedStat.MOVEMENT_SPEED, moveSpeed);
|
StatMap.registerUpdate(SharedStat.MOVEMENT_SPEED, moveSpeed);
|
||||||
StatMap.registerUpdate(SharedStat.SPEED_MALUS_REDUCTION, moveSpeed);
|
StatMap.registerUpdate(SharedStat.SPEED_MALUS_REDUCTION, moveSpeed);
|
||||||
|
|
||||||
|
StatMap.setInstanceGenerator((map, stat) -> new MMOCoreStatInstance(map, stat));
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AttributeStatHandler implements Consumer<MMOData> {
|
public class AttributeStatHandler implements Consumer<MMOData> {
|
||||||
|
@ -28,7 +28,7 @@ public class PlayerListener implements Listener {
|
|||||||
/*
|
/*
|
||||||
* initialize player data
|
* initialize player data
|
||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void a(PlayerJoinEvent event) {
|
public void a(PlayerJoinEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
PlayerData.setup(player).getStats().getMap().updateAll();
|
PlayerData.setup(player).getStats().getMap().updateAll();
|
||||||
@ -91,7 +91,7 @@ public class PlayerListener implements Listener {
|
|||||||
*/
|
*/
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void g(ArmorEquipEvent event) {
|
public void g(ArmorEquipEvent event) {
|
||||||
PlayerData.get(event.getPlayer()).getStats().getMap().runUpdates(SharedStat.MOVEMENT_SPEED);
|
PlayerData.get(event.getPlayer()).getStats().getMap().update(SharedStat.MOVEMENT_SPEED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -4,6 +4,7 @@ main: net.Indyuce.mmocore.MMOCore
|
|||||||
author: Indyuce
|
author: Indyuce
|
||||||
description: ${project.description}
|
description: ${project.description}
|
||||||
loadbefore: [MMOItems]
|
loadbefore: [MMOItems]
|
||||||
|
depend: [MMOLib]
|
||||||
softdepend: [Vault,MythicMobs,PlaceholderAPI]
|
softdepend: [Vault,MythicMobs,PlaceholderAPI]
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
commands:
|
commands:
|
||||||
|
Loading…
Reference in New Issue
Block a user