mirror of
https://github.com/rockyhawk64/CommandPanels.git
synced 2025-11-18 07:14:17 +01:00
Java 21 move
This commit is contained in:
parent
eaf5fbcd30
commit
420fbf93fb
@ -91,6 +91,11 @@
|
||||
<option name="name" value="jeff-media-public" />
|
||||
<option name="url" value="https://repo.jeff-media.com/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="reposilite-repository-releases" />
|
||||
<option name="name" value="Reposilite Repository" />
|
||||
<option name="url" value="https://repo.nexomc.com/releases" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
@ -6,7 +7,6 @@
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="workspaceImportForciblyTurnedOn" value="true" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" project-jdk-name="17" project-jdk-type="JavaSDK" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" project-jdk-name="21" project-jdk-type="JavaSDK" />
|
||||
</project>
|
||||
26
pom.xml
26
pom.xml
@ -91,6 +91,14 @@
|
||||
<id>jeff-media-public</id>
|
||||
<url>https://repo.jeff-media.com/public/</url>
|
||||
</repository>
|
||||
|
||||
<!-- Nexo -->
|
||||
<repository>
|
||||
<id>reposilite-repository-releases</id>
|
||||
<name>Reposilite Repository</name>
|
||||
<url>https://repo.nexomc.com/releases</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>ess-repo</id>
|
||||
<url>https://repo.essentialsx.net/releases/</url>
|
||||
@ -172,6 +180,8 @@
|
||||
<version>1.7.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- MMOItems -->
|
||||
<dependency>
|
||||
<groupId>net.Indyuce</groupId>
|
||||
<artifactId>MMOItems-API</artifactId>
|
||||
@ -184,6 +194,22 @@
|
||||
<version>1.6.2-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Nexo -->
|
||||
<dependency>
|
||||
<groupId>com.nexomc</groupId>
|
||||
<artifactId>nexo</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>provided</scope>
|
||||
<optional>true</optional>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>net.byteflux</groupId>
|
||||
<artifactId>libby-bukkit</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.arcaniax</groupId>
|
||||
<artifactId>HeadDatabase-API</artifactId>
|
||||
|
||||
@ -4,6 +4,7 @@ import me.rockyhawk.commandpanels.Context;
|
||||
import me.rockyhawk.commandpanels.api.Panel;
|
||||
import me.rockyhawk.commandpanels.items.builder.ItemComponent;
|
||||
import me.rockyhawk.commandpanels.manager.session.PanelPosition;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -18,7 +19,11 @@ public class ItemModelComponent implements ItemComponent {
|
||||
public ItemStack apply(ItemStack item, ConfigurationSection section, Context ctx, Player player, Panel panel, PanelPosition pos, boolean addNBT) {
|
||||
if(!section.contains("itemmodel")) return item;
|
||||
|
||||
//Item Model 1.21.4+
|
||||
if(ctx.version.isBelow("1.21.4")) {
|
||||
player.sendMessage(ChatColor.RED + "Item Model is 1.21.4+");
|
||||
return item;
|
||||
}
|
||||
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
assert itemMeta != null;
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ import me.rockyhawk.commandpanels.Context;
|
||||
import me.rockyhawk.commandpanels.api.Panel;
|
||||
import me.rockyhawk.commandpanels.items.builder.ItemComponent;
|
||||
import me.rockyhawk.commandpanels.manager.session.PanelPosition;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -18,14 +19,17 @@ public class PotionColorComponent implements ItemComponent {
|
||||
public ItemStack apply(ItemStack item, ConfigurationSection section, Context ctx, Player player, Panel panel, PanelPosition pos, boolean addNBT) {
|
||||
if(!section.contains("potion-color")) return item;
|
||||
|
||||
if(ctx.version.isAtLeast("1.11")){
|
||||
String[] rgb = Objects.requireNonNull(section.getString("potion-color")).split(",");
|
||||
Color color = Color.fromRGB(Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]), Integer.parseInt(rgb[2]));
|
||||
PotionMeta potionMeta = (PotionMeta)item.getItemMeta();
|
||||
assert potionMeta != null;
|
||||
potionMeta.setColor(color);
|
||||
item.setItemMeta(potionMeta);
|
||||
if(ctx.version.isBelow("1.11")) {
|
||||
player.sendMessage(ChatColor.RED + "Potion Colors are 1.11+");
|
||||
return item;
|
||||
}
|
||||
|
||||
String[] rgb = Objects.requireNonNull(section.getString("potion-color")).split(",");
|
||||
Color color = Color.fromRGB(Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]), Integer.parseInt(rgb[2]));
|
||||
PotionMeta potionMeta = (PotionMeta)item.getItemMeta();
|
||||
assert potionMeta != null;
|
||||
potionMeta.setColor(color);
|
||||
item.setItemMeta(potionMeta);
|
||||
return item;
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,7 @@
|
||||
package me.rockyhawk.commandpanels.items.builder.materialcomponents;
|
||||
|
||||
import com.nexomc.nexo.api.NexoItems;
|
||||
import com.nexomc.nexo.items.ItemBuilder;
|
||||
import me.rockyhawk.commandpanels.Context;
|
||||
import me.rockyhawk.commandpanels.api.Panel;
|
||||
import me.rockyhawk.commandpanels.items.builder.MaterialComponent;
|
||||
@ -8,8 +10,6 @@ import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class NexoComponent implements MaterialComponent {
|
||||
@Override
|
||||
public boolean matches(String tag) {
|
||||
@ -20,12 +20,9 @@ public class NexoComponent implements MaterialComponent {
|
||||
public ItemStack createItem(String tag, Player player, Context ctx, ConfigurationSection section, Panel panel, PanelPosition pos) {
|
||||
try {
|
||||
String itemID = tag.split("\\s")[1];
|
||||
Class<?> nexoItemsClass = Class.forName("com.nexomc.nexo.api.NexoItems");
|
||||
Method itemFromId = nexoItemsClass.getMethod("itemFromId", String.class);
|
||||
Object item = itemFromId.invoke(null, itemID);
|
||||
if (item != null) {
|
||||
Method buildMethod = item.getClass().getMethod("build");
|
||||
return (ItemStack) buildMethod.invoke(item);
|
||||
ItemBuilder builder = NexoItems.itemFromId(itemID);
|
||||
if (builder != null) {
|
||||
return builder.build();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ctx.debug.send(e, player, ctx);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user