mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-02-21 14:31:20 +01:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
90dc0bfa9c
39
pom.xml
39
pom.xml
@ -17,15 +17,15 @@
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>nexus</id>
|
||||
<name>Lumine Releases</name>
|
||||
<url>https://mvn.lumine.io/repository/maven-releases/</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>nexus</id>
|
||||
<name>Lumine Snapshots</name>
|
||||
<url>https://mvn.lumine.io/repository/maven-snapshots/</url>
|
||||
</snapshotRepository>
|
||||
<id>nexus</id>
|
||||
<name>Lumine Releases</name>
|
||||
<url>https://mvn.lumine.io/repository/maven-releases/</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>nexus</id>
|
||||
<name>Lumine Snapshots</name>
|
||||
<url>https://mvn.lumine.io/repository/maven-snapshots/</url>
|
||||
</snapshotRepository>
|
||||
|
||||
</distributionManagement>
|
||||
|
||||
@ -88,14 +88,14 @@
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
|
||||
|
||||
<!-- AE -->
|
||||
<repository>
|
||||
<id>egg82-ninja</id>
|
||||
<url>https://www.myget.org/F/egg82-java/maven/</url>
|
||||
</repository>
|
||||
|
||||
<!-- holographic displays -->
|
||||
<id>egg82-ninja</id>
|
||||
<url>https://www.myget.org/F/egg82-java/maven/</url>
|
||||
</repository>
|
||||
|
||||
<!-- holographic displays -->
|
||||
<repository>
|
||||
<id>codemc-repo</id>
|
||||
<url>https://repo.codemc.io/repository/maven-public/</url>
|
||||
@ -132,7 +132,7 @@
|
||||
<dependency>
|
||||
<groupId>net.Indyuce</groupId>
|
||||
<artifactId>MMOCore</artifactId>
|
||||
<version>1.8.0</version>
|
||||
<version>1.8.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@ -227,13 +227,6 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.Zrips.CMI</groupId>
|
||||
<artifactId>CMI</artifactId>
|
||||
<version>8.6.5.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.herocraftonline</groupId>
|
||||
<artifactId>heroes</artifactId>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -139,7 +139,12 @@ public abstract class Ability<T extends AbilityMetadata> implements CooldownObje
|
||||
/**
|
||||
* Performing a right click while sneaking
|
||||
*/
|
||||
SHIFT_RIGHT_CLICK;
|
||||
SHIFT_RIGHT_CLICK,
|
||||
|
||||
/**
|
||||
* When player Sneaks
|
||||
*/
|
||||
SNEAK;
|
||||
|
||||
private final boolean message;
|
||||
|
||||
|
@ -3,6 +3,7 @@ package net.Indyuce.mmoitems.api;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import io.lumine.mythic.lib.api.player.EquipmentSlot;
|
||||
import io.lumine.mythic.lib.api.util.ui.SilentNumbers;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.item.util.identify.UnidentifiedItem;
|
||||
import net.Indyuce.mmoitems.manager.TypeManager;
|
||||
@ -46,7 +47,7 @@ public class Type {
|
||||
public static final Type ORNAMENT = new Type(TypeSet.EXTRA, "ORNAMENT", false, EquipmentSlot.ANY);
|
||||
|
||||
// extra
|
||||
public static final Type ARMOR = new Type(TypeSet.EXTRA, "ARMOR", false, EquipmentSlot.ARMOR);
|
||||
public static final Type ARMOR = new Type(TypeSet.EXTRA, "ARMOR", false, EquipmentSlot.ARMOR, true);
|
||||
public static final Type TOOL = new Type(TypeSet.EXTRA, "TOOL", false, EquipmentSlot.MAIN_HAND);
|
||||
public static final Type CONSUMABLE = new Type(TypeSet.EXTRA, "CONSUMABLE", false, EquipmentSlot.MAIN_HAND);
|
||||
public static final Type MISCELLANEOUS = new Type(TypeSet.EXTRA, "MISCELLANEOUS", false, EquipmentSlot.MAIN_HAND);
|
||||
@ -59,6 +60,12 @@ public class Type {
|
||||
private String name;
|
||||
private final TypeSet set;
|
||||
|
||||
public boolean isFourGUIMode() {
|
||||
return fourGUIMode;
|
||||
}
|
||||
|
||||
private final boolean fourGUIMode;
|
||||
|
||||
/**
|
||||
* Used for item type restrictions for gem stones to easily check if the
|
||||
* item is a weapon.
|
||||
@ -89,10 +96,13 @@ public class Type {
|
||||
private final List<ItemStat> available = new ArrayList<>();
|
||||
|
||||
public Type(TypeSet set, String id, boolean weapon, EquipmentSlot equipType) {
|
||||
this(set, id, weapon, equipType, false);
|
||||
}
|
||||
public Type(TypeSet set, String id, boolean weapon, EquipmentSlot equipType, boolean fourGUI) {
|
||||
this.set = set;
|
||||
this.id = id.toUpperCase().replace("-", "_").replace(" ", "_");
|
||||
this.equipType = equipType;
|
||||
|
||||
this.fourGUIMode = fourGUI;
|
||||
this.weapon = weapon;
|
||||
}
|
||||
|
||||
@ -103,6 +113,7 @@ public class Type {
|
||||
set = parent.set;
|
||||
weapon = parent.weapon;
|
||||
equipType = parent.equipType;
|
||||
this.fourGUIMode = config.getBoolean("AlternateGUIMode", parent.fourGUIMode);
|
||||
}
|
||||
|
||||
public void load(ConfigurationSection config) {
|
||||
|
@ -27,16 +27,16 @@ public class PlaceholderCondition extends Condition {
|
||||
switch (comparator) {
|
||||
case "<":
|
||||
return Double.valueOf(placeholders) < Double.valueOf(compareTo);
|
||||
case "<=":
|
||||
case "<+":
|
||||
return Double.valueOf(placeholders) <= Double.valueOf(compareTo);
|
||||
case ">":
|
||||
return Double.valueOf(placeholders) > Double.valueOf(compareTo);
|
||||
case ">=":
|
||||
case ">+":
|
||||
return Double.valueOf(placeholders) >= Double.valueOf(compareTo);
|
||||
case "==":
|
||||
case "=":
|
||||
case "++":
|
||||
case "+":
|
||||
return Double.valueOf(placeholders) == Double.valueOf(compareTo);
|
||||
case "!=":
|
||||
case "!+":
|
||||
return Double.valueOf(placeholders) != Double.valueOf(compareTo);
|
||||
case "equals":
|
||||
return placeholders.equals(compareTo);
|
||||
|
@ -69,6 +69,9 @@ public class GemStone extends UseItem {
|
||||
// Check for success rate
|
||||
double successRate = getNBTItem().getStat(ItemStats.SUCCESS_RATE.getId());
|
||||
|
||||
if (successRate == 0.0)
|
||||
successRate = 100;
|
||||
|
||||
// Call the Bukkit event
|
||||
ApplyGemStoneEvent called = new ApplyGemStoneEvent(playerData, mmoitem, targetMMO,
|
||||
RANDOM.nextDouble() > successRate / 100 ? ResultType.FAILURE : ResultType.SUCCESS);
|
||||
|
@ -34,7 +34,7 @@ public class ItemSkin extends UseItem {
|
||||
return new ApplyResult(ResultType.NONE);
|
||||
|
||||
if (MMOItems.plugin.getConfig().getBoolean("locked-skins") && target.getBoolean("MMOITEMS_HAS_SKIN")) {
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 2);
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1);
|
||||
Message.SKIN_REJECTED.format(ChatColor.RED, "#item#", MMOUtils.getDisplayName(target.getItem()))
|
||||
.send(player);
|
||||
return new ApplyResult(ResultType.NONE);
|
||||
|
@ -369,7 +369,7 @@ public class MMOItemReforger {
|
||||
*
|
||||
* @param options Additional options to pass onto the modules.
|
||||
*
|
||||
* @return If reforged successfully ~ <code>true</code> unless cancelled.
|
||||
* @return If reforged successfully. Basically <code>true</code>, unless cancelled.
|
||||
*/
|
||||
public boolean reforge(@NotNull ReforgeOptions options) {
|
||||
//RFG//MMOItems.log("§8Reforge §4RFG§7 Reforging " + SilentNumbers.getItemName(getStack()));
|
||||
|
@ -79,6 +79,7 @@ public class ReloadCommandTreeNode extends CommandTreeNode {
|
||||
sender.sendMessage(MMOItems.plugin.getPrefix() + "- " + ChatColor.RED
|
||||
+ (MMOItems.plugin.getRecipes().getLoadedLegacyRecipes().size()
|
||||
+ MMOItems.plugin.getRecipes().getLegacyCustomRecipes().size()
|
||||
+ MMOItems.plugin.getRecipes().getBooklessRecipes().size()
|
||||
+ MMOItems.plugin.getRecipes().getCustomRecipes().size())
|
||||
+ ChatColor.GRAY + " Recipes");
|
||||
}
|
||||
|
@ -1,74 +0,0 @@
|
||||
package net.Indyuce.mmoitems.comp.denizen;
|
||||
|
||||
import com.denizenscript.denizen.objects.ItemTag;
|
||||
import com.denizenscript.denizencore.objects.ObjectFetcher;
|
||||
import com.denizenscript.denizencore.objects.ObjectTag;
|
||||
import com.denizenscript.denizencore.objects.core.MapTag;
|
||||
import com.denizenscript.denizencore.objects.properties.PropertyParser;
|
||||
import com.denizenscript.denizencore.tags.TagManager;
|
||||
import com.denizenscript.depenizen.bukkit.Bridge;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
|
||||
/**
|
||||
* Basic integration with Denizen
|
||||
*/
|
||||
public class DenizenBridge extends Bridge {
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
|
||||
/*
|
||||
* This registers sub tags in the custom coded denizen tags
|
||||
*/
|
||||
/* ObjectFetcher.registerWithObjectFetcher(MMOItemTag.class, MMOItemTag.tagProcessor);*/
|
||||
ObjectFetcher.registerWithObjectFetcher(MMOItemTemplateTag.class, MMOItemTemplateTag.tagProcessor);
|
||||
|
||||
/*
|
||||
* Implement some properties to the already existing ItemTag
|
||||
*/
|
||||
PropertyParser.registerProperty(MMOItemsItemProperty.class, ItemTag.class);
|
||||
|
||||
/*
|
||||
* This implements a way to retrieve an MMOItem as itemStack.
|
||||
*
|
||||
* Usage:
|
||||
* <mmoitem_template[type=TYPE;id=ID_HERE]>
|
||||
*/
|
||||
TagManager.registerTagHandler("mmoitem_template", attribute -> {
|
||||
if (!attribute.hasContext(1)) {
|
||||
attribute.echoError("Please provide an item type and ID.");
|
||||
return null;
|
||||
}
|
||||
|
||||
MapTag map = attribute.contextAsType(1, MapTag.class);
|
||||
if (map == null) {
|
||||
attribute.echoError("Invalid MapTag input");
|
||||
return null;
|
||||
}
|
||||
|
||||
ObjectTag type = map.getObject("type");
|
||||
ObjectTag id = map.getObject("id");
|
||||
if (type == null || id == null) {
|
||||
attribute.echoError("Invalid MapTag input - missing 'type' or 'id'");
|
||||
return null;
|
||||
}
|
||||
|
||||
String typeName = type.toString().replace("-", "_").toUpperCase();
|
||||
Type parsedType = MMOItems.plugin.getTypes().get(typeName);
|
||||
if (parsedType == null) {
|
||||
attribute.echoError("Invalid type - cannot find type with name '" + typeName + "'");
|
||||
return null;
|
||||
}
|
||||
|
||||
// Format ID and return item
|
||||
String formattedId = id.toString().replace("-", "_").toUpperCase();
|
||||
if (!MMOItems.plugin.getTemplates().hasTemplate(parsedType, formattedId)) {
|
||||
attribute.echoError("Invalid template ID - cannot find template with name '" + formattedId + "'");
|
||||
return null;
|
||||
}
|
||||
|
||||
return new MMOItemTemplateTag(parsedType, formattedId);
|
||||
});
|
||||
}
|
||||
}
|
@ -1,18 +1,72 @@
|
||||
package net.Indyuce.mmoitems.comp.denizen;
|
||||
|
||||
import com.denizenscript.depenizen.bukkit.Depenizen;
|
||||
import com.denizenscript.denizen.objects.ItemTag;
|
||||
import com.denizenscript.denizencore.objects.ObjectFetcher;
|
||||
import com.denizenscript.denizencore.objects.ObjectTag;
|
||||
import com.denizenscript.denizencore.objects.core.MapTag;
|
||||
import com.denizenscript.denizencore.objects.properties.PropertyParser;
|
||||
import com.denizenscript.denizencore.tags.TagManager;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import org.bukkit.Bukkit;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
|
||||
public class DenizenHook {
|
||||
/**
|
||||
* Putting this here so that the Depenizen import does not
|
||||
* appear in the main MMOItems class which would cause an issue
|
||||
* for all servers without Denizen
|
||||
*/
|
||||
public DenizenHook() {
|
||||
/*
|
||||
* This registers sub tags in the custom coded denizen tags
|
||||
*/
|
||||
/* ObjectFetcher.registerWithObjectFetcher(MMOItemTag.class, MMOItemTag.tagProcessor);*/
|
||||
ObjectFetcher.registerWithObjectFetcher(MMOItemTemplateTag.class, MMOItemTemplateTag.tagProcessor);
|
||||
|
||||
/**
|
||||
* Putting this here so that the Depenizen import does not
|
||||
* appear in the main MMOItems class which would cause an issue
|
||||
* for all servers without Denizen
|
||||
*/
|
||||
public DenizenHook() {
|
||||
Depenizen depenizen = (Depenizen) Bukkit.getPluginManager().getPlugin("Depenizen");
|
||||
depenizen.registerBridge(MMOItems.plugin.getName(), () -> new DenizenBridge());
|
||||
}
|
||||
/*
|
||||
* Implement some properties to the already existing ItemTag
|
||||
*/
|
||||
PropertyParser.registerProperty(MMOItemsItemProperty.class, ItemTag.class);
|
||||
|
||||
/*
|
||||
* This implements a way to retrieve an MMOItem as itemStack.
|
||||
*
|
||||
* Usage:
|
||||
* <mmoitem_template[type=TYPE;id=ID_HERE]>
|
||||
*/
|
||||
TagManager.registerTagHandler("mmoitem_template", attribute -> {
|
||||
if (!attribute.hasContext(1)) {
|
||||
attribute.echoError("Please provide an item type and ID.");
|
||||
return null;
|
||||
}
|
||||
|
||||
MapTag map = attribute.contextAsType(1, MapTag.class);
|
||||
if (map == null) {
|
||||
attribute.echoError("Invalid MapTag input");
|
||||
return null;
|
||||
}
|
||||
|
||||
ObjectTag type = map.getObject("type");
|
||||
ObjectTag id = map.getObject("id");
|
||||
if (type == null || id == null) {
|
||||
attribute.echoError("Invalid MapTag input - missing 'type' or 'id'");
|
||||
return null;
|
||||
}
|
||||
|
||||
String typeName = type.toString().replace("-", "_").toUpperCase();
|
||||
Type parsedType = MMOItems.plugin.getTypes().get(typeName);
|
||||
if (parsedType == null) {
|
||||
attribute.echoError("Invalid type - cannot find type with name '" + typeName + "'");
|
||||
return null;
|
||||
}
|
||||
|
||||
// Format ID and return item
|
||||
String formattedId = id.toString().replace("-", "_").toUpperCase();
|
||||
if (!MMOItems.plugin.getTemplates().hasTemplate(parsedType, formattedId)) {
|
||||
attribute.echoError("Invalid template ID - cannot find template with name '" + formattedId + "'");
|
||||
return null;
|
||||
}
|
||||
|
||||
return new MMOItemTemplateTag(parsedType, formattedId);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -13,138 +13,133 @@ import net.Indyuce.mmoitems.api.ItemTier;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.item.template.MMOItemTemplate;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerData;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class MMOItemTemplateTag extends SimpleTag {
|
||||
private final Type type;
|
||||
private final String id;
|
||||
private final Type type;
|
||||
private final String id;
|
||||
|
||||
private static final Random random = new Random();
|
||||
private static final Random random = new Random();
|
||||
|
||||
public MMOItemTemplateTag(Type type, String id) {
|
||||
this.type = type;
|
||||
this.id = id;
|
||||
}
|
||||
public MMOItemTemplateTag(Type type, String id) {
|
||||
this.type = type;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public MMOItemTemplate getTemplate() {
|
||||
return MMOItems.plugin.getTemplates().getTemplate(type, id);
|
||||
}
|
||||
public MMOItemTemplate getTemplate() {
|
||||
return MMOItems.plugin.getTemplates().getTemplate(type, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUnique() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isUnique() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getObjectType() {
|
||||
return "MMOItemTemplate";
|
||||
}
|
||||
@Override
|
||||
public String getObjectType() {
|
||||
return "MMOItemTemplate";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String identify() {
|
||||
return "mmoitem_template@" + type.getId() + "." + id;
|
||||
}
|
||||
@Override
|
||||
public String identify() {
|
||||
return "mmoitem_template@" + type.getId() + "." + id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String identifySimple() {
|
||||
return identify();
|
||||
}
|
||||
@Override
|
||||
public String identifySimple() {
|
||||
return identify();
|
||||
}
|
||||
|
||||
public static ObjectTagProcessor<MMOItemTemplateTag> tagProcessor = new ObjectTagProcessor<>();
|
||||
public static ObjectTagProcessor<MMOItemTemplateTag> tagProcessor = new ObjectTagProcessor<>();
|
||||
|
||||
@Override
|
||||
public ObjectTag getObjectAttribute(Attribute attribute) {
|
||||
return tagProcessor.getObjectAttribute(this, attribute);
|
||||
}
|
||||
@Override
|
||||
public ObjectTag getObjectAttribute(Attribute attribute) {
|
||||
return tagProcessor.getObjectAttribute(this, attribute);
|
||||
}
|
||||
|
||||
public static void registerTags() {
|
||||
public static void registerTags() {
|
||||
|
||||
// Display template type name
|
||||
tagProcessor.registerTag("item_type", ((attribute, object) -> new ElementTag(object.type.getName())));
|
||||
// Display template type name
|
||||
tagProcessor.registerTag("item_type", ((attribute, object) -> new ElementTag(object.type.getName())));
|
||||
|
||||
// Display template id
|
||||
tagProcessor.registerTag("item_id", ((attribute, object) -> new ElementTag(object.id)));
|
||||
// Display template id
|
||||
tagProcessor.registerTag("item_id", ((attribute, object) -> new ElementTag(object.id)));
|
||||
|
||||
/*
|
||||
* Used to generate an item with custom tier and level.
|
||||
*
|
||||
* Usage:
|
||||
* <mmoitemTemplateTag.generate[player=playerTagHere;level=10;matchlevel=true;tier=TIER_NAME]
|
||||
* All arguments are optional. Level overrides the match-level option.
|
||||
*
|
||||
* Return:
|
||||
* MMOItemTag of the generated item.
|
||||
*/
|
||||
tagProcessor.registerTag("generate", (attribute, object) -> {
|
||||
if (!attribute.hasContext(1))
|
||||
return new ItemTag(object.getTemplate().newBuilder().build().newBuilder().build());
|
||||
/*
|
||||
* Used to generate an item with custom tier and level.
|
||||
*
|
||||
* Usage:
|
||||
* <mmoitemTemplateTag.generate[player=playerTagHere;level=10;matchlevel=true;tier=TIER_NAME]
|
||||
* All arguments are optional. Level overrides the match-level option.
|
||||
*
|
||||
* Return:
|
||||
* MMOItemTag of the generated item.
|
||||
*/
|
||||
tagProcessor.registerTag("generate", (attribute, object) -> {
|
||||
if (!attribute.hasContext(1)) return new ItemTag(object.getTemplate().newBuilder().build().newBuilder().build());
|
||||
|
||||
MapTag map = attribute.contextAsType(1, MapTag.class);
|
||||
if (map == null) {
|
||||
attribute.echoError("Invalid MapTag input");
|
||||
return null;
|
||||
}
|
||||
MapTag map = attribute.contextAsType(1, MapTag.class);
|
||||
if (map == null) {
|
||||
attribute.echoError("Invalid MapTag input");
|
||||
return null;
|
||||
}
|
||||
|
||||
ObjectTag playerTag = map.getObject("player");
|
||||
if (playerTag != null && !(playerTag instanceof PlayerTag)) {
|
||||
attribute.echoError("Bad player input type");
|
||||
return null;
|
||||
}
|
||||
ObjectTag playerTag = map.getObject("player");
|
||||
if (playerTag != null && !(playerTag instanceof PlayerTag)) {
|
||||
attribute.echoError("Bad player input type");
|
||||
return null;
|
||||
}
|
||||
|
||||
// Specified level
|
||||
ObjectTag levelTag = map.getObject("level");
|
||||
int level = -1;
|
||||
if (levelTag != null)
|
||||
try {
|
||||
level = Integer.valueOf(levelTag.toString());
|
||||
} catch (IllegalArgumentException exception) {
|
||||
attribute.echoError("Bad level input: " + levelTag.toString() + " is not a valid integer");
|
||||
return null;
|
||||
}
|
||||
// Specified level
|
||||
ObjectTag levelTag = map.getObject("level");
|
||||
int level = -1;
|
||||
if (levelTag != null) try {
|
||||
level = Integer.parseInt(levelTag.toString());
|
||||
} catch (IllegalArgumentException exception) {
|
||||
attribute.echoError("Bad level input: " + levelTag + " is not a valid integer");
|
||||
return null;
|
||||
}
|
||||
|
||||
// Match level
|
||||
ObjectTag matchLevelTag = map.getObject("match-level");
|
||||
boolean matchLevel = matchLevelTag != null && Boolean.valueOf(matchLevelTag.toString());
|
||||
// Match level
|
||||
ObjectTag matchLevelTag = map.getObject("match-level");
|
||||
boolean matchLevel = matchLevelTag != null && Boolean.parseBoolean(matchLevelTag.toString());
|
||||
|
||||
// Item tier param
|
||||
ObjectTag tierTag = map.getObject("tier");
|
||||
ItemTier tier = null;
|
||||
if (tierTag != null)
|
||||
try {
|
||||
tier = MMOItems.plugin.getTiers().getOrThrow(tierTag.toString().toUpperCase().replace("-", "_"));
|
||||
} catch (IllegalArgumentException exception) {
|
||||
attribute.echoError(exception.getMessage());
|
||||
}
|
||||
// Item tier param
|
||||
ObjectTag tierTag = map.getObject("tier");
|
||||
ItemTier tier = null;
|
||||
if (tierTag != null) try {
|
||||
tier = MMOItems.plugin.getTiers().getOrThrow(tierTag.toString().toUpperCase().replace("-", "_"));
|
||||
} catch (IllegalArgumentException exception) {
|
||||
attribute.echoError(exception.getMessage());
|
||||
}
|
||||
|
||||
// Find item level
|
||||
int itemLevel = level >= 0 ? level : (matchLevel && playerTag != null ?
|
||||
MMOItems.plugin.getTemplates().rollLevel(PlayerData.get(((PlayerTag) playerTag).getPlayerEntity()).getRPG().getLevel()) : 1 + random.nextInt(100));
|
||||
// Find item level
|
||||
int itemLevel = level >= 0 ? level : (matchLevel && playerTag != null ? MMOItems.plugin.getTemplates()
|
||||
.rollLevel(PlayerData.get(((PlayerTag) playerTag).getPlayerEntity()).getRPG().getLevel()) : 1 + random.nextInt(100));
|
||||
|
||||
// Find item tier
|
||||
ItemTier itemTier = tier != null ? tier : MMOItems.plugin.getTemplates().rollTier();
|
||||
// Find item tier
|
||||
ItemTier itemTier = tier != null ? tier : MMOItems.plugin.getTemplates().rollTier();
|
||||
|
||||
// Build item
|
||||
return new ItemTag(object.getTemplate().newBuilder(itemLevel, itemTier).build().newBuilder().build());
|
||||
});
|
||||
}
|
||||
// Build item
|
||||
return new ItemTag(object.getTemplate().newBuilder(itemLevel, itemTier).build().newBuilder().build());
|
||||
});
|
||||
}
|
||||
|
||||
public static MMOItemTemplateTag valueOf(String string, TagContext context) {
|
||||
if (string == null)
|
||||
return null;
|
||||
public static MMOItemTemplateTag valueOf(String string, TagContext context) {
|
||||
if (string == null) return null;
|
||||
|
||||
try {
|
||||
String[] split = string.substring("mmoitem_template@".length()).split("\\.");
|
||||
String typeId = split[0];
|
||||
String itemId = split[1];
|
||||
try {
|
||||
String[] split = string.substring("mmoitem_template@".length()).split("\\.");
|
||||
String typeId = split[0];
|
||||
String itemId = split[1];
|
||||
|
||||
Type type = MMOItems.plugin.getTypes().getOrThrow(typeId);
|
||||
MMOItems.plugin.getTemplates().getTemplateOrThrow(type, itemId);
|
||||
Type type = MMOItems.plugin.getTypes().getOrThrow(typeId);
|
||||
MMOItems.plugin.getTemplates().getTemplateOrThrow(type, itemId);
|
||||
|
||||
return new MMOItemTemplateTag(type, itemId);
|
||||
} catch (Exception exception) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return new MMOItemTemplateTag(type, itemId);
|
||||
} catch (Exception exception) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public class MythicMobsAbility extends Ability<MythicMobsAbilityMetadata> {
|
||||
private final Skill skill;
|
||||
|
||||
public MythicMobsAbility(String id, FileConfiguration config) {
|
||||
super(id, config.getString("name"), CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK);
|
||||
super(id, config.getString("name"), CastingMode.ON_HIT, CastingMode.WHEN_HIT, CastingMode.LEFT_CLICK, CastingMode.RIGHT_CLICK, CastingMode.SHIFT_LEFT_CLICK, CastingMode.SHIFT_RIGHT_CLICK, CastingMode.SNEAK);
|
||||
|
||||
String skillName = config.getString("mythicmobs-skill-id");
|
||||
Validate.notNull(skillName, "Could not find MM skill name");
|
||||
|
@ -24,6 +24,7 @@ import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -38,6 +39,8 @@ public class ItemBrowser extends PluginInventory {
|
||||
private boolean deleteMode;
|
||||
|
||||
private static final int[] slots = { 10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 24, 25, 28, 29, 30, 31, 32, 33, 34 };
|
||||
//private static final int[] slotsAlt = { 10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 24, 25, 28, 29, 30, 31, 32, 33, 34, 37, 38, 39, 40, 41, 42, 43 };
|
||||
private static final int[] slotsAlt = { 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 24, 25, 28, 29, 30, 31, 32, 33, 34 };
|
||||
|
||||
public ItemBrowser(Player player) {
|
||||
this(player, null);
|
||||
@ -48,11 +51,14 @@ public class ItemBrowser extends PluginInventory {
|
||||
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
int[] getUsedSlots(@Nullable Type forType) { return forType == null ? slots : forType.isFourGUIMode() ? slotsAlt : slots; }
|
||||
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
int min = (page - 1) * slots.length;
|
||||
int max = page * slots.length;
|
||||
int[] usedSlots = getUsedSlots(type);
|
||||
int min = (page - 1) * usedSlots.length;
|
||||
int max = page * usedSlots.length;
|
||||
int n = 0;
|
||||
|
||||
/*
|
||||
@ -125,7 +131,7 @@ public class ItemBrowser extends PluginInventory {
|
||||
ItemStack item = template.newBuilder(playerData.getRPG()).build().newBuilder().build();
|
||||
if (item == null || item.getType() == Material.AIR) {
|
||||
cached.put(template.getId(), error);
|
||||
inv.setItem(slots[n++], error);
|
||||
inv.setItem(usedSlots[n++], error);
|
||||
continue;
|
||||
}
|
||||
NBTItem nbtItem = NBTItem.get(item);
|
||||
@ -148,7 +154,7 @@ public class ItemBrowser extends PluginInventory {
|
||||
|
||||
cached.put(template.getId(), nbtItem.toItem());
|
||||
|
||||
inv.setItem(slots[n++], cached.get(template.getId()));
|
||||
inv.setItem(usedSlots[n++], cached.get(template.getId()));
|
||||
}
|
||||
|
||||
ItemStack noItem = VersionMaterial.GRAY_STAINED_GLASS_PANE.toItem();
|
||||
@ -192,8 +198,8 @@ public class ItemBrowser extends PluginInventory {
|
||||
inv.setItem(45, downloadPack);
|
||||
}
|
||||
|
||||
while (n < slots.length)
|
||||
inv.setItem(slots[n++], noItem);
|
||||
while (n < usedSlots.length)
|
||||
inv.setItem(usedSlots[n++], noItem);
|
||||
if (!deleteMode)
|
||||
inv.setItem(51, create);
|
||||
inv.setItem(47, delete);
|
||||
|
@ -63,6 +63,11 @@ public class RMGRR_Shapeless implements RecipeRegistry {
|
||||
|
||||
// Add
|
||||
ProvidedUIFilter p = RecipeMakerGUI.readIngredientFrom(str, ffp);
|
||||
|
||||
// Not air right
|
||||
if (p.isAir()) { continue; }
|
||||
|
||||
// Ok snooze
|
||||
nonAirFound = true;
|
||||
poofs.add(new MythicRecipeIngredient(p));
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import io.lumine.mythic.lib.api.crafting.recipes.ShapelessRecipe;
|
||||
import io.lumine.mythic.lib.api.crafting.uimanager.ProvidedUIFilter;
|
||||
import io.lumine.mythic.lib.api.util.Ref;
|
||||
import io.lumine.mythic.lib.api.util.ui.FriendlyFeedbackProvider;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.crafting.recipe.CustomSmithingRecipe;
|
||||
import net.Indyuce.mmoitems.api.crafting.recipe.SmithingCombinationType;
|
||||
import net.Indyuce.mmoitems.api.item.template.MMOItemTemplate;
|
||||
@ -86,8 +87,8 @@ public class RMGRR_Smithing implements RecipeRegistry {
|
||||
// Read the options and output
|
||||
int outputAmount = recipeSection.getInt(RBA_AmountOutput.AMOUNT_INGREDIENTS, 1);
|
||||
boolean dropGems = recipeSection.getBoolean(RBA_DropGems.SMITH_GEMS, false);
|
||||
SmithingCombinationType upgradeEffect = readSCT(recipeSection.getString(RBA_SmithingEnchantments.SMITH_ENCHANTS));
|
||||
SmithingCombinationType enchantEffect = readSCT(recipeSection.getString(RBA_SmithingUpgrades.SMITH_UPGRADES));
|
||||
SmithingCombinationType enchantEffect = readSCT(recipeSection.getString(RBA_SmithingEnchantments.SMITH_ENCHANTS));
|
||||
SmithingCombinationType upgradeEffect = readSCT(recipeSection.getString(RBA_SmithingUpgrades.SMITH_UPGRADES));
|
||||
|
||||
// Build Output
|
||||
CustomSmithingRecipe outputRecipe = new CustomSmithingRecipe(template, dropGems, enchantEffect, upgradeEffect, outputAmount);
|
||||
|
@ -277,8 +277,11 @@ public class ItemUse implements Listener {
|
||||
return;
|
||||
|
||||
NBTItem item = NBTItem.get(event.getBow());
|
||||
if (!item.hasType())
|
||||
return;
|
||||
Type type = Type.get(item.getType());
|
||||
|
||||
|
||||
PlayerData playerData = PlayerData.get((Player) event.getEntity());
|
||||
if (type != null) {
|
||||
Weapon weapon = new Weapon(playerData, item);
|
||||
|
@ -60,6 +60,12 @@ public class PlayerListener implements Listener {
|
||||
PlayerData.get(player).castAbilities(damager, CastingMode.WHEN_HIT);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void castWhenSneakAbilities(PlayerToggleSneakEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
PlayerData.get(player).castAbilities(null, CastingMode.SNEAK);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void castClickAbilities(PlayerInteractEvent event) {
|
||||
if (event.getAction() == Action.PHYSICAL)
|
||||
@ -148,6 +154,9 @@ public class PlayerListener implements Listener {
|
||||
return;
|
||||
|
||||
NBTItem nbtItem = MythicLib.plugin.getVersion().getWrapper().getNBTItem(item.getItem());
|
||||
if (!nbtItem.hasType())
|
||||
return;
|
||||
|
||||
Type type = Type.get(nbtItem.getType());
|
||||
PlayerData playerData = PlayerData.get((Player) event.getEntity().getShooter());
|
||||
|
||||
|
@ -214,6 +214,7 @@ public class RecipeManager implements Reloadable {
|
||||
return legacyCraftingRecipes;
|
||||
}
|
||||
public HashMap<NamespacedKey, MythicRecipeBlueprint> getCustomRecipes() { return customRecipes; }
|
||||
public ArrayList<MythicRecipeBlueprint> getBooklessRecipes() { return booklessRecipes; }
|
||||
|
||||
@Nullable
|
||||
ArrayList<NamespacedKey> generatedNKs;
|
||||
|
Loading…
Reference in New Issue
Block a user