!MMOLib update 2

This commit is contained in:
Indyuce 2019-12-23 19:27:13 +01:00
parent 6913e8b0cc
commit 2c5309b417
6 changed files with 9 additions and 4 deletions

Binary file not shown.

View File

@ -78,7 +78,7 @@ public class PlayerData {
private final List<SkillInfo> boundSkills = new ArrayList<>();
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 final Map<String, Integer> skills = new HashMap<>();
@ -97,6 +97,7 @@ public class PlayerData {
private PlayerData(Player player) {
uuid = player.getUniqueId();
setPlayer(player);
playerStats = new PlayerStats(this);
questData = new PlayerQuests(this);
}

View File

@ -10,8 +10,8 @@ import net.Indyuce.mmocore.api.player.PlayerData;
import net.mmogroup.mmolib.MMOLib;
import net.mmogroup.mmolib.api.AttackResult;
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.StatInstance;
public class PlayerStats {
private final PlayerData data;

View File

@ -13,6 +13,7 @@ import net.Indyuce.mmocore.api.player.stats.StatType;
import net.mmogroup.mmolib.api.player.MMOData;
import net.mmogroup.mmolib.api.stat.SharedStat;
import net.mmogroup.mmolib.api.stat.StatMap;
import net.mmogroup.mmolib.api.stat.instance.MMOCoreStatInstance;
public class MMOLibHook {
public MMOLibHook() {
@ -27,6 +28,8 @@ public class MMOLibHook {
Consumer<MMOData> moveSpeed = new MovementSpeedStat();
StatMap.registerUpdate(SharedStat.MOVEMENT_SPEED, moveSpeed);
StatMap.registerUpdate(SharedStat.SPEED_MALUS_REDUCTION, moveSpeed);
StatMap.setInstanceGenerator((map, stat) -> new MMOCoreStatInstance(map, stat));
}
public class AttributeStatHandler implements Consumer<MMOData> {

View File

@ -28,7 +28,7 @@ public class PlayerListener implements Listener {
/*
* initialize player data
*/
@EventHandler(priority = EventPriority.LOWEST)
@EventHandler(priority = EventPriority.LOW)
public void a(PlayerJoinEvent event) {
Player player = event.getPlayer();
PlayerData.setup(player).getStats().getMap().updateAll();
@ -91,7 +91,7 @@ public class PlayerListener implements Listener {
*/
@EventHandler
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);
}
/*

View File

@ -4,6 +4,7 @@ main: net.Indyuce.mmocore.MMOCore
author: Indyuce
description: ${project.description}
loadbefore: [MMOItems]
depend: [MMOLib]
softdepend: [Vault,MythicMobs,PlaceholderAPI]
api-version: 1.13
commands: