Merge remote-tracking branch 'origin/master'

This commit is contained in:
Indyuce 2022-03-27 00:09:22 +01:00
commit 58e6e61ad8
4 changed files with 6 additions and 12 deletions

View File

@ -160,7 +160,7 @@
<dependency>
<groupId>io.lumine</groupId>
<artifactId>MythicLib-dist</artifactId>
<version>1.4</version>
<version>1.3.1</version>
<scope>provided</scope>
</dependency>

View File

@ -10,7 +10,6 @@ import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute;
import net.Indyuce.mmocore.api.player.stats.StatType;
import net.Indyuce.mmocore.experience.Profession;
import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.api.event.item.UntargetedWeaponUseEvent;
import net.Indyuce.mmoitems.api.player.RPGPlayer;
import net.Indyuce.mmoitems.comp.mmocore.stat.Required_Attribute;
import net.Indyuce.mmoitems.comp.mmocore.stat.Required_Profession;
@ -63,13 +62,6 @@ public class MMOCoreHook implements RPGHandler, Listener {
net.Indyuce.mmoitems.api.player.PlayerData.get(event.getPlayer()).getInventory().scheduleUpdate();
}
@EventHandler(ignoreCancelled = true)
public void stopAttacksWhenCasting(UntargetedWeaponUseEvent event) {
PlayerData playerData = PlayerData.get(event.getPlayerData().getUniqueId());
if (playerData.isCasting())
event.setCancelled(true);
}
/**
* Removing this as it is causing issues when players log on for the first time.
* Right after MMOCore loads the player data, MMOItems player data is not loaded yet

View File

@ -95,11 +95,10 @@ public class ItemUse implements Listener {
useItem.executeCommands();
}
// Target free weapon attack
if (useItem instanceof UntargetedWeapon) {
UntargetedWeapon weapon = (UntargetedWeapon) useItem;
if ((event.getAction().name().contains("RIGHT_CLICK") && weapon.getWeaponType() == UntargetedWeaponType.RIGHT_CLICK)
|| (event.getAction().name().contains("LEFT_CLICK") && weapon.getWeaponType() == UntargetedWeaponType.LEFT_CLICK))
if (weapon.getWeaponType().corresponds(event.getAction()))
weapon.handleTargetFreeAttack(EquipmentSlot.fromBukkit(event.getHand()));
}
}

View File

@ -63,6 +63,9 @@ public class PlayerListener implements Listener {
// No
if (event instanceof Cancellable) { if (((Cancellable) event).isCancelled()) { return; } }
// Supports NPCs
if (!PlayerData.has(event.getEntity())) return;
// Get Player
PlayerData data = PlayerData.get(event.getEntity());