Skip to content

Commit

Permalink
Merge branch 'master' into dev/update
Browse files Browse the repository at this point in the history
  • Loading branch information
SrBedrock committed Nov 21, 2024
2 parents 68decf3 + 60dfb3b commit 3bc1366
Show file tree
Hide file tree
Showing 23 changed files with 486 additions and 336 deletions.
8 changes: 4 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ allprojects {
maven("https://hub.jeff-media.com/nexus/repository/jeff-media-public/") // CustomBlockData
maven("https://repo.triumphteam.dev/snapshots") // actions-code, actions-spigot
maven("https://mvn.lumine.io/repository/maven-public/") { metadataSources { artifact() } }// MythicMobs
maven("https://repo.mineinabyss.com/releases") // PlayerAnimator
maven("https://s01.oss.sonatype.org/content/repositories/snapshots") // commandAPI snapshots
maven("https://repo.oraxen.com/releases")
maven("https://repo.oraxen.com/snapshots")
Expand Down Expand Up @@ -106,7 +105,7 @@ allprojects {
implementation("dev.jorel:commandapi-bukkit-shade:$commandApiVersion")
implementation("org.bstats:bstats-bukkit:3.0.0")
implementation("org.glassfish:javax.json:1.1.4")
implementation("io.th0rgal:protectionlib:1.6.2")
implementation("io.th0rgal:protectionlib:1.7.0")
implementation("com.github.stefvanschie.inventoryframework:IF:0.10.12")
implementation("com.jeff-media:custom-block-data:2.2.2")
implementation("com.jeff-media:MorePersistentDataTypes:2.4.0")
Expand All @@ -126,7 +125,9 @@ dependencies {


java {
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
}

tasks {
Expand Down Expand Up @@ -165,7 +166,6 @@ tasks {
relocate("me.gabytm.util.actions", "io.th0rgal.oraxen.shaded.actions")
relocate("org.intellij.lang.annotations", "io.th0rgal.oraxen.shaded.intellij.annotations")
relocate("org.jetbrains.annotations", "io.th0rgal.oraxen.shaded.jetbrains.annotations")
relocate("com.ticxo.playeranimator", "io.th0rgal.oraxen.shaded.playeranimator")
relocate("dev.jorel", "io.th0rgal.oraxen.shaded")

manifest {
Expand Down
2 changes: 1 addition & 1 deletion core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ class PublishData(private val project: Project) {
fun append(name: String, appendCommit: Boolean, commitHash: String): String =
name.plus(append).plus(if (appendCommit && addCommit) "-".plus(commitHash) else "")
}
}
}
18 changes: 13 additions & 5 deletions core/src/main/java/io/th0rgal/oraxen/commands/CommandsManager.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package io.th0rgal.oraxen.commands;

import dev.jorel.commandapi.CommandAPICommand;
import dev.jorel.commandapi.arguments.*;
import dev.jorel.commandapi.arguments.ArgumentSuggestions;
import dev.jorel.commandapi.arguments.EntitySelectorArgument;
import dev.jorel.commandapi.arguments.GreedyStringArgument;
import dev.jorel.commandapi.arguments.IntegerArgument;
import dev.jorel.commandapi.arguments.TextArgument;
import io.th0rgal.oraxen.OraxenPlugin;
import io.th0rgal.oraxen.api.OraxenItems;
import io.th0rgal.oraxen.compatibilities.provided.placeholderapi.PapiAliases;
Expand Down Expand Up @@ -108,8 +112,10 @@ private CommandAPICommand getGiveCommand() {
for (final Player target : targets) {
for (final ItemStack item : items) {
final Map<Integer, ItemStack> output = target.getInventory().addItem(PapiAliases.setPlaceholders(target, item.clone(), true));
for (final ItemStack stack : output.values()) {
target.getWorld().dropItem(target.getLocation(), stack);
if (!output.isEmpty()) {
for (final ItemStack stack : output.values()) {
target.getWorld().dropItem(target.getLocation(), stack);
}
}
}
}
Expand Down Expand Up @@ -145,8 +151,10 @@ private CommandAPICommand getSimpleGiveCommand() {

for (final Player target : targets) {
final Map<Integer, ItemStack> output = target.getInventory().addItem(PapiAliases.setPlaceholders(target, ItemUpdater.updateItem(itemBuilder.build()).clone(), true));
for (final ItemStack stack : output.values()) {
target.getWorld().dropItem(target.getLocation(), stack);
if (!output.isEmpty()) {
for (final ItemStack stack : output.values()) {
target.getWorld().dropItem(target.getLocation(), stack);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ public void parseAllItemTemplates() {
YamlConfiguration configuration = OraxenYaml.loadConfiguration(file);
for (String key : configuration.getKeys(false)) {
ConfigurationSection itemSection = configuration.getConfigurationSection(key);
if (itemSection != null && itemSection.isBoolean("template")) new ItemTemplate(itemSection);
if (itemSection != null && itemSection.isBoolean("template")) ItemTemplate.register(itemSection);
}
}
}
Expand Down
20 changes: 19 additions & 1 deletion core/src/main/java/io/th0rgal/oraxen/items/ItemBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import io.th0rgal.oraxen.compatibilities.provided.mmoitems.WrappedMMOItem;
import io.th0rgal.oraxen.compatibilities.provided.mythiccrucible.WrappedCrucibleItem;
import io.th0rgal.oraxen.config.Settings;
import io.th0rgal.oraxen.nms.NMSHandlers;
import io.th0rgal.oraxen.utils.*;
import net.kyori.adventure.key.Key;
import net.kyori.adventure.text.Component;
Expand Down Expand Up @@ -74,6 +75,8 @@ public class ItemBuilder {
@Nullable
private FoodComponent foodComponent;
@Nullable
private Object consumableComponent;
@Nullable
private ToolComponent toolComponent;
@Nullable
private Boolean enchantmentGlintOverride;
Expand Down Expand Up @@ -485,6 +488,20 @@ public ItemBuilder setFoodComponent(@Nullable FoodComponent foodComponent) {
return this;
}

public boolean hasConsumableComponent() {
return VersionUtil.atOrAbove("1.21.2") && consumableComponent != null;
}

@Nullable
public Object getConsumableComponent() {
return consumableComponent;
}

public <V> ItemBuilder setConsumableComponent(@Nullable V consumableComponent) {
this.consumableComponent = consumableComponent;
return this;
}

public boolean hasToolComponent() {
return VersionUtil.atOrAbove("1.20.5") && toolComponent != null;
}
Expand Down Expand Up @@ -729,6 +746,7 @@ public ItemBuilder regen() {
if (hasEnchantable()) itemMeta.setEnchantable(enchantable);
if (itemModel != null) itemMeta.setItemModel(itemModel);
if (isGlider != null) itemMeta.setGlider(isGlider);

}

handleVariousMeta(itemMeta);
Expand Down Expand Up @@ -772,7 +790,7 @@ public ItemBuilder regen() {
else itemMeta.setLore(lore);

itemStack.setItemMeta(itemMeta);
finalItemStack = itemStack;
finalItemStack = NMSHandlers.getHandler().consumableComponent(itemStack, consumableComponent);

return this;
}
Expand Down
Loading

0 comments on commit 3bc1366

Please sign in to comment.