mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-01-18 08:52:07 +01:00
Optimization
This commit is contained in:
parent
27065aa540
commit
75c345483d
@ -40,26 +40,13 @@ public class ItemSkin extends UseItem {
|
||||
return new ApplyResult(ResultType.NONE);
|
||||
}
|
||||
|
||||
boolean compatible = false;
|
||||
|
||||
//SKIN//MMOItems.log("\u00a78SKIN \u00a7eCPT\u00a77 Applying onto " + MMOUtils.getDisplayName(target.getItem()));
|
||||
|
||||
// Types compatibility check
|
||||
if (getMMOItem().hasData(ItemStats.COMPATIBLE_TYPES)) {
|
||||
//SKIN//MMOItems.log("\u00a78SKIN \u00a7eCPT\u00a77 Testing that TYPE is compatible: ");
|
||||
List<String> acceptedTypes = ((StringListData) getMMOItem().getData(ItemStats.COMPATIBLE_TYPES)).getList();
|
||||
for (String type : acceptedTypes) {
|
||||
//SKIN//MMOItems.log("\u00a78SKIN \u00a7eCPT\u00a7e >\u00a7f " + type);
|
||||
|
||||
if (type.equalsIgnoreCase(targetType.getId())) {
|
||||
//SKIN//MMOItems.log("\u00a78SKIN \u00a7eCPT\u00a7a Matched");
|
||||
compatible = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!compatible && acceptedTypes.size() > 0) {
|
||||
//SKIN//MMOItems.log("\u00a78SKIN \u00a7eCPT\u00a7c Incompatible");
|
||||
final List<String> acceptedTypes = ((StringListData) getMMOItem().getData(ItemStats.COMPATIBLE_TYPES)).getList();
|
||||
if (acceptedTypes.stream().noneMatch(s -> s.equalsIgnoreCase(targetType.getId()))) {
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 2);
|
||||
Message.SKIN_INCOMPATIBLE.format(ChatColor.RED, "#item#", MMOUtils.getDisplayName(target.getItem()))
|
||||
.send(player);
|
||||
@ -70,22 +57,11 @@ public class ItemSkin extends UseItem {
|
||||
// IDs compatibility check
|
||||
if (getMMOItem().hasData(ItemStats.COMPATIBLE_IDS)) {
|
||||
//SKIN//MMOItems.log("\u00a78SKIN \u00a7eCPT\u00a77 Testing that ID is compatible: ");
|
||||
final List<String> acceptedIDs = ((StringListData) getMMOItem().getData(ItemStats.COMPATIBLE_IDS)).getList();
|
||||
final String targetId = target.getString("MMOITEMS_ITEM_ID");
|
||||
|
||||
List<String> acceptedIDs = ((StringListData) getMMOItem().getData(ItemStats.COMPATIBLE_IDS)).getList();
|
||||
|
||||
for (String id : acceptedIDs) {
|
||||
//SKIN//MMOItems.log("\u00a78SKIN \u00a7eCPT\u00a76 >\u00a7f " + id);
|
||||
|
||||
if (id.equalsIgnoreCase(target.getString("MMOITEMS_ITEM_ID"))) {
|
||||
//SKIN//MMOItems.log("\u00a78SKIN \u00a7eCPT\u00a7a Matched");
|
||||
compatible = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!compatible && acceptedIDs.size() > 0) {
|
||||
//SKIN//MMOItems.log("\u00a78SKIN \u00a7eCPT\u00a7c Incompatible");
|
||||
|
||||
if (acceptedIDs.stream()
|
||||
.noneMatch(s -> s.equalsIgnoreCase(targetId))) {
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 2);
|
||||
Message.SKIN_INCOMPATIBLE.format(ChatColor.RED, "#item#", MMOUtils.getDisplayName(target.getItem()))
|
||||
.send(player);
|
||||
@ -95,8 +71,7 @@ public class ItemSkin extends UseItem {
|
||||
|
||||
// Material compatibility check
|
||||
if (getMMOItem().hasData(ItemStats.COMPATIBLE_MATERIALS)) {
|
||||
//SKIN//
|
||||
MMOItems.log("\u00a78SKIN \u00a7eCPT\u00a77 Testing that MATERIAL is compatible: ");
|
||||
//SKIN//MMOItems.log("\u00a78SKIN \u00a7eCPT\u00a77 Testing that MATERIAL is compatible: ");
|
||||
List<String> acceptedMaterials = ((StringListData) getMMOItem().getData(ItemStats.COMPATIBLE_MATERIALS)).getList();
|
||||
|
||||
if (acceptedMaterials.stream()
|
||||
|
Loading…
Reference in New Issue
Block a user