Skip to content

Commit efa2337

Browse files
Version Push
1 parent 7931b91 commit efa2337

File tree

5 files changed

+114
-46
lines changed

5 files changed

+114
-46
lines changed

pom.xml

+16-4
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,17 @@
8080
<id>aikar</id>
8181
<url>https://repo.aikar.co/content/groups/aikar/</url>
8282
</repository>
83+
<repository>
84+
<id>minecraft-repo</id>
85+
<url>https://libraries.minecraft.net/</url>
86+
</repository>
8387
</repositories>
8488

8589
<dependencies>
8690
<dependency>
8791
<groupId>org.spigotmc</groupId>
8892
<artifactId>spigot-api</artifactId>
89-
<version>1.20.4-R0.1-SNAPSHOT</version>
93+
<version>1.20.6-R0.1-SNAPSHOT</version>
9094
<scope>provided</scope>
9195
</dependency>
9296
<dependency>
@@ -104,13 +108,14 @@
104108
<dependency>
105109
<groupId>me.clip</groupId>
106110
<artifactId>placeholderapi</artifactId>
107-
<version>2.11.5</version>
111+
<version>2.11.6</version>
108112
<scope>provided</scope>
109113
</dependency>
110114
<dependency>
111115
<groupId>org.projectlombok</groupId>
112116
<artifactId>lombok</artifactId>
113-
<version>1.18.32</version>
117+
<version>1.18.36</version>
118+
<scope>compile</scope>
114119
</dependency>
115120
<dependency>
116121
<groupId>sample</groupId>
@@ -122,7 +127,14 @@
122127
<dependency>
123128
<groupId>com.github.cryptomorin</groupId>
124129
<artifactId>XSeries</artifactId>
125-
<version>9.9.0</version>
130+
<version>11.3.0</version>
131+
<scope>compile</scope>
132+
</dependency>
133+
<dependency>
134+
<groupId>com.mojang</groupId>
135+
<artifactId>authlib</artifactId>
136+
<version>6.0.54</version>
137+
<scope>provided</scope>
126138
</dependency>
127139
</dependencies>
128140
</project>

src/main/java/net/bghddevelopment/punishmentgui/PunishGUI.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public final class PunishGUI extends JavaPlugin {
3838
private List<Listener> listeners = new ArrayList<>();
3939
private BannedManager bannedPlayersManager = BannedManager.getManager();
4040
private PlaceholderAPI placeholderAPI;
41-
private String Version = "1.1.9";
41+
private String Version = "1.1.10";
4242

4343
public static PunishGUI getInstance() {
4444
return PunishGUI.instance;

src/main/java/net/bghddevelopment/punishmentgui/menu/handler/ConfigItem.java

+34-16
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,22 @@
22

33
import ca.tweetzy.skulls.Skulls;
44
import ca.tweetzy.skulls.api.SkullsAPI;
5-
import com.cryptomorin.xseries.SkullUtils;
5+
import com.cryptomorin.xseries.XEnchantment;
66
import com.cryptomorin.xseries.XMaterial;
7+
import com.cryptomorin.xseries.profiles.builder.XSkull;
8+
import com.cryptomorin.xseries.profiles.objects.Profileable;
79
import lombok.Getter;
810
import lombok.Setter;
911
import me.arcaniax.hdb.api.HeadDatabaseAPI;
1012
import net.bghddevelopment.punishmentgui.utils.*;
11-
import org.bukkit.Bukkit;
1213
import org.bukkit.enchantments.Enchantment;
1314
import org.bukkit.inventory.ItemFlag;
1415
import org.bukkit.inventory.ItemStack;
1516
import org.bukkit.inventory.meta.ItemMeta;
1617
import org.bukkit.inventory.meta.SkullMeta;
1718

1819
import java.util.List;
20+
import java.util.UUID;
1921

2022
@Getter
2123
@Setter
@@ -98,37 +100,53 @@ public ItemStack toItemStack() {
98100
if (VersionCheck.isOnePointFourteenPlus()) {
99101
item.setCustomModelData(this.customModelData);
100102
} else {
101-
Utilities.log("&cAn error occurred when trying to set custom model data. Make sure your only using custom model data when on 1.14+.");
103+
Utilities.log("&cAn error occurred when trying to set custom model data. Make sure you're only using custom model data when on 1.14+.");
102104
}
103105
item.setDurability(this.durability);
104106
ItemMeta itemMeta = item.toItemStack().getItemMeta();
105107
if (itemMeta instanceof SkullMeta) {
106-
itemMeta = SkullUtils.applySkin(itemMeta, this.skullOwner);
107-
item.toItemStack().setItemMeta(itemMeta);
108+
SkullMeta skullMeta = (SkullMeta) itemMeta;
109+
updateSkullMeta(skullMeta, skullOwner);
110+
item.toItemStack().setItemMeta(skullMeta);
108111
}
109112
} else {
110113
item = new ItemBuilder(this.material.parseMaterial(), amount);
111114
item.setDurability(this.durability);
112115
ItemMeta itemMeta = item.toItemStack().getItemMeta();
113116
if (itemMeta instanceof SkullMeta) {
114-
itemMeta = SkullUtils.applySkin(itemMeta, this.skullOwner);
115-
item.toItemStack().setItemMeta(itemMeta);
117+
SkullMeta skullMeta = (SkullMeta) itemMeta;
118+
updateSkullMeta(skullMeta, skullOwner);
119+
item.toItemStack().setItemMeta(skullMeta);
116120
}
117121
}
118122
if (glow) {
119-
if (VersionCheck.isOnePointSeven()) {
120-
item.addEnchant(Enchantment.ARROW_DAMAGE, 1);
121-
} else {
122-
item.addEnchant(Enchantment.ARROW_DAMAGE, 1);
123-
ItemMeta itemMeta = item.toItemStack().getItemMeta();
124-
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
125-
itemMeta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
126-
item.toItemStack().setItemMeta(itemMeta);
127-
}
123+
item.addEnchant(XEnchantment.POWER.getEnchant(), 1);
124+
ItemMeta itemMeta = item.toItemStack().getItemMeta();
125+
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
126+
itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
127+
item.toItemStack().setItemMeta(itemMeta);
128128
}
129129
return commonConfig(item).toItemStack();
130130
}
131131

132+
public void updateSkullMeta(SkullMeta skullMeta, String owner) {
133+
Profileable profileable;
134+
135+
try {
136+
UUID uuid = UUID.fromString(owner);
137+
profileable = Profileable.of(uuid);
138+
} catch (IllegalArgumentException e) {
139+
profileable = Profileable.username(owner);
140+
}
141+
142+
// Apply the profile to the SkullMeta
143+
skullMeta = (SkullMeta) XSkull.of(skullMeta).profile(profileable).apply();
144+
145+
// Set the modified SkullMeta back to the original object
146+
skullMeta.setOwner(owner);
147+
}
148+
149+
132150
private ItemBuilder commonConfig(ItemBuilder item) {
133151
item.setName(this.name);
134152
item.setLore(this.lore);
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,86 @@
1+
/*
2+
* Copyright (c) 2015-2023. BGHDDevelopment LLC.
3+
* Contact: [email protected]
4+
* Terms: https://bghddevelopment.com/tos
5+
* Discord: https://bghddevelopment.com/discord
6+
*/
7+
18
package net.bghddevelopment.punishmentgui.utils;
29

10+
import lombok.Getter;
311
import org.bukkit.Bukkit;
412

13+
@Getter
514
public class VersionCheck {
615

7-
public static boolean isOnePointEightPlus() {
8-
if (Bukkit.getVersion().contains("1.8") || Bukkit.getVersion().contains("1.9") || Bukkit.getVersion().contains("1.10") || Bukkit.getVersion().contains("1.11") || Bukkit.getVersion().contains("1.12") || Bukkit.getVersion().contains("1.13") || Bukkit.getVersion().contains("1.14") || Bukkit.getVersion().contains("1.15") || Bukkit.getVersion().contains("1.16") || Bukkit.getVersion().contains("1.17") || Bukkit.getVersion().contains("1.18") || Bukkit.getVersion().contains("1.19") || Bukkit.getVersion().contains("1.20")) {
9-
return true;
16+
private static boolean versionMatches(String... versions) {
17+
String serverVersion = Bukkit.getServer().getVersion();
18+
String minecraftVersion = serverVersion.substring(serverVersion.indexOf("(MC: ") + 5, serverVersion.indexOf(")"));
19+
for (String v : versions) {
20+
if (minecraftVersion.contains(v)) {
21+
return true;
22+
}
1023
}
1124
return false;
1225
}
1326

27+
public static boolean isOnePointEightPlus() {
28+
return versionMatches("1.8", "1.9", "1.10", "1.11", "1.12", "1.13", "1.14", "1.15", "1.16", "1.17", "1.18", "1.19", "1.20", "1.21", "1.21.1", "1.21.2", "1.21.3");
29+
}
30+
1431
public static boolean isOnePointNinePlus() {
15-
if (Bukkit.getVersion().contains("1.9") || Bukkit.getVersion().contains("1.10") || Bukkit.getVersion().contains("1.11") || Bukkit.getVersion().contains("1.12") || Bukkit.getVersion().contains("1.13") || Bukkit.getVersion().contains("1.14") || Bukkit.getVersion().contains("1.15") || Bukkit.getVersion().contains("1.16") || Bukkit.getVersion().contains("1.17") || Bukkit.getVersion().contains("1.18") || Bukkit.getVersion().contains("1.19") || Bukkit.getVersion().contains("1.20")) {
16-
return true;
17-
}
18-
return false;
32+
return versionMatches("1.9", "1.10", "1.11", "1.12", "1.13", "1.14", "1.15", "1.16", "1.17", "1.18", "1.19", "1.20", "1.21", "1.21.1", "1.21.2", "1.21.3");
33+
}
34+
35+
public static boolean isOnePointTenPlus() {
36+
return versionMatches("1.10", "1.11", "1.12", "1.13", "1.14", "1.15", "1.16", "1.17", "1.18", "1.19", "1.20", "1.21", "1.21.1", "1.21.2", "1.21.3");
37+
}
38+
39+
public static boolean isOnePointElevenPlus() {
40+
return versionMatches("1.11", "1.12", "1.13", "1.14", "1.15", "1.16", "1.17", "1.18", "1.19", "1.20", "1.21", "1.21.1", "1.21.2", "1.21.3");
41+
}
42+
43+
public static boolean isOnePointTwelvePlus() {
44+
return versionMatches("1.12", "1.13", "1.14", "1.15", "1.16", "1.17", "1.18", "1.19", "1.20", "1.21", "1.21.1", "1.21.2", "1.21.3");
1945
}
2046

2147
public static boolean isOnePointThirteenPlus() {
22-
if (Bukkit.getVersion().contains("1.13") || Bukkit.getVersion().contains("1.14") || Bukkit.getVersion().contains("1.15") || Bukkit.getVersion().contains("1.16") || Bukkit.getVersion().contains("1.17") || Bukkit.getVersion().contains("1.18") || Bukkit.getVersion().contains("1.19") || Bukkit.getVersion().contains("1.20")) {
23-
return true;
24-
}
25-
return false;
48+
return versionMatches("1.13", "1.14", "1.15", "1.16", "1.17", "1.18", "1.19", "1.20", "1.21", "1.21.1", "1.21.2", "1.21.3");
2649
}
2750

2851
public static boolean isOnePointFourteenPlus() {
29-
if (Bukkit.getVersion().contains("1.14") || Bukkit.getVersion().contains("1.15") || Bukkit.getVersion().contains("1.16") || Bukkit.getVersion().contains("1.17") || Bukkit.getVersion().contains("1.18") || Bukkit.getVersion().contains("1.19") || Bukkit.getVersion().contains("1.20")) {
30-
return true;
31-
}
32-
return false;
52+
return versionMatches("1.14", "1.15", "1.16", "1.17", "1.18", "1.19", "1.20", "1.21", "1.21.1", "1.21.2", "1.21.3");
53+
}
54+
55+
public static boolean isOnePointFifteenPlus() {
56+
return versionMatches("1.15", "1.16", "1.17", "1.18", "1.19", "1.20", "1.21", "1.21.1", "1.21.2", "1.21.3");
3357
}
3458

3559
public static boolean isOnePointSixteenPlus() {
36-
if (Bukkit.getVersion().contains("1.16") || Bukkit.getVersion().contains("1.17") || Bukkit.getVersion().contains("1.18") || Bukkit.getVersion().contains("1.19") || Bukkit.getVersion().contains("1.20")) {
37-
return true;
38-
}
39-
return false;
60+
return versionMatches("1.16", "1.17", "1.18", "1.19", "1.20", "1.21", "1.21.1", "1.21.2", "1.21.3");
4061
}
4162

42-
public static boolean isOnePointSeven() {
43-
if (Bukkit.getVersion().contains("1.7")) {
44-
return true;
45-
}
46-
return false;
63+
public static boolean isOnePointSeventeenPlus() {
64+
return versionMatches("1.17", "1.18", "1.19", "1.20", "1.21", "1.21.1", "1.21.2", "1.21.3");
65+
}
66+
67+
public static boolean isOnePointEighteenPlus() {
68+
return versionMatches("1.18", "1.19", "1.20", "1.21", "1.21.1", "1.21.2", "1.21.3");
69+
}
70+
71+
public static boolean isOnePointNineteenPlus() {
72+
return versionMatches("1.19", "1.20", "1.21", "1.21.1", "1.21.2", "1.21.3");
73+
}
74+
75+
public static boolean isOnePointTwentyPointFivePlus() {
76+
return versionMatches("1.20.5", "1.20.6", "1.21", "1.21.1", "1.21.2", "1.21.3");
77+
}
78+
79+
public static boolean isVersionAvailable() {
80+
return versionMatches("1.8", "1.9", "1.10", "1.11", "1.12", "1.13", "1.14", "1.15", "1.16", "1.17", "1.18", "1.19", "1.20", "1.20.5", "1.20.6", "1.21", "1.21.1", "1.21.2", "1.21.3");
81+
}
82+
83+
public static boolean isVersionStable() {
84+
return versionMatches("1.8", "1.20", "1.21", "1.21.1", "1.21.2", "1.21.3");
4785
}
4886
}

src/main/resources/plugin.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: PunishGUI
2-
version: 1.1.9
2+
version: 1.1.10
33
main: net.bghddevelopment.punishmentgui.PunishGUI
44
author: BGHDDevelopmentLLC
55
api-version: 1.13

0 commit comments

Comments
 (0)