Fixed a compatibility issue with dual wield plugins

This commit is contained in:
Indyuce 2022-07-04 14:24:16 +02:00
parent 5df41b2f27
commit e2b9635db7
4 changed files with 14 additions and 20 deletions

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.Indyuce</groupId>
<artifactId>MMOItems</artifactId>
<version>6.7.3</version>
<version>6.7.4</version>
<name>MMOItems</name>
<description>A great item solution for your RPG server!!</description>
@ -147,14 +147,14 @@
<dependency>
<groupId>net.Indyuce</groupId>
<artifactId>MMOCore</artifactId>
<version>1.9.3</version>
<version>1.9.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.lumine</groupId>
<artifactId>MythicLib-dist</artifactId>
<version>1.3.2</version>
<version>1.3.3</version>
<scope>provided</scope>
</dependency>

View File

@ -103,20 +103,11 @@ public class MMOItems extends LuminePlugin {
*/
private boolean hasLoadedSuccessfully;
private static final int MYTHICLIB_COMPATIBILITY_INDEX = 8;
public MMOItems() { plugin = this; }
@Override
public void load() {
// Check if the ML build matches
if (MYTHICLIB_COMPATIBILITY_INDEX != MythicLib.MMOITEMS_COMPATIBILITY_INDEX) {
getLogger().log(Level.WARNING, "Your versions of MythicLib and MMOItems do not match. Make sure you are using the latest builds of both plugins");
setEnabled(false);
return;
}
if (getServer().getPluginManager().getPlugin("WorldEdit") != null) try {
new WorldEditSupport();
getLogger().log(Level.INFO, "Hooked onto WorldEdit");

View File

@ -34,13 +34,13 @@ public class Type {
// Range
public static final Type WHIP = new Type(TypeSet.RANGE, "WHIP", true, EquipmentSlot.MAIN_HAND);
public static final Type STAFF = new Type(TypeSet.RANGE, "STAFF", true, EquipmentSlot.MAIN_HAND);
public static final Type BOW = new Type(TypeSet.RANGE, "BOW", true, EquipmentSlot.BOTH_HANDS);
public static final Type CROSSBOW = new Type(TypeSet.RANGE, "CROSSBOW", false, EquipmentSlot.BOTH_HANDS);
public static final Type BOW = new Type(TypeSet.RANGE, "BOW", true, EquipmentSlot.MAIN_HAND);
public static final Type CROSSBOW = new Type(TypeSet.RANGE, "CROSSBOW", false, EquipmentSlot.MAIN_HAND);
public static final Type MUSKET = new Type(TypeSet.RANGE, "MUSKET", true, EquipmentSlot.MAIN_HAND);
public static final Type LUTE = new Type(TypeSet.RANGE, "LUTE", true, EquipmentSlot.MAIN_HAND);
// Offhand
public static final Type CATALYST = new Type(TypeSet.OFFHAND, "CATALYST", false, EquipmentSlot.BOTH_HANDS);
public static final Type CATALYST = new Type(TypeSet.OFFHAND, "CATALYST", false, EquipmentSlot.MAIN_HAND);
public static final Type OFF_CATALYST = new Type(TypeSet.OFFHAND, "OFF_CATALYST", false, EquipmentSlot.OFF_HAND);
// Any

View File

@ -1,6 +1,5 @@
package net.Indyuce.mmoitems.api.player.inventory;
import io.lumine.mythic.lib.MythicLib;
import io.lumine.mythic.lib.api.item.NBTItem;
import io.lumine.mythic.lib.api.player.EquipmentSlot;
import net.Indyuce.mmoitems.api.Type;
@ -13,7 +12,7 @@ public class EquippedItem {
/**
* An item equipped by a player in a specific slot
*
*
* @param item The item equipped
* @param slot The corresponding MMOItems slot type
*/
@ -23,7 +22,7 @@ public class EquippedItem {
/**
* An item equipped by a player in a specific slot
*
*
* @param item The item equipped
* @param slot The corresponding MMOItems slot type, must not be null!
*/
@ -35,7 +34,7 @@ public class EquippedItem {
public NBTItem getItem() {
return item;
}
public EquipmentSlot getSlot() {
return slot;
}
@ -50,7 +49,11 @@ public class EquippedItem {
if (slot == EquipmentSlot.ANY)
return true;
if (type.getEquipmentType() == EquipmentSlot.BOTH_HANDS)
/*
* Main hand items apply their stats and options in off
* hand as well but the reciprocal is false
*/
if (type.getEquipmentType() == EquipmentSlot.MAIN_HAND)
return slot.isHand();
return slot == type.getEquipmentType();