Merge branch 'development'

This commit is contained in:
Christian Koop 2024-10-02 16:09:17 +02:00
commit 72e0b6d2a4
No known key found for this signature in database
GPG Key ID: 6A4A09E8ED946113
56 changed files with 512 additions and 369 deletions

12
pom.xml
View File

@ -6,11 +6,11 @@
<groupId>com.craftaro</groupId> <groupId>com.craftaro</groupId>
<artifactId>FabledSkyBlock</artifactId> <artifactId>FabledSkyBlock</artifactId>
<version>3.0.6</version> <version>3.1.0</version>
<name>FabledSkyBlock</name> <name>FabledSkyBlock</name>
<description>Bring your server's SkyBlock experience to the next level with the ability to fine-tune island settings, create custom islands, view leaderboards, and much more</description> <description>Bring your server's SkyBlock experience to the next level with the ability to fine-tune island settings, create custom islands, view leaderboards, and much more</description>
<url>https://craftaro.com/marketplace/product/17</url> <url>https://songoda.com/product/fabledskyblock-13</url>
<properties> <properties>
<maven.compiler.release>8</maven.compiler.release> <maven.compiler.release>8</maven.compiler.release>
@ -25,7 +25,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>3.5.2</version> <version>3.6.0</version>
<executions> <executions>
<execution> <execution>
@ -69,10 +69,10 @@
<excludeDefaults>false</excludeDefaults> <excludeDefaults>false</excludeDefaults>
<includes> <includes>
<include>**/nms/v*/**</include> <include>**/nms/v*/**</include>
<include>**/third_party/net/kyori/**</include>
</includes> </includes>
<excludes> <excludes>
<exclude>**/third_party/org/apache/**</exclude> <exclude>**/third_party/org/apache/**</exclude>
<exclude>**/third_party/net/kyori/**</exclude>
<exclude>**/third_party/com/zaxxer/**</exclude> <exclude>**/third_party/com/zaxxer/**</exclude>
<exclude>**/third_party/org/jooq/**</exclude> <exclude>**/third_party/org/jooq/**</exclude>
<exclude>**/third_party/org/mariadb/**</exclude> <exclude>**/third_party/org/mariadb/**</exclude>
@ -139,7 +139,7 @@
<dependency> <dependency>
<groupId>com.craftaro</groupId> <groupId>com.craftaro</groupId>
<artifactId>CraftaroCore</artifactId> <artifactId>CraftaroCore</artifactId>
<version>3.0.0-SNAPSHOT</version> <version>3.5.0-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
@ -174,7 +174,7 @@
<dependency> <dependency>
<groupId>me.clip</groupId> <groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId> <artifactId>placeholderapi</artifactId>
<version>2.11.5</version> <version>2.11.6</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>

View File

@ -2,13 +2,12 @@ package com.craftaro.skyblock;
import com.craftaro.core.SongodaCore; import com.craftaro.core.SongodaCore;
import com.craftaro.core.SongodaPlugin; import com.craftaro.core.SongodaPlugin;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerProject; import com.craftaro.core.compatibility.ServerProject;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.configuration.Config; import com.craftaro.core.configuration.Config;
import com.craftaro.core.gui.GuiManager; import com.craftaro.core.gui.GuiManager;
import com.craftaro.core.hooks.HologramManager; import com.craftaro.core.hooks.HologramManager;
import com.craftaro.core.hooks.LogManager; import com.craftaro.core.hooks.LogManager;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.skyblock.api.SkyBlockAPI; import com.craftaro.skyblock.api.SkyBlockAPI;
import com.craftaro.skyblock.ban.BanManager; import com.craftaro.skyblock.ban.BanManager;
import com.craftaro.skyblock.bank.BankManager; import com.craftaro.skyblock.bank.BankManager;
@ -71,6 +70,7 @@ import com.craftaro.skyblock.usercache.UserCacheManager;
import com.craftaro.skyblock.visit.VisitManager; import com.craftaro.skyblock.visit.VisitManager;
import com.craftaro.skyblock.visit.VisitTask; import com.craftaro.skyblock.visit.VisitTask;
import com.craftaro.skyblock.world.WorldManager; import com.craftaro.skyblock.world.WorldManager;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import net.milkbowl.vault.permission.Permission; import net.milkbowl.vault.permission.Permission;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -81,9 +81,7 @@ import org.bukkit.plugin.PluginManager;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.io.File; import java.io.File;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
public class SkyBlock extends SongodaPlugin { public class SkyBlock extends SongodaPlugin {
private FileManager fileManager; private FileManager fileManager;
@ -154,17 +152,18 @@ public class SkyBlock extends SongodaPlugin {
@Override @Override
public void onPluginEnable() { public void onPluginEnable() {
if (ServerVersion.isServerVersionAbove(ServerVersion.V1_20) || ServerVersion.isServerVersionBelow(ServerVersion.V1_8)) { if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_20) || MajorServerVersion.isServerVersionBelow(MajorServerVersion.V1_8)) {
this.getLogger().warning("This Minecraft version is not officially supported."); this.getLogger().warning("This Minecraft version is not officially supported.");
} }
if (this.paper = ServerProject.isServer(ServerProject.PAPER)) { this.paper = ServerProject.isServer(ServerProject.PAPER);
if (this.paper) {
try { try {
Bukkit.spigot().getClass().getMethod("getPaperConfig"); Bukkit.spigot().getClass().getMethod("getPaperConfig");
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_16)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_16)) {
this.paperAsync = true; this.paperAsync = true;
} else { } else {
this.paperAsync = ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13) && this.paperAsync = MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13) &&
Bukkit.spigot().getPaperConfig().getBoolean("settings.async-chunks.enable", false); Bukkit.spigot().getPaperConfig().getBoolean("settings.async-chunks.enable", false);
} }
} catch (NoSuchMethodException ignored) { } catch (NoSuchMethodException ignored) {
@ -266,7 +265,7 @@ public class SkyBlock extends SongodaPlugin {
pluginManager.registerEvents(new FallBreakListeners(this), this); pluginManager.registerEvents(new FallBreakListeners(this), this);
pluginManager.registerEvents(new WorldListeners(this), this); pluginManager.registerEvents(new WorldListeners(this), this);
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) {
pluginManager.registerEvents(new SpongeListeners(this), this); pluginManager.registerEvents(new SpongeListeners(this), this);
} }

View File

@ -1,6 +1,7 @@
package com.craftaro.skyblock.blockscanner; package com.craftaro.skyblock.blockscanner;
import com.craftaro.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.skyblock.utils.world.WorldUtil; import com.craftaro.skyblock.utils.world.WorldUtil;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
@ -272,7 +273,7 @@ public final class BlockScanner extends BukkitRunnable {
for (int z = initZ; z <= lastZ; z++) { for (int z = initZ; z <= lastZ; z++) {
for (int y = scanY; y < world.getMaxHeight(); y++) { for (int y = scanY; y < world.getMaxHeight(); y++) {
final Optional<XMaterial> type = CompatibleMaterial.getMaterial( final Optional<XMaterial> type = CompatibleMaterial.getMaterial(
ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13) MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)
? shot.getSnapshot().getBlockType(x, y, z) : ? shot.getSnapshot().getBlockType(x, y, z) :
MaterialIDHelper.getLegacyMaterial(getBlockTypeID(shot, x, y, z))); MaterialIDHelper.getLegacyMaterial(getBlockTypeID(shot, x, y, z)));

View File

@ -1,6 +1,6 @@
package com.craftaro.skyblock.blockscanner; package com.craftaro.skyblock.blockscanner;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.MajorServerVersion;
import org.bukkit.Material; import org.bukkit.Material;
import java.util.HashMap; import java.util.HashMap;
@ -15,7 +15,7 @@ public final class MaterialIDHelper {
static { static {
MATERIALS = new HashMap<>(); MATERIALS = new HashMap<>();
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) {
for (Material type : Material.values()) { for (Material type : Material.values()) {
if (type.isLegacy()) { if (type.isLegacy()) {
MATERIALS.put(type.getId(), type); MATERIALS.put(type.getId(), type);

View File

@ -1,5 +1,6 @@
package com.craftaro.skyblock.config; package com.craftaro.skyblock.config;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.island.IslandWorld; import com.craftaro.skyblock.island.IslandWorld;
import com.google.common.io.ByteStreams; import com.google.common.io.ByteStreams;
@ -93,17 +94,28 @@ public class FileManager {
if (fileName.equals("structures/default.structure")) { if (fileName.equals("structures/default.structure")) {
configFile.delete(); configFile.delete();
try { if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_20_5)) {
configFile.createNewFile(); //Copy default_1_20_5.structure instead of default.structure
} catch (IOException ex) { try (InputStream is = this.plugin.getResource("structures/default_1_20_5.structure"); OutputStream os = Files.newOutputStream(configFile.toPath())) {
ex.printStackTrace(); if (is != null) {
} ByteStreams.copy(is, os);
try (InputStream is = this.plugin.getResource(fileName); OutputStream os = Files.newOutputStream(configFile.toPath())) { }
if (is != null) { } catch (IOException ex) {
ByteStreams.copy(is, os); ex.printStackTrace();
}
} else {
try {
configFile.createNewFile();
} catch (IOException ex) {
ex.printStackTrace();
}
try (InputStream is = this.plugin.getResource(fileName); OutputStream os = Files.newOutputStream(configFile.toPath())) {
if (is != null) {
ByteStreams.copy(is, os);
}
} catch (IOException ex) {
ex.printStackTrace();
} }
} catch (IOException ex) {
ex.printStackTrace();
} }
continue; continue;
} }

View File

@ -1,6 +1,7 @@
package com.craftaro.skyblock.generator; package com.craftaro.skyblock.generator;
import com.craftaro.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.third_party.com.cryptomorin.xseries.XBlock; import com.craftaro.third_party.com.cryptomorin.xseries.XBlock;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
@ -109,7 +110,7 @@ public class GeneratorManager {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
private int getLiquidLevel(Block block) { private int getLiquidLevel(Block block) {
if (ServerVersion.isServerVersionAbove(ServerVersion.V1_12) && block.getState().getBlockData() instanceof Levelled) { if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_12) && block.getState().getBlockData() instanceof Levelled) {
Levelled levelled = (Levelled) block.getState().getBlockData(); Levelled levelled = (Levelled) block.getState().getBlockData();
return levelled.getLevel(); return levelled.getLevel();
} else { } else {
@ -131,7 +132,7 @@ public class GeneratorManager {
this.plugin.getSoundManager().playSound(block.getLocation(), XSound.BLOCK_FIRE_EXTINGUISH, 1, 10); this.plugin.getSoundManager().playSound(block.getLocation(), XSound.BLOCK_FIRE_EXTINGUISH, 1, 10);
if (ServerVersion.isServerVersionAbove(ServerVersion.V1_12)) { if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_12)) {
XBlock.setType(block, materials); XBlock.setType(block, materials);
} else { } else {
ItemStack is = materials.parseItem(); ItemStack is = materials.parseItem();

View File

@ -3,10 +3,9 @@ package com.craftaro.skyblock.gui.coop;
import com.craftaro.core.gui.AnvilGui; import com.craftaro.core.gui.AnvilGui;
import com.craftaro.core.gui.Gui; import com.craftaro.core.gui.Gui;
import com.craftaro.core.gui.GuiUtils; import com.craftaro.core.gui.GuiUtils;
import com.craftaro.third_party.com.cryptomorin.xseries.SkullUtils; import com.craftaro.core.utils.SkullItemCreator;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound; import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.ItemUtils;
import com.craftaro.core.utils.TextUtils; import com.craftaro.core.utils.TextUtils;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.island.Island; import com.craftaro.skyblock.island.Island;
@ -19,7 +18,6 @@ import com.craftaro.skyblock.sound.SoundManager;
import com.craftaro.skyblock.utils.player.OfflinePlayer; import com.craftaro.skyblock.utils.player.OfflinePlayer;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
@ -28,6 +26,7 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ExecutionException;
public class GuiCoop extends Gui { public class GuiCoop extends Gui {
private final SkyBlock plugin; private final SkyBlock plugin;
@ -155,7 +154,18 @@ public class GuiCoop extends Gui {
targetPlayerTexture = new String[]{null, null}; targetPlayerTexture = new String[]{null, null};
} }
} }
ItemStack phead = SkullUtils.getSkull(targetPlayer.getUniqueId());
ItemStack phead;
if (targetPlayerTexture.length >= 1 && targetPlayerTexture[0] != null) {
phead = SkullItemCreator.byTextureValue(targetPlayerTexture[0]);
} else {
try {
phead = SkullItemCreator.byUuid(uuid).get();
} catch (InterruptedException | ExecutionException ex) {
throw new RuntimeException(ex);
}
}
ItemMeta pheadmeta = phead.getItemMeta(); ItemMeta pheadmeta = phead.getItemMeta();
if (pheadmeta != null) { if (pheadmeta != null) {
pheadmeta.setDisplayName(TextUtils.formatText(this.languageLoad.getString("Menu.Coop.Item.Coop.Displayname") pheadmeta.setDisplayName(TextUtils.formatText(this.languageLoad.getString("Menu.Coop.Item.Coop.Displayname")

View File

@ -2,10 +2,9 @@ package com.craftaro.skyblock.gui.wip;
import com.craftaro.core.gui.Gui; import com.craftaro.core.gui.Gui;
import com.craftaro.core.gui.GuiUtils; import com.craftaro.core.gui.GuiUtils;
import com.craftaro.third_party.com.cryptomorin.xseries.SkullUtils; import com.craftaro.core.utils.SkullItemCreator;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound; import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.ItemUtils;
import com.craftaro.core.utils.TextUtils; import com.craftaro.core.utils.TextUtils;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.island.Island; import com.craftaro.skyblock.island.Island;
@ -15,7 +14,6 @@ import com.craftaro.skyblock.utils.player.OfflinePlayer;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
@ -23,6 +21,7 @@ import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ExecutionException;
public class GuiBans extends Gui { public class GuiBans extends Gui {
private final PlayerDataManager playerDataManager; private final PlayerDataManager playerDataManager;
@ -119,7 +118,17 @@ public class GuiBans extends Gui {
} }
} }
ItemStack is = SkullUtils.getSkull(targetPlayer.getUniqueId()); ItemStack is;
if (targetPlayerTexture.length >= 1 && targetPlayerTexture[0] != null) {
is = SkullItemCreator.byTextureValue(targetPlayerTexture[0]);
} else {
try {
is = SkullItemCreator.byUuid(uuid).get();
} catch (InterruptedException | ExecutionException ex) {
throw new RuntimeException(ex);
}
}
ItemMeta im = is.getItemMeta(); ItemMeta im = is.getItemMeta();
if (im != null) { if (im != null) {
im.setDisplayName(this.languageLoad.getString("Menu.Bans.Item.Ban.Displayname") im.setDisplayName(this.languageLoad.getString("Menu.Bans.Item.Ban.Displayname")

View File

@ -46,6 +46,7 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Objects; import java.util.Objects;
@ -60,6 +61,7 @@ public class Island {
private final List<IslandLocation> islandLocations = new ArrayList<>(); private final List<IslandLocation> islandLocations = new ArrayList<>();
private final Map<UUID, IslandCoop> coopPlayers = new HashMap<>(); private final Map<UUID, IslandCoop> coopPlayers = new HashMap<>();
private final Set<UUID> whitelistedPlayers = new HashSet<>(); private final Set<UUID> whitelistedPlayers = new HashSet<>();
private final Map<IslandRole, Set<UUID>> roleCache = new HashMap<>();
private UUID islandUUID; private UUID islandUUID;
private UUID ownerUUID; private UUID ownerUUID;
@ -203,13 +205,14 @@ public class Island {
for (BasicPermission permission : allPermissions) { for (BasicPermission permission : allPermissions) {
if (settingsDataConfig == null || settingsDataConfig.getFileConfiguration() if (settingsDataConfig == null || settingsDataConfig.getFileConfiguration()
.getString("Settings." + roleList.getFriendlyName().toUpperCase() + "." + permission.getName()) == null) { .getString("Settings." + roleList.getFriendlyName().toUpperCase(Locale.US) + "." + permission.getName()) == null) {
//save default value if not exist
permissions.add( permissions.add(
new IslandPermission(permission, this.plugin.getSettings() new IslandPermission(permission, this.plugin.getSettings()
.getBoolean("Settings." + roleList.getFriendlyName().toUpperCase() + "." + permission.getName(), true))); .getBoolean("Settings." + roleList.getFriendlyName().toUpperCase(Locale.US) + "." + permission.getName(), permission.getDefaultValues().get(roleList))));
} else { } else {
permissions.add(new IslandPermission(permission, settingsDataConfig.getFileConfiguration() permissions.add(new IslandPermission(permission, settingsDataConfig.getFileConfiguration()
.getBoolean("Settings." + roleList.getFriendlyName().toUpperCase() + "." + permission.getName(), true))); .getBoolean("Settings." + roleList.getFriendlyName().toUpperCase(Locale.US) + "." + permission.getName(), true)));
} }
} }
@ -597,6 +600,11 @@ public class Island {
} }
public Set<UUID> getRole(IslandRole role) { public Set<UUID> getRole(IslandRole role) {
if (roleCache.containsKey(role)) {
return new HashSet<>(roleCache.get(role)); // Return a copy to avoid external modification
}
Set<UUID> islandRoles = new HashSet<>(); Set<UUID> islandRoles = new HashSet<>();
if (role == IslandRole.OWNER) { if (role == IslandRole.OWNER) {
@ -613,6 +621,8 @@ public class Island {
} }
} }
roleCache.put(role, islandRoles);
return islandRoles; return islandRoles;
} }
@ -671,6 +681,9 @@ public class Island {
getVisit().setMembers(getRole(IslandRole.MEMBER).size() + getRole(IslandRole.OPERATOR).size() + 1); getVisit().setMembers(getRole(IslandRole.MEMBER).size() + getRole(IslandRole.OPERATOR).size() + 1);
//Update role cache
roleCache.remove(role);
return true; return true;
} }
} }
@ -697,6 +710,9 @@ public class Island {
getVisit().setMembers(getRole(IslandRole.MEMBER).size() + getRole(IslandRole.OPERATOR).size() + 1); getVisit().setMembers(getRole(IslandRole.MEMBER).size() + getRole(IslandRole.OPERATOR).size() + 1);
//Update role cache
roleCache.remove(role);
return true; return true;
} }
} }
@ -918,7 +934,7 @@ public class Island {
for (Entry<IslandRole, List<IslandPermission>> entry : this.islandPermissions.entrySet()) { for (Entry<IslandRole, List<IslandPermission>> entry : this.islandPermissions.entrySet()) {
for (IslandPermission permission : entry.getValue()) { for (IslandPermission permission : entry.getValue()) {
configLoad.set("Settings." + entry.getKey() + "." + permission.getPermission().getName(), permission.getStatus()); configLoad.set("Settings." + entry.getKey().getFriendlyName().toUpperCase(Locale.US) + "." + permission.getPermission().getName(), permission.getStatus());
} }
} }

View File

@ -1,5 +1,6 @@
package com.craftaro.skyblock.island; package com.craftaro.skyblock.island;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
@ -104,7 +105,7 @@ public class IslandLevel {
} }
public long getMaterialPoints(String material) { public long getMaterialPoints(String material) {
if (ServerVersion.isServerVersion(ServerVersion.V1_8)) { if (MajorServerVersion.isServerVersion(MajorServerVersion.V1_8)) {
switch (material.toUpperCase()) { switch (material.toUpperCase()) {
case "DIODE_BLOCK_OFF": case "DIODE_BLOCK_OFF":
case "DIODE_BLOCK_ON": case "DIODE_BLOCK_ON":
@ -216,7 +217,7 @@ public class IslandLevel {
} }
public void setMaterialAmount(String material, long amount) { public void setMaterialAmount(String material, long amount) {
if (ServerVersion.isServerVersion(ServerVersion.V1_8)) { if (MajorServerVersion.isServerVersion(MajorServerVersion.V1_8)) {
switch (material.toUpperCase()) { switch (material.toUpperCase()) {
case "DIODE_BLOCK_OFF": case "DIODE_BLOCK_OFF":
case "DIODE_BLOCK_ON": case "DIODE_BLOCK_ON":
@ -232,7 +233,7 @@ public class IslandLevel {
} }
public long getMaterialAmount(String material) { public long getMaterialAmount(String material) {
if (ServerVersion.isServerVersion(ServerVersion.V1_8)) { if (MajorServerVersion.isServerVersion(MajorServerVersion.V1_8)) {
switch (material.toUpperCase()) { switch (material.toUpperCase()) {
case "DIODE_BLOCK_OFF": case "DIODE_BLOCK_OFF":
case "DIODE_BLOCK_ON": case "DIODE_BLOCK_ON":
@ -244,7 +245,7 @@ public class IslandLevel {
} }
public void removeMaterial(String material) { public void removeMaterial(String material) {
if (ServerVersion.isServerVersion(ServerVersion.V1_8)) { if (MajorServerVersion.isServerVersion(MajorServerVersion.V1_8)) {
switch (material.toUpperCase()) { switch (material.toUpperCase()) {
case "DIODE_BLOCK_OFF": case "DIODE_BLOCK_OFF":
case "DIODE_BLOCK_ON": case "DIODE_BLOCK_ON":

View File

@ -5,6 +5,7 @@ import com.bekvon.bukkit.residence.containers.Flags;
import com.bekvon.bukkit.residence.protection.ClaimedResidence; import com.bekvon.bukkit.residence.protection.ClaimedResidence;
import com.craftaro.core.compatibility.CompatibleBiome; import com.craftaro.core.compatibility.CompatibleBiome;
import com.craftaro.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.nms.Nms; import com.craftaro.core.nms.Nms;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
@ -1502,7 +1503,7 @@ public class IslandManager {
updateFlight(player); updateFlight(player);
if (world == IslandWorld.NETHER) { if (world == IslandWorld.NETHER) {
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_13)) { if (MajorServerVersion.isServerVersionBelow(MajorServerVersion.V1_13)) {
return; return;
} }
} }
@ -1665,7 +1666,7 @@ public class IslandManager {
double increment = island.getSize() % 2 != 0 ? 0.5d : 0.0d; double increment = island.getSize() % 2 != 0 ? 0.5d : 0.0d;
for (IslandWorld worldList : IslandWorld.getIslandWorlds()) { for (IslandWorld worldList : IslandWorld.getIslandWorlds()) {
if (worldList != IslandWorld.NETHER || ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { if (worldList != IslandWorld.NETHER || MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) {
Bukkit.getScheduler().runTask(this.plugin, () -> { Bukkit.getScheduler().runTask(this.plugin, () -> {
for (Player all : getPlayersAtIsland(island)) { for (Player all : getPlayersAtIsland(island)) {
Nms.getImplementations().getWorldBorder().send(all, island.getBorderColor(), island.getSize(), island.getLocation(worldManager.getIslandWorld(all.getWorld()), IslandEnvironment.ISLAND).clone().add(increment, 0, increment)); Nms.getImplementations().getWorldBorder().send(all, island.getBorderColor(), island.getSize(), island.getLocation(worldManager.getIslandWorld(all.getWorld()), IslandEnvironment.ISLAND).clone().add(increment, 0, increment));
@ -1677,7 +1678,7 @@ public class IslandManager {
} }
} else { } else {
for (IslandWorld worldList : IslandWorld.getIslandWorlds()) { for (IslandWorld worldList : IslandWorld.getIslandWorlds()) {
if (worldList != IslandWorld.NETHER || ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { if (worldList != IslandWorld.NETHER || MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) {
Bukkit.getScheduler().runTask(this.plugin, () -> { Bukkit.getScheduler().runTask(this.plugin, () -> {
for (Player all : getPlayersAtIsland(island)) { for (Player all : getPlayersAtIsland(island)) {
Nms.getImplementations().getWorldBorder().send(all, null, 1.4999992E7D, new Location(all.getWorld(), 0, 0, 0)); Nms.getImplementations().getWorldBorder().send(all, null, 1.4999992E7D, new Location(all.getWorld(), 0, 0, 0));

View File

@ -1,6 +1,7 @@
package com.craftaro.skyblock.levelling; package com.craftaro.skyblock.levelling;
import com.craftaro.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
@ -260,7 +261,7 @@ public final class IslandLevelManager {
// placed. // placed.
// This shouldn't cause any issues besides the task number being increased // This shouldn't cause any issues besides the task number being increased
// insanely fast. // insanely fast.
if (ServerVersion.isServerVersion(ServerVersion.V1_8)) { if (MajorServerVersion.isServerVersion(MajorServerVersion.V1_8)) {
Bukkit.getScheduler().runTask(this.plugin, () -> { Bukkit.getScheduler().runTask(this.plugin, () -> {
updateLevelLocation(island, location); updateLevelLocation(island, location);
}); });
@ -272,7 +273,7 @@ public final class IslandLevelManager {
private void updateLevelLocation(Island island, Location location) { private void updateLevelLocation(Island island, Location location) {
Block block = location.getBlock(); Block block = location.getBlock();
XMaterial material = null; XMaterial material = null;
if (ServerVersion.isServerVersion(ServerVersion.V1_8)) { if (MajorServerVersion.isServerVersion(MajorServerVersion.V1_8)) {
switch (block.getType().toString().toUpperCase()) { switch (block.getType().toString().toUpperCase()) {
case "DIODE_BLOCK_OFF": case "DIODE_BLOCK_OFF":
case "DIODE_BLOCK_ON": case "DIODE_BLOCK_ON":

View File

@ -1,6 +1,7 @@
package com.craftaro.skyblock.limit.impl; package com.craftaro.skyblock.limit.impl;
import com.craftaro.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
@ -73,7 +74,7 @@ public final class BlockLimitation extends EnumLimitation<XMaterial> {
} }
XMaterial material = null; XMaterial material = null;
if (ServerVersion.isServerVersion(ServerVersion.V1_8)) { if (MajorServerVersion.isServerVersion(MajorServerVersion.V1_8)) {
switch (type.toString().toUpperCase()) { switch (type.toString().toUpperCase()) {
case "DIODE_BLOCK_OFF": case "DIODE_BLOCK_OFF":
case "DIODE_BLOCK_ON": case "DIODE_BLOCK_ON":
@ -111,7 +112,7 @@ public final class BlockLimitation extends EnumLimitation<XMaterial> {
totalPlaced = island.getLevel().getMaterials().entrySet().stream().filter(x -> x.getKey().contains("SPAWNER")).mapToLong(Map.Entry::getValue).sum(); totalPlaced = island.getLevel().getMaterials().entrySet().stream().filter(x -> x.getKey().contains("SPAWNER")).mapToLong(Map.Entry::getValue).sum();
} else { } else {
XMaterial material = null; XMaterial material = null;
if (ServerVersion.isServerVersion(ServerVersion.V1_8)) { if (MajorServerVersion.isServerVersion(MajorServerVersion.V1_8)) {
switch (type.toString().toUpperCase()) { switch (type.toString().toUpperCase()) {
case "DIODE_BLOCK_OFF": case "DIODE_BLOCK_OFF":
case "DIODE_BLOCK_ON": case "DIODE_BLOCK_ON":

View File

@ -1,6 +1,7 @@
package com.craftaro.skyblock.listeners; package com.craftaro.skyblock.listeners;
import com.craftaro.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.hooks.LogManager; import com.craftaro.core.hooks.LogManager;
import com.craftaro.third_party.com.cryptomorin.xseries.XBlock; import com.craftaro.third_party.com.cryptomorin.xseries.XBlock;
@ -115,7 +116,7 @@ public class BlockListeners implements Listener {
Stackable stackable = stackableManager.getStack(block.getLocation(), CompatibleMaterial.getMaterial(block.getType()).get()); Stackable stackable = stackableManager.getStack(block.getLocation(), CompatibleMaterial.getMaterial(block.getType()).get());
if (stackable != null) { if (stackable != null) {
XMaterial material = null; XMaterial material = null;
if (ServerVersion.isServerVersion(ServerVersion.V1_8)) { if (MajorServerVersion.isServerVersion(MajorServerVersion.V1_8)) {
switch (block.getType().toString().toUpperCase()) { switch (block.getType().toString().toUpperCase()) {
case "DIODE_BLOCK_OFF": case "DIODE_BLOCK_OFF":
case "DIODE_BLOCK_ON": case "DIODE_BLOCK_ON":
@ -194,7 +195,7 @@ public class BlockListeners implements Listener {
} }
XMaterial material = null; XMaterial material = null;
if (ServerVersion.isServerVersion(ServerVersion.V1_8)) { if (MajorServerVersion.isServerVersion(MajorServerVersion.V1_8)) {
switch (block.getType().toString().toUpperCase()) { switch (block.getType().toString().toUpperCase()) {
case "DIODE_BLOCK_OFF": case "DIODE_BLOCK_OFF":
case "DIODE_BLOCK_ON": case "DIODE_BLOCK_ON":
@ -271,7 +272,7 @@ public class BlockListeners implements Listener {
return; return;
} }
if (ServerVersion.isServerVersionAbove(ServerVersion.V1_8)) { if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_8)) {
if (event instanceof BlockMultiPlaceEvent) { if (event instanceof BlockMultiPlaceEvent) {
for (BlockState blockState : ((BlockMultiPlaceEvent) event).getReplacedBlockStates()) { for (BlockState blockState : ((BlockMultiPlaceEvent) event).getReplacedBlockStates()) {
if (!island.equals(islandManager.getIslandAtLocation(blockState.getLocation()))) { if (!island.equals(islandManager.getIslandAtLocation(blockState.getLocation()))) {
@ -334,13 +335,23 @@ public class BlockListeners implements Listener {
isObstructing = true; isObstructing = true;
} }
// Specific check for beds // Specific check for beds using getBlockData() for versions 1.13 and above
if (!isObstructing && event.getBlock().getState().getData() instanceof org.bukkit.material.Bed) { if (!isObstructing && event.getBlock().getBlockData() instanceof org.bukkit.block.data.type.Bed && MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) {
org.bukkit.block.data.type.Bed bedData = (org.bukkit.block.data.type.Bed) event.getBlock().getBlockData();
BlockFace bedDirection = bedData.getFacing();
org.bukkit.block.Block bedBlock = block.getRelative(bedDirection);
if (LocationUtil.isLocationAffectingIslandSpawn(bedBlock.getLocation(), island, world)) {
isObstructing = true;
}
} // Specific check for beds using getBlockData() for versions 1.12 and below
else if (MajorServerVersion.isServerVersionAtOrBelow(MajorServerVersion.V1_12)) {
if (!isObstructing && event.getBlock().getState().getData() instanceof org.bukkit.material.Bed){
BlockFace bedDirection = ((org.bukkit.material.Bed) event.getBlock().getState().getData()).getFacing(); BlockFace bedDirection = ((org.bukkit.material.Bed) event.getBlock().getState().getData()).getFacing();
org.bukkit.block.Block bedBlock = block.getRelative(bedDirection); org.bukkit.block.Block bedBlock = block.getRelative(bedDirection);
if (LocationUtil.isLocationAffectingIslandSpawn(bedBlock.getLocation(), island, world)) { if (LocationUtil.isLocationAffectingIslandSpawn(bedBlock.getLocation(), island, world)) {
isObstructing = true; isObstructing = true;
} }
}
} }
if (isObstructing) { if (isObstructing) {
@ -360,7 +371,7 @@ public class BlockListeners implements Listener {
if (limits.isBlockLimitExceeded(block, limit) && !XMaterial.ENDER_EYE.isSimilar(item)) { if (limits.isBlockLimitExceeded(block, limit) && !XMaterial.ENDER_EYE.isSimilar(item)) {
XMaterial material = null; XMaterial material = null;
if (ServerVersion.isServerVersion(ServerVersion.V1_8)) { if (MajorServerVersion.isServerVersion(MajorServerVersion.V1_8)) {
switch (block.getType().toString().toUpperCase()) { switch (block.getType().toString().toUpperCase()) {
case "DIODE_BLOCK_OFF": case "DIODE_BLOCK_OFF":
case "DIODE_BLOCK_ON": case "DIODE_BLOCK_ON":
@ -391,7 +402,7 @@ public class BlockListeners implements Listener {
// Not util used 2 islandLevelManager if condition is true // Not util used 2 islandLevelManager if condition is true
// Sponge level dupe fix // Sponge level dupe fix
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_13) && if (MajorServerVersion.isServerVersionBelow(MajorServerVersion.V1_13) &&
block.getType() == XMaterial.SPONGE.parseMaterial()) { block.getType() == XMaterial.SPONGE.parseMaterial()) {
Bukkit.getScheduler().runTask(this.plugin, () -> { Bukkit.getScheduler().runTask(this.plugin, () -> {
if (blockLoc.getBlock().getType() == XMaterial.WET_SPONGE.parseMaterial()) { if (blockLoc.getBlock().getType() == XMaterial.WET_SPONGE.parseMaterial()) {
@ -454,7 +465,7 @@ public class BlockListeners implements Listener {
for (Entity ent : entities) { for (Entity ent : entities) {
boolean witherSkeleton; boolean witherSkeleton;
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_11)) {
witherSkeleton = ent.getType().equals(EntityType.WITHER_SKELETON); witherSkeleton = ent.getType().equals(EntityType.WITHER_SKELETON);
} else { } else {
witherSkeleton = ent instanceof Skeleton && ((Skeleton) ent).getSkeletonType().equals(Skeleton.SkeletonType.WITHER); witherSkeleton = ent instanceof Skeleton && ((Skeleton) ent).getSkeletonType().equals(Skeleton.SkeletonType.WITHER);
@ -464,7 +475,7 @@ public class BlockListeners implements Listener {
XSound.BLOCK_FIRE_EXTINGUISH.play(block.getLocation()); XSound.BLOCK_FIRE_EXTINGUISH.play(block.getLocation());
event.getToBlock().getWorld().playEffect(block.getLocation(), Effect.SMOKE, 1); event.getToBlock().getWorld().playEffect(block.getLocation(), Effect.SMOKE, 1);
} else { } else {
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_16)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_16)) {
if (((ent instanceof Piglin || ent instanceof Hoglin) || ent instanceof Strider) || ent instanceof Zoglin) { if (((ent instanceof Piglin || ent instanceof Hoglin) || ent instanceof Strider) || ent instanceof Zoglin) {
event.setCancelled(true); event.setCancelled(true);
XSound.BLOCK_FIRE_EXTINGUISH.play(block.getLocation()); XSound.BLOCK_FIRE_EXTINGUISH.play(block.getLocation());
@ -488,7 +499,7 @@ public class BlockListeners implements Listener {
return; return;
} }
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_12)) { if (MajorServerVersion.isServerVersionBelow(MajorServerVersion.V1_12)) {
Bukkit.getScheduler().runTaskLater(this.plugin, () -> { Bukkit.getScheduler().runTaskLater(this.plugin, () -> {
handleGeneration(block, island, event.getToBlock().getState()); handleGeneration(block, island, event.getToBlock().getState());
}, 1L); }, 1L);
@ -719,7 +730,7 @@ public class BlockListeners implements Listener {
IslandManager islandManager = this.plugin.getIslandManager(); IslandManager islandManager = this.plugin.getIslandManager();
// PortalCreateEvent.getBlocks() changed from ArrayList<Block> to // PortalCreateEvent.getBlocks() changed from ArrayList<Block> to
// ArrayList<BlockState> in 1.14.1 // ArrayList<BlockState> in 1.14.1
if (ServerVersion.isServerVersionAbove(ServerVersion.V1_13)) { if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_13)) {
List<BlockState> blocks = event.getBlocks(); // TODO 1.8 List<BlockState> blocks = event.getBlocks(); // TODO 1.8
if (event.getBlocks().isEmpty()) { if (event.getBlocks().isEmpty()) {
return; return;
@ -828,7 +839,7 @@ public class BlockListeners implements Listener {
if (CompatibleMaterial.isAir(destmaterial)) { if (CompatibleMaterial.isAir(destmaterial)) {
return; return;
} }
if (ServerVersion.isServerVersion(ServerVersion.V1_8)) { if (MajorServerVersion.isServerVersion(MajorServerVersion.V1_8)) {
switch (event.getToBlock().getType().toString().toUpperCase()) { switch (event.getToBlock().getType().toString().toUpperCase()) {
case "DIODE_BLOCK_OFF": case "DIODE_BLOCK_OFF":
case "DIODE_BLOCK_ON": case "DIODE_BLOCK_ON":
@ -868,7 +879,7 @@ public class BlockListeners implements Listener {
XMaterial material = CompatibleMaterial.getMaterial(block.getType()).orElse(null); XMaterial material = CompatibleMaterial.getMaterial(block.getType()).orElse(null);
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_12) if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_12)
&& material != XMaterial.WATER && material != XMaterial.WATER
&& material != XMaterial.LAVA) { && material != XMaterial.LAVA) {
return false; return false;
@ -952,7 +963,7 @@ public class BlockListeners implements Listener {
BlockState genState = generatorManager.generateBlock(generator, block); BlockState genState = generatorManager.generateBlock(generator, block);
block.setType(genState.getType()); block.setType(genState.getType());
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_13)) { if (MajorServerVersion.isServerVersionBelow(MajorServerVersion.V1_13)) {
BlockState tempState = block.getState(); BlockState tempState = block.getState();
tempState.setData(genState.getData()); tempState.setData(genState.getData());
tempState.update(true, true); tempState.update(true, true);
@ -989,7 +1000,7 @@ public class BlockListeners implements Listener {
BlockState genState = generatorManager.generateBlock(generator, block); BlockState genState = generatorManager.generateBlock(generator, block);
state.setType(genState.getType()); state.setType(genState.getType());
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_13)) { if (MajorServerVersion.isServerVersionBelow(MajorServerVersion.V1_13)) {
state.setData(genState.getData()); state.setData(genState.getData());
} }
islandLevelManager.updateLevel(island, genState.getLocation()); islandLevelManager.updateLevel(island, genState.getLocation());

View File

@ -1,6 +1,7 @@
package com.craftaro.skyblock.listeners; package com.craftaro.skyblock.listeners;
import com.craftaro.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.third_party.com.cryptomorin.xseries.XBlock; import com.craftaro.third_party.com.cryptomorin.xseries.XBlock;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
@ -242,7 +243,7 @@ public class EntityListeners implements Listener {
return; return;
} }
if (ServerVersion.isServerVersion(ServerVersion.V1_8)) { if (MajorServerVersion.isServerVersion(MajorServerVersion.V1_8)) {
return; return;
} }
@ -371,7 +372,7 @@ public class EntityListeners implements Listener {
&& configLoad.getBoolean("Island.Spawn.Protection")) { && configLoad.getBoolean("Island.Spawn.Protection")) {
FallingBlock fallingBlock = (FallingBlock) event.getEntity(); FallingBlock fallingBlock = (FallingBlock) event.getEntity();
if (fallingBlock.getDropItem()) { if (fallingBlock.getDropItem()) {
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) {
fallingBlock.getWorld().dropItemNaturally(fallingBlock.getLocation(), fallingBlock.getWorld().dropItemNaturally(fallingBlock.getLocation(),
new ItemStack(fallingBlock.getBlockData().getMaterial(), 1)); new ItemStack(fallingBlock.getBlockData().getMaterial(), 1));
} else { } else {
@ -532,25 +533,25 @@ public class EntityListeners implements Listener {
return; return;
} }
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_10)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_10)) {
if (livingEntity instanceof Donkey || livingEntity instanceof Mule || livingEntity instanceof ElderGuardian) { if (livingEntity instanceof Donkey || livingEntity instanceof Mule || livingEntity instanceof ElderGuardian) {
return; return;
} }
} }
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_11)) {
if (livingEntity instanceof Evoker) { if (livingEntity instanceof Evoker) {
return; return;
} }
} }
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_12)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_12)) {
if (livingEntity instanceof Llama) { if (livingEntity instanceof Llama) {
return; return;
} }
} }
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_14)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_14)) {
if (livingEntity instanceof Ravager || livingEntity instanceof Illager) { if (livingEntity instanceof Ravager || livingEntity instanceof Illager) {
return; return;
} }
@ -577,19 +578,19 @@ public class EntityListeners implements Listener {
if (upgrades != null && !upgrades.isEmpty() && upgrades.get(0).isEnabled() && island.isUpgrade(Upgrade.Type.DROPS)) { if (upgrades != null && !upgrades.isEmpty() && upgrades.get(0).isEnabled() && island.isUpgrade(Upgrade.Type.DROPS)) {
Set<ItemStack> dontMultiply = new HashSet<>(); Set<ItemStack> dontMultiply = new HashSet<>();
if (ServerVersion.isServerVersionAbove(ServerVersion.V1_8)) { if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_8)) {
EntityEquipment equipment = livingEntity.getEquipment(); EntityEquipment equipment = livingEntity.getEquipment();
if (equipment != null) { if (equipment != null) {
for (ItemStack item : event.getDrops()) { for (ItemStack item : event.getDrops()) {
if (item.equals(equipment.getHelmet()) || item.equals(equipment.getChestplate()) if (item.isSimilar(equipment.getHelmet()) || item.isSimilar(equipment.getChestplate())
|| item.equals(equipment.getLeggings()) || item.equals(equipment.getBoots()) || item.isSimilar(equipment.getLeggings()) || item.isSimilar(equipment.getBoots())
|| item.equals(equipment.getItemInMainHand()) || item.equals(equipment.getItemInOffHand())) { || item.isSimilar(equipment.getItemInMainHand()) || item.isSimilar(equipment.getItemInOffHand())) {
dontMultiply.add(item); dontMultiply.add(item);
} }
} }
} }
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_16)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_16)) {
if (livingEntity instanceof Steerable) { if (livingEntity instanceof Steerable) {
Steerable steerable = (Steerable) livingEntity; Steerable steerable = (Steerable) livingEntity;
if (steerable.hasSaddle()) { if (steerable.hasSaddle()) {
@ -606,12 +607,18 @@ public class EntityListeners implements Listener {
} }
} }
for (ItemStack is : event.getDrops()) { // Only drop items that are not in the dontMultiply set
for (ItemStack is2 : dontMultiply) { for (ItemStack item : event.getDrops()) {
if (!is2.isSimilar(is)) { boolean shouldDrop = true;
livingEntity.getWorld().dropItemNaturally(livingEntity.getLocation(), is); for (ItemStack dontMultiplyItem : dontMultiply) {
if (item.isSimilar(dontMultiplyItem)) {
shouldDrop = false;
break;
} }
} }
if (shouldDrop) {
livingEntity.getWorld().dropItemNaturally(livingEntity.getLocation(), item);
}
} }
} }
} }
@ -701,7 +708,7 @@ public class EntityListeners implements Listener {
return; return;
} }
Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, () -> { Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, () -> {
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)) { // getPassengers() was added in 1.11 if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_11)) { // getPassengers() was added in 1.11
for (org.bukkit.entity.Entity passenger : entity.getPassengers()) { for (org.bukkit.entity.Entity passenger : entity.getPassengers()) {
passenger.remove(); passenger.remove();
} }

View File

@ -1,6 +1,7 @@
package com.craftaro.skyblock.listeners; package com.craftaro.skyblock.listeners;
import com.craftaro.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
@ -46,7 +47,7 @@ public class FallBreakListeners implements Listener {
if (island != null) { if (island != null) {
Optional<XMaterial> material = Optional.empty(); Optional<XMaterial> material = Optional.empty();
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) {
material = CompatibleMaterial.getMaterial(ent.getBlockData().getMaterial()); material = CompatibleMaterial.getMaterial(ent.getBlockData().getMaterial());
} else { } else {
try { try {

View File

@ -1,6 +1,7 @@
package com.craftaro.skyblock.listeners; package com.craftaro.skyblock.listeners;
import com.craftaro.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
@ -105,7 +106,7 @@ public class GrowListeners implements Listener {
return; return;
} }
if (ServerVersion.isServerVersionAbove(ServerVersion.V1_12)) { if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_12)) {
try { try {
Object blockData = block.getClass().getMethod("getBlockData").invoke(block); Object blockData = block.getClass().getMethod("getBlockData").invoke(block);
if (blockData instanceof org.bukkit.block.data.Ageable) { if (blockData instanceof org.bukkit.block.data.Ageable) {

View File

@ -170,13 +170,13 @@ public class InteractListeners implements Listener {
return; return;
} }
Optional<XMaterial> material = block == null ? Optional.empty() : CompatibleMaterial.getMaterial(block.getType());
// Check permissions. // Check permissions.
if (!this.plugin.getPermissionManager().processPermission(event, player, island)) { if (!this.plugin.getPermissionManager().processPermission(event, player, island)) {
return; return;
} }
Optional<XMaterial> material = block == null ? Optional.empty() : CompatibleMaterial.getMaterial(block.getType());
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) { if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
final Optional<XMaterial> blockType = CompatibleMaterial.getMaterial(event.getClickedBlock().getType()); final Optional<XMaterial> blockType = CompatibleMaterial.getMaterial(event.getClickedBlock().getType());
final XMaterial heldType; final XMaterial heldType;

View File

@ -1,5 +1,6 @@
package com.craftaro.skyblock.listeners; package com.craftaro.skyblock.listeners;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound; import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
@ -124,7 +125,7 @@ public class MoveListeners implements Listener {
player.setLevel(0); player.setLevel(0);
player.setExp(0.0F); player.setExp(0.0F);
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_9)) {
player.setHealth(Objects.requireNonNull(player.getAttribute(Attribute.GENERIC_MAX_HEALTH)).getValue()); player.setHealth(Objects.requireNonNull(player.getAttribute(Attribute.GENERIC_MAX_HEALTH)).getValue());
} else { } else {
player.setHealth(player.getMaxHealth()); player.setHealth(player.getMaxHealth());

View File

@ -1,5 +1,6 @@
package com.craftaro.skyblock.listeners; package com.craftaro.skyblock.listeners;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.island.Island; import com.craftaro.skyblock.island.Island;
@ -41,7 +42,7 @@ public class SpawnerListeners implements Listener {
if (upgrades != null && !upgrades.isEmpty() && upgrades.get(0).isEnabled() if (upgrades != null && !upgrades.isEmpty() && upgrades.get(0).isEnabled()
&& island.isUpgrade(Upgrade.Type.SPAWNER)) { && island.isUpgrade(Upgrade.Type.SPAWNER)) {
if (ServerVersion.isServerVersionAbove(ServerVersion.V1_12)) { if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_12)) {
if (spawner.getDelay() == 20) { if (spawner.getDelay() == 20) {
spawner.setDelay(10); spawner.setDelay(10);
} }

View File

@ -4,6 +4,7 @@ import com.craftaro.skyblock.localization.type.Localization;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import java.util.EnumMap; import java.util.EnumMap;
import java.util.Locale;
import java.util.Map; import java.util.Map;
public class EnumLocalization<T extends Enum<T>> extends Localization<T> { public class EnumLocalization<T extends Enum<T>> extends Localization<T> {
@ -37,6 +38,6 @@ public class EnumLocalization<T extends Enum<T>> extends Localization<T> {
} }
protected T parseEnum(String input) { protected T parseEnum(String input) {
return Enum.valueOf(getType(), input.toUpperCase()); return Enum.valueOf(getType(), input.toUpperCase(Locale.US));
} }
} }

View File

@ -1,10 +1,9 @@
package com.craftaro.skyblock.menus; package com.craftaro.skyblock.menus;
import com.craftaro.core.gui.AnvilGui; import com.craftaro.core.gui.AnvilGui;
import com.craftaro.third_party.com.cryptomorin.xseries.SkullUtils; import com.craftaro.core.utils.SkullItemCreator;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound; import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.ItemUtils;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.island.Island; import com.craftaro.skyblock.island.Island;
import com.craftaro.skyblock.island.IslandManager; import com.craftaro.skyblock.island.IslandManager;
@ -27,6 +26,7 @@ import org.bukkit.inventory.meta.SkullMeta;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ExecutionException;
public class Bans { public class Bans {
private static Bans instance; private static Bans instance;
@ -165,23 +165,13 @@ public class Bans {
int playerMenuPage = playerData.getPage(MenuType.BANS), nextEndIndex = islandBans.size() - playerMenuPage * 36; int playerMenuPage = playerData.getPage(MenuType.BANS), nextEndIndex = islandBans.size() - playerMenuPage * 36;
if (playerMenuPage != 1) { if (playerMenuPage != 1) {
ItemStack Lhead = XMaterial.PLAYER_HEAD.parseItem(); ItemStack Lhead = SkullItemCreator.byTextureUrlHash("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23");
SkullMeta LskullMeta = (SkullMeta) Lhead.getItemMeta();
SkullUtils.setSkullBase64(LskullMeta,
"eyJ0aW1lc3RhbXAiOjE0OTU3NTE5MTYwNjksInByb2ZpbGVJZCI6ImE2OGYwYjY0OGQxNDQwMDBhOTVmNGI5YmExNGY4ZGY5IiwicHJvZmlsZU5hbWUiOiJNSEZfQXJyb3dMZWZ0Iiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8zZWJmOTA3NDk0YTkzNWU5NTViZmNhZGFiODFiZWFmYjkwZmI5YmU0OWM3MDI2YmE5N2Q3OThkNWYxYTIzIn19fQ==",
"ToR1w9ZV7zpzCiLBhoaJH3uixs5mAlMhNz42oaRRvrG4HRua5hC6oyyOPfn2HKdSseYA9b1be14fjNRQbSJRvXF3mlvt5/zct4sm+cPVmX8K5kbM2vfwHJgCnfjtPkzT8sqqg6YFdT35mAZGqb9/xY/wDSNSu/S3k2WgmHrJKirszaBZrZfnVnqITUOgM9TmixhcJn2obeqICv6tl7/Wyk/1W62wXlXGm9+WjS+8rRNB+vYxqKR3XmH2lhAiyVGbADsjjGtBVUTWjq+aPw670SjXkoii0YE8sqzUlMMGEkXdXl9fvGtnWKk3APSseuTsjedr7yq+AkXFVDqqkqcUuXwmZl2EjC2WRRbhmYdbtY5nEfqh5+MiBrGdR/JqdEUL4yRutyRTw8mSUAI6X2oSVge7EdM/8f4HwLf33EO4pTocTqAkNbpt6Z54asLe5Y12jSXbvd2dFsgeJbrslK7e4uy/TK8CXf0BP3KLU20QELYrjz9I70gtj9lJ9xwjdx4/xJtxDtrxfC4Afmpu+GNYA/mifpyP3GDeBB5CqN7btIvEWyVvRNH7ppAqZIPqYJ7dSDd2RFuhAId5Yq98GUTBn+eRzeigBvSi1bFkkEgldfghOoK5WhsQtQbXuBBXITMME3NaWCN6zG7DxspS6ew/rZ8E809Xe0ArllquIZ0sP+k=");
Lhead.setItemMeta(LskullMeta);
nInv.addItem(nInv.createItem(Lhead, nInv.addItem(nInv.createItem(Lhead,
configLoad.getString("Menu.Bans.Item.Previous.Displayname"), null, null, null, null), 1); configLoad.getString("Menu.Bans.Item.Previous.Displayname"), null, null, null, null), 1);
} }
if (!(nextEndIndex == 0 || nextEndIndex < 0)) { if (!(nextEndIndex == 0 || nextEndIndex < 0)) {
ItemStack Rhead = XMaterial.PLAYER_HEAD.parseItem(); ItemStack Rhead = SkullItemCreator.byTextureUrlHash("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b");
SkullMeta RskullMeta = (SkullMeta) Rhead.getItemMeta();
SkullUtils.setSkullBase64(RskullMeta,
"eyJ0aW1lc3RhbXAiOjE0OTM4NjgxMDA2NzMsInByb2ZpbGVJZCI6IjUwYzg1MTBiNWVhMDRkNjBiZTlhN2Q1NDJkNmNkMTU2IiwicHJvZmlsZU5hbWUiOiJNSEZfQXJyb3dSaWdodCIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMWI2ZjFhMjViNmJjMTk5OTQ2NDcyYWVkYjM3MDUyMjU4NGZmNmY0ZTgzMjIxZTU5NDZiZDJlNDFiNWNhMTNiIn19fQ==",
"wZPrsmxckJn4/ybw/iXoMWgAe+1titw3hjhmf7bfg9vtOl0f/J6YLNMOI0OTvqeRKzSQVCxqNOij6k2iM32ZRInCQyblDIFmFadQxryEJDJJPVs7rXR6LRXlN8ON2VDGtboRTL7LwMGpzsrdPNt0oYDJLpR0huEeZKc1+g4W13Y4YM5FUgEs8HvMcg4aaGokSbvrYRRcEh3LR1lVmgxtbiUIr2gZkR3jnwdmZaIw/Ujw28+Et2pDMVCf96E5vC0aNY0KHTdMYheT6hwgw0VAZS2VnJg+Gz4JCl4eQmN2fs4dUBELIW2Rdnp4U1Eb+ZL8DvTV7ofBeZupknqPOyoKIjpInDml9BB2/EkD3zxFtW6AWocRphn03Z203navBkR6ztCMz0BgbmQU/m8VL/s8o4cxOn+2ppjrlj0p8AQxEsBdHozrBi8kNOGf1j97SDHxnvVAF3X8XDso+MthRx5pbEqpxmLyKKgFh25pJE7UaMSnzH2lc7aAZiax67MFw55pDtgfpl+Nlum4r7CK2w5Xob2QTCovVhu78/6SV7qM2Lhlwx/Sjqcl8rn5UIoyM49QE5Iyf1tk+xHXkIvY0m7q358oXsfca4eKmxMe6DFRjUDo1VuWxdg9iVjn22flqz1LD1FhGlPoqv0k4jX5Q733LwtPPI6VOTK+QzqrmiuR6e8=");
Rhead.setItemMeta(RskullMeta);
nInv.addItem(nInv.createItem(Rhead, nInv.addItem(nInv.createItem(Rhead,
configLoad.getString("Menu.Bans.Item.Next.Displayname"), null, null, null, null), 7); configLoad.getString("Menu.Bans.Item.Next.Displayname"), null, null, null, null), 7);
} }
@ -218,7 +208,18 @@ public class Bans {
targetPlayerTexture = new String[]{null, null}; targetPlayerTexture = new String[]{null, null};
} }
} }
ItemStack phead = SkullUtils.getSkull(targetPlayer.getUniqueId());
ItemStack phead;
if (targetPlayerTexture.length >= 1 && targetPlayerTexture[0] != null) {
phead = SkullItemCreator.byTextureValue(targetPlayerTexture[0]);
} else {
try {
phead = SkullItemCreator.byUuid(targetPlayerUUID).get();
} catch (InterruptedException | ExecutionException ex) {
throw new RuntimeException(ex);
}
}
nInv.addItem( nInv.addItem(
nInv.createItem(phead, nInv.createItem(phead,
plugin.formatText( plugin.formatText(

View File

@ -1,9 +1,8 @@
package com.craftaro.skyblock.menus; package com.craftaro.skyblock.menus;
import com.craftaro.third_party.com.cryptomorin.xseries.SkullUtils; import com.craftaro.core.utils.SkullItemCreator;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound; import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.ItemUtils;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.island.Island; import com.craftaro.skyblock.island.Island;
import com.craftaro.skyblock.island.IslandManager; import com.craftaro.skyblock.island.IslandManager;
@ -24,12 +23,12 @@ import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ExecutionException;
public class Information { public class Information {
private static Information instance; private static Information instance;
@ -343,24 +342,14 @@ public class Information {
nextEndIndex = displayedMembers.size() - playerMenuPage * 36; nextEndIndex = displayedMembers.size() - playerMenuPage * 36;
if (playerMenuPage != 1) { if (playerMenuPage != 1) {
ItemStack Lhead = XMaterial.PLAYER_HEAD.parseItem(); ItemStack Lhead = SkullItemCreator.byTextureUrlHash("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23");
SkullMeta LskullMeta = (SkullMeta) Lhead.getItemMeta();
SkullUtils.setSkullBase64(LskullMeta,
"eyJ0aW1lc3RhbXAiOjE0OTU3NTE5MTYwNjksInByb2ZpbGVJZCI6ImE2OGYwYjY0OGQxNDQwMDBhOTVmNGI5YmExNGY4ZGY5IiwicHJvZmlsZU5hbWUiOiJNSEZfQXJyb3dMZWZ0Iiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8zZWJmOTA3NDk0YTkzNWU5NTViZmNhZGFiODFiZWFmYjkwZmI5YmU0OWM3MDI2YmE5N2Q3OThkNWYxYTIzIn19fQ==",
"ToR1w9ZV7zpzCiLBhoaJH3uixs5mAlMhNz42oaRRvrG4HRua5hC6oyyOPfn2HKdSseYA9b1be14fjNRQbSJRvXF3mlvt5/zct4sm+cPVmX8K5kbM2vfwHJgCnfjtPkzT8sqqg6YFdT35mAZGqb9/xY/wDSNSu/S3k2WgmHrJKirszaBZrZfnVnqITUOgM9TmixhcJn2obeqICv6tl7/Wyk/1W62wXlXGm9+WjS+8rRNB+vYxqKR3XmH2lhAiyVGbADsjjGtBVUTWjq+aPw670SjXkoii0YE8sqzUlMMGEkXdXl9fvGtnWKk3APSseuTsjedr7yq+AkXFVDqqkqcUuXwmZl2EjC2WRRbhmYdbtY5nEfqh5+MiBrGdR/JqdEUL4yRutyRTw8mSUAI6X2oSVge7EdM/8f4HwLf33EO4pTocTqAkNbpt6Z54asLe5Y12jSXbvd2dFsgeJbrslK7e4uy/TK8CXf0BP3KLU20QELYrjz9I70gtj9lJ9xwjdx4/xJtxDtrxfC4Afmpu+GNYA/mifpyP3GDeBB5CqN7btIvEWyVvRNH7ppAqZIPqYJ7dSDd2RFuhAId5Yq98GUTBn+eRzeigBvSi1bFkkEgldfghOoK5WhsQtQbXuBBXITMME3NaWCN6zG7DxspS6ew/rZ8E809Xe0ArllquIZ0sP+k=");
Lhead.setItemMeta(LskullMeta);
nInv.addItem(nInv.createItem(Lhead, nInv.addItem(nInv.createItem(Lhead,
configLoad.getString("Menu.Information.Members.Item.Previous.Displayname"), null, null, configLoad.getString("Menu.Information.Members.Item.Previous.Displayname"), null, null,
null, null), 1); null, null), 1);
} }
if (!(nextEndIndex == 0 || nextEndIndex < 0)) { if (!(nextEndIndex == 0 || nextEndIndex < 0)) {
ItemStack Rhead = XMaterial.PLAYER_HEAD.parseItem(); ItemStack Rhead = SkullItemCreator.byTextureUrlHash("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b");
SkullMeta RskullMeta = (SkullMeta) Rhead.getItemMeta();
SkullUtils.setSkullBase64(RskullMeta,
"eyJ0aW1lc3RhbXAiOjE0OTM4NjgxMDA2NzMsInByb2ZpbGVJZCI6IjUwYzg1MTBiNWVhMDRkNjBiZTlhN2Q1NDJkNmNkMTU2IiwicHJvZmlsZU5hbWUiOiJNSEZfQXJyb3dSaWdodCIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMWI2ZjFhMjViNmJjMTk5OTQ2NDcyYWVkYjM3MDUyMjU4NGZmNmY0ZTgzMjIxZTU5NDZiZDJlNDFiNWNhMTNiIn19fQ==",
"wZPrsmxckJn4/ybw/iXoMWgAe+1titw3hjhmf7bfg9vtOl0f/J6YLNMOI0OTvqeRKzSQVCxqNOij6k2iM32ZRInCQyblDIFmFadQxryEJDJJPVs7rXR6LRXlN8ON2VDGtboRTL7LwMGpzsrdPNt0oYDJLpR0huEeZKc1+g4W13Y4YM5FUgEs8HvMcg4aaGokSbvrYRRcEh3LR1lVmgxtbiUIr2gZkR3jnwdmZaIw/Ujw28+Et2pDMVCf96E5vC0aNY0KHTdMYheT6hwgw0VAZS2VnJg+Gz4JCl4eQmN2fs4dUBELIW2Rdnp4U1Eb+ZL8DvTV7ofBeZupknqPOyoKIjpInDml9BB2/EkD3zxFtW6AWocRphn03Z203navBkR6ztCMz0BgbmQU/m8VL/s8o4cxOn+2ppjrlj0p8AQxEsBdHozrBi8kNOGf1j97SDHxnvVAF3X8XDso+MthRx5pbEqpxmLyKKgFh25pJE7UaMSnzH2lc7aAZiax67MFw55pDtgfpl+Nlum4r7CK2w5Xob2QTCovVhu78/6SV7qM2Lhlwx/Sjqcl8rn5UIoyM49QE5Iyf1tk+xHXkIvY0m7q358oXsfca4eKmxMe6DFRjUDo1VuWxdg9iVjn22flqz1LD1FhGlPoqv0k4jX5Q733LwtPPI6VOTK+QzqrmiuR6e8=");
Rhead.setItemMeta(RskullMeta);
nInv.addItem(nInv.createItem(Rhead, nInv.addItem(nInv.createItem(Rhead,
configLoad.getString("Menu.Information.Members.Item.Next.Displayname"), null, null, configLoad.getString("Menu.Information.Members.Item.Next.Displayname"), null, null,
null, null), 7); null, null), 7);
@ -398,7 +387,18 @@ public class Information {
} else { } else {
islandRole = configLoad.getString("Menu.Information.Members.Item.Member.Word.Owner"); islandRole = configLoad.getString("Menu.Information.Members.Item.Member.Word.Owner");
} }
ItemStack phead = SkullUtils.getSkull(targetPlayer.getUniqueId());
ItemStack phead;
if (playerTexture.length >= 1 && playerTexture[0] != null) {
phead = SkullItemCreator.byTextureValue(playerTexture[0]);
} else {
try {
phead = SkullItemCreator.byUuid(playerUUID).get();
} catch (InterruptedException | ExecutionException ex) {
throw new RuntimeException(ex);
}
}
nInv.addItem( nInv.addItem(
nInv.createItem(phead, nInv.createItem(phead,
configLoad.getString("Menu.Information.Members.Item.Member.Displayname") configLoad.getString("Menu.Information.Members.Item.Member.Displayname")
@ -494,24 +494,14 @@ public class Information {
nextEndIndex = displayedVisitors.size() - playerMenuPage * 36; nextEndIndex = displayedVisitors.size() - playerMenuPage * 36;
if (playerMenuPage != 1) { if (playerMenuPage != 1) {
ItemStack Lhead = XMaterial.PLAYER_HEAD.parseItem(); ItemStack Lhead = SkullItemCreator.byTextureUrlHash("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23");
SkullMeta LskullMeta = (SkullMeta) Lhead.getItemMeta();
SkullUtils.setSkullBase64(LskullMeta,
"eyJ0aW1lc3RhbXAiOjE0OTU3NTE5MTYwNjksInByb2ZpbGVJZCI6ImE2OGYwYjY0OGQxNDQwMDBhOTVmNGI5YmExNGY4ZGY5IiwicHJvZmlsZU5hbWUiOiJNSEZfQXJyb3dMZWZ0Iiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8zZWJmOTA3NDk0YTkzNWU5NTViZmNhZGFiODFiZWFmYjkwZmI5YmU0OWM3MDI2YmE5N2Q3OThkNWYxYTIzIn19fQ==",
"ToR1w9ZV7zpzCiLBhoaJH3uixs5mAlMhNz42oaRRvrG4HRua5hC6oyyOPfn2HKdSseYA9b1be14fjNRQbSJRvXF3mlvt5/zct4sm+cPVmX8K5kbM2vfwHJgCnfjtPkzT8sqqg6YFdT35mAZGqb9/xY/wDSNSu/S3k2WgmHrJKirszaBZrZfnVnqITUOgM9TmixhcJn2obeqICv6tl7/Wyk/1W62wXlXGm9+WjS+8rRNB+vYxqKR3XmH2lhAiyVGbADsjjGtBVUTWjq+aPw670SjXkoii0YE8sqzUlMMGEkXdXl9fvGtnWKk3APSseuTsjedr7yq+AkXFVDqqkqcUuXwmZl2EjC2WRRbhmYdbtY5nEfqh5+MiBrGdR/JqdEUL4yRutyRTw8mSUAI6X2oSVge7EdM/8f4HwLf33EO4pTocTqAkNbpt6Z54asLe5Y12jSXbvd2dFsgeJbrslK7e4uy/TK8CXf0BP3KLU20QELYrjz9I70gtj9lJ9xwjdx4/xJtxDtrxfC4Afmpu+GNYA/mifpyP3GDeBB5CqN7btIvEWyVvRNH7ppAqZIPqYJ7dSDd2RFuhAId5Yq98GUTBn+eRzeigBvSi1bFkkEgldfghOoK5WhsQtQbXuBBXITMME3NaWCN6zG7DxspS6ew/rZ8E809Xe0ArllquIZ0sP+k=");
Lhead.setItemMeta(LskullMeta);
nInv.addItem(nInv.createItem(Lhead, nInv.addItem(nInv.createItem(Lhead,
configLoad.getString("Menu.Information.Visitors.Item.Previous.Displayname"), null, null, configLoad.getString("Menu.Information.Visitors.Item.Previous.Displayname"), null, null,
null, null), 1); null, null), 1);
} }
if (!(nextEndIndex == 0 || nextEndIndex < 0)) { if (!(nextEndIndex == 0 || nextEndIndex < 0)) {
ItemStack Rhead = XMaterial.PLAYER_HEAD.parseItem(); ItemStack Rhead = SkullItemCreator.byTextureUrlHash("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b");
SkullMeta RskullMeta = (SkullMeta) Rhead.getItemMeta();
SkullUtils.setSkullBase64(RskullMeta,
"eyJ0aW1lc3RhbXAiOjE0OTM4NjgxMDA2NzMsInByb2ZpbGVJZCI6IjUwYzg1MTBiNWVhMDRkNjBiZTlhN2Q1NDJkNmNkMTU2IiwicHJvZmlsZU5hbWUiOiJNSEZfQXJyb3dSaWdodCIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMWI2ZjFhMjViNmJjMTk5OTQ2NDcyYWVkYjM3MDUyMjU4NGZmNmY0ZTgzMjIxZTU5NDZiZDJlNDFiNWNhMTNiIn19fQ==",
"wZPrsmxckJn4/ybw/iXoMWgAe+1titw3hjhmf7bfg9vtOl0f/J6YLNMOI0OTvqeRKzSQVCxqNOij6k2iM32ZRInCQyblDIFmFadQxryEJDJJPVs7rXR6LRXlN8ON2VDGtboRTL7LwMGpzsrdPNt0oYDJLpR0huEeZKc1+g4W13Y4YM5FUgEs8HvMcg4aaGokSbvrYRRcEh3LR1lVmgxtbiUIr2gZkR3jnwdmZaIw/Ujw28+Et2pDMVCf96E5vC0aNY0KHTdMYheT6hwgw0VAZS2VnJg+Gz4JCl4eQmN2fs4dUBELIW2Rdnp4U1Eb+ZL8DvTV7ofBeZupknqPOyoKIjpInDml9BB2/EkD3zxFtW6AWocRphn03Z203navBkR6ztCMz0BgbmQU/m8VL/s8o4cxOn+2ppjrlj0p8AQxEsBdHozrBi8kNOGf1j97SDHxnvVAF3X8XDso+MthRx5pbEqpxmLyKKgFh25pJE7UaMSnzH2lc7aAZiax67MFw55pDtgfpl+Nlum4r7CK2w5Xob2QTCovVhu78/6SV7qM2Lhlwx/Sjqcl8rn5UIoyM49QE5Iyf1tk+xHXkIvY0m7q358oXsfca4eKmxMe6DFRjUDo1VuWxdg9iVjn22flqz1LD1FhGlPoqv0k4jX5Q733LwtPPI6VOTK+QzqrmiuR6e8=");
Rhead.setItemMeta(RskullMeta);
nInv.addItem(nInv.createItem(Rhead, nInv.addItem(nInv.createItem(Rhead,
configLoad.getString("Menu.Information.Visitors.Item.Next.Displayname"), null, null, configLoad.getString("Menu.Information.Visitors.Item.Next.Displayname"), null, null,
null, null), 7); null, null), 7);
@ -541,7 +531,19 @@ public class Information {
playerData = plugin.getPlayerDataManager().getPlayerData(targetPlayer.getUniqueId()); playerData = plugin.getPlayerDataManager().getPlayerData(targetPlayer.getUniqueId());
playerTexture = playerData.getTexture(); playerTexture = playerData.getTexture();
} }
ItemStack phead = SkullUtils.getSkull(targetPlayer.getUniqueId());
ItemStack phead;
if (playerTexture.length >= 1 && playerTexture[0] != null) {
phead = SkullItemCreator.byTextureValue(playerTexture[0]);
} else {
try {
phead = SkullItemCreator.byUuid(playerUUID).get();
} catch (InterruptedException | ExecutionException ex) {
throw new RuntimeException(ex);
}
}
nInv.addItem( nInv.addItem(
nInv.createItem(phead, nInv.createItem(phead,
configLoad.getString("Menu.Information.Visitors.Item.Visitor.Displayname") configLoad.getString("Menu.Information.Visitors.Item.Visitor.Displayname")

View File

@ -1,6 +1,7 @@
package com.craftaro.skyblock.menus; package com.craftaro.skyblock.menus;
import com.craftaro.core.utils.NumberUtils; import com.craftaro.core.utils.NumberUtils;
import com.craftaro.core.utils.SkullItemCreator;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.placeholder.Placeholder; import com.craftaro.skyblock.placeholder.Placeholder;
import com.craftaro.skyblock.playerdata.PlayerDataManager; import com.craftaro.skyblock.playerdata.PlayerDataManager;
@ -8,7 +9,6 @@ import com.craftaro.skyblock.sound.SoundManager;
import com.craftaro.skyblock.utils.item.nInventoryUtil; import com.craftaro.skyblock.utils.item.nInventoryUtil;
import com.craftaro.skyblock.utils.player.OfflinePlayer; import com.craftaro.skyblock.utils.player.OfflinePlayer;
import com.craftaro.skyblock.visit.Visit; import com.craftaro.skyblock.visit.Visit;
import com.craftaro.third_party.com.cryptomorin.xseries.SkullUtils;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound; import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -18,27 +18,14 @@ import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutionException;
public class Leaderboard { public class Leaderboard {
private static Leaderboard instance; private static Leaderboard instance;
private static final String[] steveSkinTexture = new String[]{
"otpbxDm9B+opW7jEzZF8BVDeZSqaqdF0dyLlnlyMh7Q5ysJFDL48/9J/IOHp8JqNm1oarmVdvxrroy9dlNI2Mz4BVuJM2pcCOJwk2h+aZ4dzNZGxst+MYNPSw+i4sMoYu7OV07UVHrQffolFF7MiaBUst1hFwM07IpTE6UtIQz4rqWisXe9Iz5+ooqX4wj0IB3dPntsh6u5nVlL8acWCBDAW4YqcPt2Y4CKK+KtskjzusjqGAdEO+4lRcW1S0ldo2RNtUHEzZADWQcADjg9KKiKq9QIpIpYURIoIAA+pDGb5Q8L5O6CGI+i1+FxqXbgdBvcm1EG0OPdw9WpSqAxGGeXSwlzjILvlvBzYbd6gnHFBhFO+X7iwRJYNd+qQakjUa6ZwR8NbkpbN3ABb9+6YqVkabaEmgfky3HdORE+bTp/AT6LHqEMQo0xdNkvF9gtFci7RWhFwuTLDvQ1esby1IhlgT+X32CPuVHuxEvPCjN7+lmRz2OyOZ4REo2tAIFUKakqu3nZ0NcF98b87wAdA9B9Qyd2H/rEtUToQhpBjP732Sov6TlJkb8echGYiLL5bu/Q7hum72y4+j2GNnuRiOJtJidPgDqrYMg81GfenfPyS6Ynw6KhdEhnwmJ1FJlJhYvXZyqZwLAV1c26DNYkrTMcFcv3VXmcd5/2Zn9FnZtw=",
"ewogICJ0aW1lc3RhbXAiIDogMTYyMTcxNTMxMjI5MCwKICAicHJvZmlsZUlkIiA6ICJiNTM5NTkyMjMwY2I0MmE0OWY5YTRlYmYxNmRlOTYwYiIsCiAgInByb2ZpbGVOYW1lIiA6ICJtYXJpYW5hZmFnIiwKICAic2lnbmF0dXJlUmVxdWlyZWQiIDogdHJ1ZSwKICAidGV4dHVyZXMiIDogewogICAgIlNLSU4iIDogewogICAgICAidXJsIiA6ICJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzFhNGFmNzE4NDU1ZDRhYWI1MjhlN2E2MWY4NmZhMjVlNmEzNjlkMTc2OGRjYjEzZjdkZjMxOWE3MTNlYjgxMGIiCiAgICB9CiAgfQp9"
};
private static final String[] alexSkinTexture = new String[]{
"rZvLQoZsgLYaoKqEuASopYAs7IAlZlsGkwagoM8ZX38cP9kalseZrWY5OHZVfoiftdQJ+lGOzkiFfyx6kNJDTZniLrnRa8sd3X6D65ZihT1sOm/RInCwxpS1K0zGCM2h9ErkWswfwaviIf7hJtrwk8/zL0bfzDk2IgX/IBvIZpVoYTfmQsVY9jgSwORrS9ObePGIfFgmThMoZnCYWQMVpS2+yTFA2wnw9hmisQK9UWBU+iBZv55bMmkMcyEuXw1w14DaEu+/M0UGD91LU4GmJLPA9T4GCuIV8GxOcraSVIajki1cMlOBQwIaibB2NE6KAwq1Zh6NnsNYucy6qFM+136lXfBchQ1Nx4FDRZQgt8VRqTMy/OQFpr2nTbWWbRU4gRFpKC3R0518DqUH0Qm612kPWniKku/QzUUBSe1PSVljBaZCyyRx0OB1a1/8MexboKRnPXuTDnmPa9UPfuH4VO0q+qYkjV2KUzP6e5vIP5aQ6USPrMie7MmAHFJzwAMIbLjgkTVx91GWtYqg/t7qBlvrdBRLIPPsy/DSOqa+2+4hABouVCPZrBMCMLzstPPQoqZAyiCqcKb2HqWSU0h9Bhx19yoIcbHCeI3zsQs8PqIBjUL4mO6VQT4lzHy0e3M61Xsdd8S1GtsakSetTvEtMdUwCEDfBA5PRRTLOVYTY+g=",
"ewogICJ0aW1lc3RhbXAiIDogMTYyMTcxNTQ5ODM0MywKICAicHJvZmlsZUlkIiA6ICIxYTc1ZTNiYmI1NTk0MTc2OTVjMmY4NTY1YzNlMDAzZCIsCiAgInByb2ZpbGVOYW1lIiA6ICJUZXJvZmFyIiwKICAic2lnbmF0dXJlUmVxdWlyZWQiIDogdHJ1ZSwKICAidGV4dHVyZXMiIDogewogICAgIlNLSU4iIDogewogICAgICAidXJsIiA6ICJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzNiNjBhMWY2ZDU2MmY1MmFhZWJiZjE0MzRmMWRlMTQ3OTMzYTNhZmZlMGU3NjRmYTQ5ZWEwNTc1MzY2MjNjZDMiLAogICAgICAibWV0YWRhdGEiIDogewogICAgICAgICJtb2RlbCIgOiAic2xpbSIKICAgICAgfQogICAgfQogIH0KfQ=="
};
private static final String[] questionMarkSkinTexture = new String[]{
"gi+wnQt/y4Z6E9rn65iDWmt8vUOM2WXY66XvtydqDJZTzwgFrjVcx2c5YwdzvtOIRtiX2nZt4n2uWesUFKb59xS24YWbxCDXnalHhCpPFcIP58SQbCm9AYp3UPzkcRNWzuV4BddrS608QQZGyIFOUaLPOPasGITZu51VLcOKcTyFOCKu1QE2yRo1orTH8bWfdpE769BB/VYGdny0qJtm1amc12wGiVifMJRutZmYo2ZdA0APhIJVaNsPppNESVcbeBCvk60l4QK43C/p98/QEe5U6UJ6Z6N01pBQcswubMu8lCuPLasep+vX3v2K+Ui9jnTQNreGNIZPWVjf6V1GH4xMbbUVQJsoPdcaXG855VdzyoW+kyHdWYEojSn0qAY/moH6JCLnx6PLCv9mITSvOIUHq8ITet0M7Z9KALY5s6eg6VdA8TvClRy2TTm9tIRt//TJo5JxBoTYujawGNSR7ryODj2UEDQ2xOyWSagxAXZpispdrO5jHxRmBZUwX9vxnAp+CNWxifpu9sINJTlqYsT/KlGOJQC483gv5B6Nm5VBB1DRFmQkohzO6Wc2eDixgEbaU795GlLxrNaFfNjVH6Bwr1e7df2H3nE0P0bexs4wYdWplijn4gPyHwjT2LDBPGFQK3Vo2SlaXfPYbkIHX21c9qaz3eWHpLEXUBQfnWc=",
"eyJ0aW1lc3RhbXAiOjE1MzE3MTcxNjY3MDAsInByb2ZpbGVJZCI6IjYwNmUyZmYwZWQ3NzQ4NDI5ZDZjZTFkMzMyMWM3ODM4IiwicHJvZmlsZU5hbWUiOiJNSEZfUXVlc3Rpb24iLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2QzNGUwNjNjYWZiNDY3YTVjOGRlNDNlYzc4NjE5Mzk5ZjM2OWY0YTUyNDM0ZGE4MDE3YTk4M2NkZDkyNTE2YTAifX19"
};
public static Leaderboard getInstance() { public static Leaderboard getInstance() {
if (instance == null) { if (instance == null) {
instance = new Leaderboard(); instance = new Leaderboard();
@ -301,15 +288,18 @@ public class Leaderboard {
} }
} }
if (playerTexture[0] == null || playerTexture[1] == null) {
if ((visit.getOwnerUUID().hashCode() & 1) != 0) { ItemStack phead;
playerTexture = alexSkinTexture; if (playerTexture.length >= 1 && playerTexture[0] != null) {
} else { phead = SkullItemCreator.byTextureValue(playerTexture[0]);
playerTexture = steveSkinTexture; } else {
try {
phead = SkullItemCreator.byUuid(visit.getOwnerUUID()).get();
} catch (InterruptedException | ExecutionException ex) {
throw new RuntimeException(ex);
} }
} }
ItemStack phead = SkullUtils.getSkull(targetPlayer.getUniqueId());
nInv.addItem( nInv.addItem(
nInv.createItem(phead, nInv.createItem(phead,
configLoad.getString("Menu.Leaderboard.Leaderboard.Item.Island.Displayname") configLoad.getString("Menu.Leaderboard.Leaderboard.Item.Island.Displayname")
@ -332,10 +322,7 @@ public class Leaderboard {
for (int i = 0; i < itemSlots.length; i++) { for (int i = 0; i < itemSlots.length; i++) {
if (!nInv.getItems().containsKey(itemSlots[i])) { if (!nInv.getItems().containsKey(itemSlots[i])) {
ItemStack qhead = XMaterial.PLAYER_HEAD.parseItem(); ItemStack qhead = SkullItemCreator.byTextureUrlHash("d34e063cafb467a5c8de43ec78619399f369f4a52434da8017a983cdd92516a0");
SkullMeta qskullMeta = (SkullMeta) qhead.getItemMeta();
SkullUtils.setSkullBase64(qskullMeta,questionMarkSkinTexture[1],questionMarkSkinTexture[0]);
qhead.setItemMeta(qskullMeta);
nInv.addItem(nInv.createItem(qhead, nInv.addItem(nInv.createItem(qhead,
configLoad.getString("Menu.Leaderboard.Leaderboard.Item.Empty.Displayname") configLoad.getString("Menu.Leaderboard.Leaderboard.Item.Empty.Displayname")
.replace("%position", "" + (i + 1)), .replace("%position", "" + (i + 1)),

View File

@ -1,8 +1,9 @@
package com.craftaro.skyblock.menus; package com.craftaro.skyblock.menus;
import com.craftaro.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.third_party.com.cryptomorin.xseries.SkullUtils; import com.craftaro.core.utils.SkullItemCreator;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound; import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.ItemUtils; import com.craftaro.core.utils.ItemUtils;
@ -32,7 +33,6 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
@ -190,6 +190,7 @@ public class Levelling {
long value = testIslandMaterials.get(materialName); long value = testIslandMaterials.get(materialName);
Optional<XMaterial> materials = CompatibleMaterial.getMaterial(materialName); Optional<XMaterial> materials = CompatibleMaterial.getMaterial(materialName);
if (!materials.isPresent()) { if (!materials.isPresent()) {
continue; continue;
} }
@ -225,23 +226,13 @@ public class Levelling {
nInv.addItem(nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(), configLoad.getString("Menu.Levelling.Item.Barrier.Displayname"), null, null, null, null), 9, 10, 11, 12, 13, 14, 15, 16, 17); nInv.addItem(nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(), configLoad.getString("Menu.Levelling.Item.Barrier.Displayname"), null, null, null, null), 9, 10, 11, 12, 13, 14, 15, 16, 17);
if (playerMenuPage != 1) { if (playerMenuPage != 1) {
ItemStack Lhead = XMaterial.PLAYER_HEAD.parseItem(); ItemStack Lhead = SkullItemCreator.byTextureUrlHash("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23");
SkullMeta LskullMeta = (SkullMeta) Lhead.getItemMeta();
SkullUtils.setSkullBase64(LskullMeta,
"eyJ0aW1lc3RhbXAiOjE0OTU3NTE5MTYwNjksInByb2ZpbGVJZCI6ImE2OGYwYjY0OGQxNDQwMDBhOTVmNGI5YmExNGY4ZGY5IiwicHJvZmlsZU5hbWUiOiJNSEZfQXJyb3dMZWZ0Iiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8zZWJmOTA3NDk0YTkzNWU5NTViZmNhZGFiODFiZWFmYjkwZmI5YmU0OWM3MDI2YmE5N2Q3OThkNWYxYTIzIn19fQ==",
"ToR1w9ZV7zpzCiLBhoaJH3uixs5mAlMhNz42oaRRvrG4HRua5hC6oyyOPfn2HKdSseYA9b1be14fjNRQbSJRvXF3mlvt5/zct4sm+cPVmX8K5kbM2vfwHJgCnfjtPkzT8sqqg6YFdT35mAZGqb9/xY/wDSNSu/S3k2WgmHrJKirszaBZrZfnVnqITUOgM9TmixhcJn2obeqICv6tl7/Wyk/1W62wXlXGm9+WjS+8rRNB+vYxqKR3XmH2lhAiyVGbADsjjGtBVUTWjq+aPw670SjXkoii0YE8sqzUlMMGEkXdXl9fvGtnWKk3APSseuTsjedr7yq+AkXFVDqqkqcUuXwmZl2EjC2WRRbhmYdbtY5nEfqh5+MiBrGdR/JqdEUL4yRutyRTw8mSUAI6X2oSVge7EdM/8f4HwLf33EO4pTocTqAkNbpt6Z54asLe5Y12jSXbvd2dFsgeJbrslK7e4uy/TK8CXf0BP3KLU20QELYrjz9I70gtj9lJ9xwjdx4/xJtxDtrxfC4Afmpu+GNYA/mifpyP3GDeBB5CqN7btIvEWyVvRNH7ppAqZIPqYJ7dSDd2RFuhAId5Yq98GUTBn+eRzeigBvSi1bFkkEgldfghOoK5WhsQtQbXuBBXITMME3NaWCN6zG7DxspS6ew/rZ8E809Xe0ArllquIZ0sP+k=");
Lhead.setItemMeta(LskullMeta);
nInv.addItem(nInv.createItem(Lhead, nInv.addItem(nInv.createItem(Lhead,
configLoad.getString("Menu.Levelling.Item.Previous.Displayname"), null, null, null, null), 1); configLoad.getString("Menu.Levelling.Item.Previous.Displayname"), null, null, null, null), 1);
} }
if (!(nextEndIndex == 0 || nextEndIndex < 0)) { if (!(nextEndIndex == 0 || nextEndIndex < 0)) {
ItemStack Rhead = XMaterial.PLAYER_HEAD.parseItem(); ItemStack Rhead = SkullItemCreator.byTextureUrlHash("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b");
SkullMeta RskullMeta = (SkullMeta) Rhead.getItemMeta();
SkullUtils.setSkullBase64(RskullMeta,
"eyJ0aW1lc3RhbXAiOjE0OTM4NjgxMDA2NzMsInByb2ZpbGVJZCI6IjUwYzg1MTBiNWVhMDRkNjBiZTlhN2Q1NDJkNmNkMTU2IiwicHJvZmlsZU5hbWUiOiJNSEZfQXJyb3dSaWdodCIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMWI2ZjFhMjViNmJjMTk5OTQ2NDcyYWVkYjM3MDUyMjU4NGZmNmY0ZTgzMjIxZTU5NDZiZDJlNDFiNWNhMTNiIn19fQ==",
"wZPrsmxckJn4/ybw/iXoMWgAe+1titw3hjhmf7bfg9vtOl0f/J6YLNMOI0OTvqeRKzSQVCxqNOij6k2iM32ZRInCQyblDIFmFadQxryEJDJJPVs7rXR6LRXlN8ON2VDGtboRTL7LwMGpzsrdPNt0oYDJLpR0huEeZKc1+g4W13Y4YM5FUgEs8HvMcg4aaGokSbvrYRRcEh3LR1lVmgxtbiUIr2gZkR3jnwdmZaIw/Ujw28+Et2pDMVCf96E5vC0aNY0KHTdMYheT6hwgw0VAZS2VnJg+Gz4JCl4eQmN2fs4dUBELIW2Rdnp4U1Eb+ZL8DvTV7ofBeZupknqPOyoKIjpInDml9BB2/EkD3zxFtW6AWocRphn03Z203navBkR6ztCMz0BgbmQU/m8VL/s8o4cxOn+2ppjrlj0p8AQxEsBdHozrBi8kNOGf1j97SDHxnvVAF3X8XDso+MthRx5pbEqpxmLyKKgFh25pJE7UaMSnzH2lc7aAZiax67MFw55pDtgfpl+Nlum4r7CK2w5Xob2QTCovVhu78/6SV7qM2Lhlwx/Sjqcl8rn5UIoyM49QE5Iyf1tk+xHXkIvY0m7q358oXsfca4eKmxMe6DFRjUDo1VuWxdg9iVjn22flqz1LD1FhGlPoqv0k4jX5Q733LwtPPI6VOTK+QzqrmiuR6e8=");
Rhead.setItemMeta(RskullMeta);
nInv.addItem(nInv.createItem(Rhead, nInv.addItem(nInv.createItem(Rhead,
configLoad.getString("Menu.Levelling.Item.Next.Displayname"), null, null, null, null), 7); configLoad.getString("Menu.Levelling.Item.Next.Displayname"), null, null, null, null), 7);
} }
@ -289,7 +280,7 @@ public class Levelling {
String name = plugin.getLocalizationManager().getLocalizationFor(XMaterial.class).getLocale(materials.get()); String name = plugin.getLocalizationManager().getLocalizationFor(XMaterial.class).getLocale(materials.get());
if (materials.get() == XMaterial.FARMLAND && ServerVersion.isServerVersionBelow(ServerVersion.V1_9)) { if (materials.get() == XMaterial.FARMLAND && MajorServerVersion.isServerVersionBelow(MajorServerVersion.V1_9)) {
materials = Optional.of(XMaterial.DIRT); materials = Optional.of(XMaterial.DIRT);
} }

View File

@ -1,9 +1,6 @@
package com.craftaro.skyblock.menus; package com.craftaro.skyblock.menus;
import com.craftaro.third_party.com.cryptomorin.xseries.SkullUtils; import com.craftaro.core.utils.SkullItemCreator;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.ItemUtils;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.config.FileManager; import com.craftaro.skyblock.config.FileManager;
import com.craftaro.skyblock.island.Island; import com.craftaro.skyblock.island.Island;
@ -18,6 +15,8 @@ import com.craftaro.skyblock.utils.NumberUtil;
import com.craftaro.skyblock.utils.StringUtil; import com.craftaro.skyblock.utils.StringUtil;
import com.craftaro.skyblock.utils.item.nInventoryUtil; import com.craftaro.skyblock.utils.item.nInventoryUtil;
import com.craftaro.skyblock.utils.player.OfflinePlayer; import com.craftaro.skyblock.utils.player.OfflinePlayer;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
@ -26,7 +25,6 @@ import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
import java.io.File; import java.io.File;
import java.text.ParseException; import java.text.ParseException;
@ -38,6 +36,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.TreeMap; import java.util.TreeMap;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ExecutionException;
public class Members { public class Members {
private static Members instance; private static Members instance;
@ -353,23 +352,13 @@ public class Members {
9, 10, 11, 12, 13, 14, 15, 16, 17); 9, 10, 11, 12, 13, 14, 15, 16, 17);
if (playerMenuPage != 1) { if (playerMenuPage != 1) {
ItemStack Lhead = XMaterial.PLAYER_HEAD.parseItem(); ItemStack Lhead = SkullItemCreator.byTextureUrlHash("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23");
SkullMeta LskullMeta = (SkullMeta) Lhead.getItemMeta();
SkullUtils.setSkullBase64(LskullMeta,
"eyJ0aW1lc3RhbXAiOjE0OTU3NTE5MTYwNjksInByb2ZpbGVJZCI6ImE2OGYwYjY0OGQxNDQwMDBhOTVmNGI5YmExNGY4ZGY5IiwicHJvZmlsZU5hbWUiOiJNSEZfQXJyb3dMZWZ0Iiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8zZWJmOTA3NDk0YTkzNWU5NTViZmNhZGFiODFiZWFmYjkwZmI5YmU0OWM3MDI2YmE5N2Q3OThkNWYxYTIzIn19fQ==",
"ToR1w9ZV7zpzCiLBhoaJH3uixs5mAlMhNz42oaRRvrG4HRua5hC6oyyOPfn2HKdSseYA9b1be14fjNRQbSJRvXF3mlvt5/zct4sm+cPVmX8K5kbM2vfwHJgCnfjtPkzT8sqqg6YFdT35mAZGqb9/xY/wDSNSu/S3k2WgmHrJKirszaBZrZfnVnqITUOgM9TmixhcJn2obeqICv6tl7/Wyk/1W62wXlXGm9+WjS+8rRNB+vYxqKR3XmH2lhAiyVGbADsjjGtBVUTWjq+aPw670SjXkoii0YE8sqzUlMMGEkXdXl9fvGtnWKk3APSseuTsjedr7yq+AkXFVDqqkqcUuXwmZl2EjC2WRRbhmYdbtY5nEfqh5+MiBrGdR/JqdEUL4yRutyRTw8mSUAI6X2oSVge7EdM/8f4HwLf33EO4pTocTqAkNbpt6Z54asLe5Y12jSXbvd2dFsgeJbrslK7e4uy/TK8CXf0BP3KLU20QELYrjz9I70gtj9lJ9xwjdx4/xJtxDtrxfC4Afmpu+GNYA/mifpyP3GDeBB5CqN7btIvEWyVvRNH7ppAqZIPqYJ7dSDd2RFuhAId5Yq98GUTBn+eRzeigBvSi1bFkkEgldfghOoK5WhsQtQbXuBBXITMME3NaWCN6zG7DxspS6ew/rZ8E809Xe0ArllquIZ0sP+k=");
Lhead.setItemMeta(LskullMeta);
nInv.addItem(nInv.createItem(Lhead, nInv.addItem(nInv.createItem(Lhead,
configLoad.getString("Menu.Members.Item.Previous.Displayname"), null, null, null, null), 1); configLoad.getString("Menu.Members.Item.Previous.Displayname"), null, null, null, null), 1);
} }
if (!(nextEndIndex == 0 || nextEndIndex < 0)) { if (!(nextEndIndex == 0 || nextEndIndex < 0)) {
ItemStack Rhead = XMaterial.PLAYER_HEAD.parseItem(); ItemStack Rhead = SkullItemCreator.byTextureUrlHash("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b");
SkullMeta RskullMeta = (SkullMeta) Rhead.getItemMeta();
SkullUtils.setSkullBase64(RskullMeta,
"eyJ0aW1lc3RhbXAiOjE0OTM4NjgxMDA2NzMsInByb2ZpbGVJZCI6IjUwYzg1MTBiNWVhMDRkNjBiZTlhN2Q1NDJkNmNkMTU2IiwicHJvZmlsZU5hbWUiOiJNSEZfQXJyb3dSaWdodCIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMWI2ZjFhMjViNmJjMTk5OTQ2NDcyYWVkYjM3MDUyMjU4NGZmNmY0ZTgzMjIxZTU5NDZiZDJlNDFiNWNhMTNiIn19fQ==",
"wZPrsmxckJn4/ybw/iXoMWgAe+1titw3hjhmf7bfg9vtOl0f/J6YLNMOI0OTvqeRKzSQVCxqNOij6k2iM32ZRInCQyblDIFmFadQxryEJDJJPVs7rXR6LRXlN8ON2VDGtboRTL7LwMGpzsrdPNt0oYDJLpR0huEeZKc1+g4W13Y4YM5FUgEs8HvMcg4aaGokSbvrYRRcEh3LR1lVmgxtbiUIr2gZkR3jnwdmZaIw/Ujw28+Et2pDMVCf96E5vC0aNY0KHTdMYheT6hwgw0VAZS2VnJg+Gz4JCl4eQmN2fs4dUBELIW2Rdnp4U1Eb+ZL8DvTV7ofBeZupknqPOyoKIjpInDml9BB2/EkD3zxFtW6AWocRphn03Z203navBkR6ztCMz0BgbmQU/m8VL/s8o4cxOn+2ppjrlj0p8AQxEsBdHozrBi8kNOGf1j97SDHxnvVAF3X8XDso+MthRx5pbEqpxmLyKKgFh25pJE7UaMSnzH2lc7aAZiax67MFw55pDtgfpl+Nlum4r7CK2w5Xob2QTCovVhu78/6SV7qM2Lhlwx/Sjqcl8rn5UIoyM49QE5Iyf1tk+xHXkIvY0m7q358oXsfca4eKmxMe6DFRjUDo1VuWxdg9iVjn22flqz1LD1FhGlPoqv0k4jX5Q733LwtPPI6VOTK+QzqrmiuR6e8=");
Rhead.setItemMeta(RskullMeta);
nInv.addItem(nInv.createItem(Rhead, nInv.addItem(nInv.createItem(Rhead,
configLoad.getString("Menu.Members.Item.Next.Displayname"), null, null, null, null), 7); configLoad.getString("Menu.Members.Item.Next.Displayname"), null, null, null, null), 7);
} }
@ -572,7 +561,12 @@ public class Members {
} }
} }
ItemStack phead = SkullUtils.getSkull(Bukkit.getPlayerUniqueId(playerName)); ItemStack phead;
try {
phead = SkullItemCreator.byUuid(playerUUID).get();
} catch (InterruptedException | ExecutionException ex) {
throw new RuntimeException(ex);
}
nInv.addItem( nInv.addItem(
nInv.createItem(phead, nInv.createItem(phead,
configLoad.getString("Menu.Members.Item.Member.Displayname").replace("%player", configLoad.getString("Menu.Members.Item.Member.Displayname").replace("%player",

View File

@ -1,10 +1,9 @@
package com.craftaro.skyblock.menus; package com.craftaro.skyblock.menus;
import com.craftaro.core.gui.AnvilGui; import com.craftaro.core.gui.AnvilGui;
import com.craftaro.third_party.com.cryptomorin.xseries.SkullUtils; import com.craftaro.core.utils.SkullItemCreator;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound; import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.ItemUtils;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.island.Island; import com.craftaro.skyblock.island.Island;
import com.craftaro.skyblock.island.IslandManager; import com.craftaro.skyblock.island.IslandManager;
@ -27,6 +26,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ExecutionException;
public class Ownership { public class Ownership {
private static Ownership instance; private static Ownership instance;
@ -215,7 +215,7 @@ public class Ownership {
String originalOwnerName, ownershipPassword = island.getPassword(); String originalOwnerName, ownershipPassword = island.getPassword();
String[] playerTexture; String[] playerTexture;
org.bukkit.OfflinePlayer targetPlayer = Bukkit.getServer().getPlayer(island.getOriginalOwnerUUID()); org.bukkit.OfflinePlayer targetPlayer = Bukkit.getServer().getPlayer(originalOwnerUUID);
if (targetPlayer == null) { if (targetPlayer == null) {
OfflinePlayer offlinePlayer = new OfflinePlayer(originalOwnerUUID); OfflinePlayer offlinePlayer = new OfflinePlayer(originalOwnerUUID);
@ -225,7 +225,19 @@ public class Ownership {
originalOwnerName = targetPlayer.getName(); originalOwnerName = targetPlayer.getName();
playerTexture = playerDataManager.getPlayerData(targetPlayer.getUniqueId()).getTexture(); playerTexture = playerDataManager.getPlayerData(targetPlayer.getUniqueId()).getTexture();
} }
ItemStack phead = SkullUtils.getSkull(targetPlayer.getUniqueId());
ItemStack phead;
if (playerTexture.length >= 1 && playerTexture[0] != null) {
phead = SkullItemCreator.byTextureValue(playerTexture[0]);
} else {
try {
phead = SkullItemCreator.byUuid(originalOwnerUUID).get();
} catch (InterruptedException | ExecutionException ex) {
throw new RuntimeException(ex);
}
}
nInv.addItem(nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(), nInv.addItem(nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(),
configLoad.getString("Menu.Ownership.Item.Exit.Displayname"), null, null, null, null), 0); configLoad.getString("Menu.Ownership.Item.Exit.Displayname"), null, null, null, null), 0);
nInv.addItem(nInv.createItem(phead, nInv.addItem(nInv.createItem(phead,

View File

@ -1,5 +1,6 @@
package com.craftaro.skyblock.menus; package com.craftaro.skyblock.menus;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.hooks.economies.Economy; import com.craftaro.core.hooks.economies.Economy;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
@ -495,10 +496,10 @@ public class Upgrade {
if (upgrades != null && !upgrades.isEmpty() && upgrades.get(0).isEnabled()) { if (upgrades != null && !upgrades.isEmpty() && upgrades.get(0).isEnabled()) {
com.craftaro.skyblock.upgrade.Upgrade upgrade = upgrades.get(0); com.craftaro.skyblock.upgrade.Upgrade upgrade = upgrades.get(0);
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_9)) {
PotionMeta pm = (PotionMeta) potion.getItemMeta(); PotionMeta pm = (PotionMeta) potion.getItemMeta();
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_10)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_10)) {
pm.setBasePotionData(new PotionData(PotionType.SPEED)); pm.setBasePotionData(new PotionData(PotionType.SPEED));
} else { } else {
pm.addCustomEffect(new PotionEffect(PotionEffectType.SPEED, 1, 0), true); pm.addCustomEffect(new PotionEffect(PotionEffectType.SPEED, 1, 0), true);
@ -547,11 +548,11 @@ public class Upgrade {
if (upgrades != null && !upgrades.isEmpty() && upgrades.get(0).isEnabled()) { if (upgrades != null && !upgrades.isEmpty() && upgrades.get(0).isEnabled()) {
com.craftaro.skyblock.upgrade.Upgrade upgrade = upgrades.get(0); com.craftaro.skyblock.upgrade.Upgrade upgrade = upgrades.get(0);
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_8)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_8)) {
potion = new ItemStack(Material.POTION); potion = new ItemStack(Material.POTION);
PotionMeta pm = (PotionMeta) potion.getItemMeta(); PotionMeta pm = (PotionMeta) potion.getItemMeta();
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_9)) {
pm.setBasePotionData(new PotionData(PotionType.JUMP)); pm.setBasePotionData(new PotionData(PotionType.JUMP));
} else { } else {
pm.addCustomEffect(new PotionEffect(PotionEffectType.JUMP, 1, 0), true); pm.addCustomEffect(new PotionEffect(PotionEffectType.JUMP, 1, 0), true);

View File

@ -1,9 +1,8 @@
package com.craftaro.skyblock.menus; package com.craftaro.skyblock.menus;
import com.craftaro.third_party.com.cryptomorin.xseries.SkullUtils; import com.craftaro.core.utils.SkullItemCreator;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound; import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.ItemUtils;
import com.craftaro.core.utils.NumberUtils; import com.craftaro.core.utils.NumberUtils;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.api.event.player.PlayerVoteEvent; import com.craftaro.skyblock.api.event.player.PlayerVoteEvent;
@ -28,12 +27,12 @@ import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ExecutionException;
public class Visit { public class Visit {
private static Visit instance; private static Visit instance;
@ -355,23 +354,13 @@ public class Visit {
9, 10, 11, 12, 13, 14, 15, 16, 17); 9, 10, 11, 12, 13, 14, 15, 16, 17);
if (playerMenuPage != 1) { if (playerMenuPage != 1) {
ItemStack Lhead = XMaterial.PLAYER_HEAD.parseItem(); ItemStack Lhead = SkullItemCreator.byTextureUrlHash("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23");
SkullMeta LskullMeta = (SkullMeta) Lhead.getItemMeta();
SkullUtils.setSkullBase64(LskullMeta,
"eyJ0aW1lc3RhbXAiOjE0OTU3NTE5MTYwNjksInByb2ZpbGVJZCI6ImE2OGYwYjY0OGQxNDQwMDBhOTVmNGI5YmExNGY4ZGY5IiwicHJvZmlsZU5hbWUiOiJNSEZfQXJyb3dMZWZ0Iiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8zZWJmOTA3NDk0YTkzNWU5NTViZmNhZGFiODFiZWFmYjkwZmI5YmU0OWM3MDI2YmE5N2Q3OThkNWYxYTIzIn19fQ==",
"ToR1w9ZV7zpzCiLBhoaJH3uixs5mAlMhNz42oaRRvrG4HRua5hC6oyyOPfn2HKdSseYA9b1be14fjNRQbSJRvXF3mlvt5/zct4sm+cPVmX8K5kbM2vfwHJgCnfjtPkzT8sqqg6YFdT35mAZGqb9/xY/wDSNSu/S3k2WgmHrJKirszaBZrZfnVnqITUOgM9TmixhcJn2obeqICv6tl7/Wyk/1W62wXlXGm9+WjS+8rRNB+vYxqKR3XmH2lhAiyVGbADsjjGtBVUTWjq+aPw670SjXkoii0YE8sqzUlMMGEkXdXl9fvGtnWKk3APSseuTsjedr7yq+AkXFVDqqkqcUuXwmZl2EjC2WRRbhmYdbtY5nEfqh5+MiBrGdR/JqdEUL4yRutyRTw8mSUAI6X2oSVge7EdM/8f4HwLf33EO4pTocTqAkNbpt6Z54asLe5Y12jSXbvd2dFsgeJbrslK7e4uy/TK8CXf0BP3KLU20QELYrjz9I70gtj9lJ9xwjdx4/xJtxDtrxfC4Afmpu+GNYA/mifpyP3GDeBB5CqN7btIvEWyVvRNH7ppAqZIPqYJ7dSDd2RFuhAId5Yq98GUTBn+eRzeigBvSi1bFkkEgldfghOoK5WhsQtQbXuBBXITMME3NaWCN6zG7DxspS6ew/rZ8E809Xe0ArllquIZ0sP+k=");
Lhead.setItemMeta(LskullMeta);
nInv.addItem(nInv.createItem(Lhead, nInv.addItem(nInv.createItem(Lhead,
configLoad.getString("Menu.Visit.Item.Previous.Displayname"), null, null, null, null), 1); configLoad.getString("Menu.Visit.Item.Previous.Displayname"), null, null, null, null), 1);
} }
if (!(nextEndIndex == 0 || nextEndIndex < 0)) { if (!(nextEndIndex == 0 || nextEndIndex < 0)) {
ItemStack Rhead = XMaterial.PLAYER_HEAD.parseItem(); ItemStack Rhead = SkullItemCreator.byTextureUrlHash("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b");
SkullMeta RskullMeta = (SkullMeta) Rhead.getItemMeta();
SkullUtils.setSkullBase64(RskullMeta,
"eyJ0aW1lc3RhbXAiOjE0OTM4NjgxMDA2NzMsInByb2ZpbGVJZCI6IjUwYzg1MTBiNWVhMDRkNjBiZTlhN2Q1NDJkNmNkMTU2IiwicHJvZmlsZU5hbWUiOiJNSEZfQXJyb3dSaWdodCIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMWI2ZjFhMjViNmJjMTk5OTQ2NDcyYWVkYjM3MDUyMjU4NGZmNmY0ZTgzMjIxZTU5NDZiZDJlNDFiNWNhMTNiIn19fQ==",
"wZPrsmxckJn4/ybw/iXoMWgAe+1titw3hjhmf7bfg9vtOl0f/J6YLNMOI0OTvqeRKzSQVCxqNOij6k2iM32ZRInCQyblDIFmFadQxryEJDJJPVs7rXR6LRXlN8ON2VDGtboRTL7LwMGpzsrdPNt0oYDJLpR0huEeZKc1+g4W13Y4YM5FUgEs8HvMcg4aaGokSbvrYRRcEh3LR1lVmgxtbiUIr2gZkR3jnwdmZaIw/Ujw28+Et2pDMVCf96E5vC0aNY0KHTdMYheT6hwgw0VAZS2VnJg+Gz4JCl4eQmN2fs4dUBELIW2Rdnp4U1Eb+ZL8DvTV7ofBeZupknqPOyoKIjpInDml9BB2/EkD3zxFtW6AWocRphn03Z203navBkR6ztCMz0BgbmQU/m8VL/s8o4cxOn+2ppjrlj0p8AQxEsBdHozrBi8kNOGf1j97SDHxnvVAF3X8XDso+MthRx5pbEqpxmLyKKgFh25pJE7UaMSnzH2lc7aAZiax67MFw55pDtgfpl+Nlum4r7CK2w5Xob2QTCovVhu78/6SV7qM2Lhlwx/Sjqcl8rn5UIoyM49QE5Iyf1tk+xHXkIvY0m7q358oXsfca4eKmxMe6DFRjUDo1VuWxdg9iVjn22flqz1LD1FhGlPoqv0k4jX5Q733LwtPPI6VOTK+QzqrmiuR6e8=");
Rhead.setItemMeta(RskullMeta);
nInv.addItem(nInv.createItem(Rhead, nInv.addItem(nInv.createItem(Rhead,
configLoad.getString("Menu.Visit.Item.Next.Displayname"), null, null, null, null), 7); configLoad.getString("Menu.Visit.Item.Next.Displayname"), null, null, null, null), 7);
} }
@ -476,7 +465,19 @@ public class Visit {
"Menu.Visit.Item.Island.Vote.Enabled.Signature.Disabled.Visitor.Lore")); "Menu.Visit.Item.Island.Vote.Enabled.Signature.Disabled.Visitor.Lore"));
} }
} }
ItemStack phead = SkullUtils.getSkull(targetPlayer.getUniqueId());
ItemStack phead;
if (targetPlayerTexture.length >= 1 && targetPlayerTexture[0] != null) {
phead = SkullItemCreator.byTextureValue(targetPlayerTexture[0]);
} else {
try {
phead = SkullItemCreator.byUuid(visit.getOwnerUUID()).get();
} catch (InterruptedException | ExecutionException ex) {
throw new RuntimeException(ex);
}
}
nInv.addItem(nInv.createItem(phead, nInv.addItem(nInv.createItem(phead,
configLoad.getString("Menu.Visit.Item.Island.Displayname").replace("%player", configLoad.getString("Menu.Visit.Item.Island.Displayname").replace("%player",
targetPlayerName), targetPlayerName),
@ -512,7 +513,18 @@ public class Visit {
itemLore.addAll(configLoad itemLore.addAll(configLoad
.getStringList("Menu.Visit.Item.Island.Vote.Disabled.Signature.Disabled.Lore")); .getStringList("Menu.Visit.Item.Island.Vote.Disabled.Signature.Disabled.Lore"));
} }
ItemStack phead = SkullUtils.getSkull(targetPlayer.getUniqueId());
ItemStack phead;
if (targetPlayerTexture.length >= 1 && targetPlayerTexture[0] != null) {
phead = SkullItemCreator.byTextureValue(targetPlayerTexture[0]);
} else {
try {
phead = SkullItemCreator.byUuid(visit.getOwnerUUID()).get();
} catch (InterruptedException | ExecutionException ex) {
throw new RuntimeException(ex);
}
}
nInv.addItem(nInv.createItem(phead, nInv.addItem(nInv.createItem(phead,
configLoad.getString("Menu.Visit.Item.Island.Displayname").replace("%player", configLoad.getString("Menu.Visit.Item.Island.Displayname").replace("%player",
targetPlayerName), targetPlayerName),

View File

@ -1,9 +1,8 @@
package com.craftaro.skyblock.menus; package com.craftaro.skyblock.menus;
import com.craftaro.third_party.com.cryptomorin.xseries.SkullUtils; import com.craftaro.core.utils.SkullItemCreator;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound; import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.ItemUtils;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.island.Island; import com.craftaro.skyblock.island.Island;
import com.craftaro.skyblock.island.IslandManager; import com.craftaro.skyblock.island.IslandManager;
@ -18,12 +17,10 @@ import com.craftaro.skyblock.utils.item.nInventoryUtil;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -189,23 +186,13 @@ public class Visitors {
int playerMenuPage = playerData.getPage(MenuType.VISITORS), nextEndIndex = sortedIslandVisitors.size() - playerMenuPage * 36; int playerMenuPage = playerData.getPage(MenuType.VISITORS), nextEndIndex = sortedIslandVisitors.size() - playerMenuPage * 36;
if (playerMenuPage != 1) { if (playerMenuPage != 1) {
ItemStack Lhead = XMaterial.PLAYER_HEAD.parseItem(); ItemStack Lhead = SkullItemCreator.byTextureUrlHash("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23");
SkullMeta LskullMeta = (SkullMeta) Lhead.getItemMeta();
SkullUtils.setSkullBase64(LskullMeta,
"eyJ0aW1lc3RhbXAiOjE0OTU3NTE5MTYwNjksInByb2ZpbGVJZCI6ImE2OGYwYjY0OGQxNDQwMDBhOTVmNGI5YmExNGY4ZGY5IiwicHJvZmlsZU5hbWUiOiJNSEZfQXJyb3dMZWZ0Iiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8zZWJmOTA3NDk0YTkzNWU5NTViZmNhZGFiODFiZWFmYjkwZmI5YmU0OWM3MDI2YmE5N2Q3OThkNWYxYTIzIn19fQ==",
"ToR1w9ZV7zpzCiLBhoaJH3uixs5mAlMhNz42oaRRvrG4HRua5hC6oyyOPfn2HKdSseYA9b1be14fjNRQbSJRvXF3mlvt5/zct4sm+cPVmX8K5kbM2vfwHJgCnfjtPkzT8sqqg6YFdT35mAZGqb9/xY/wDSNSu/S3k2WgmHrJKirszaBZrZfnVnqITUOgM9TmixhcJn2obeqICv6tl7/Wyk/1W62wXlXGm9+WjS+8rRNB+vYxqKR3XmH2lhAiyVGbADsjjGtBVUTWjq+aPw670SjXkoii0YE8sqzUlMMGEkXdXl9fvGtnWKk3APSseuTsjedr7yq+AkXFVDqqkqcUuXwmZl2EjC2WRRbhmYdbtY5nEfqh5+MiBrGdR/JqdEUL4yRutyRTw8mSUAI6X2oSVge7EdM/8f4HwLf33EO4pTocTqAkNbpt6Z54asLe5Y12jSXbvd2dFsgeJbrslK7e4uy/TK8CXf0BP3KLU20QELYrjz9I70gtj9lJ9xwjdx4/xJtxDtrxfC4Afmpu+GNYA/mifpyP3GDeBB5CqN7btIvEWyVvRNH7ppAqZIPqYJ7dSDd2RFuhAId5Yq98GUTBn+eRzeigBvSi1bFkkEgldfghOoK5WhsQtQbXuBBXITMME3NaWCN6zG7DxspS6ew/rZ8E809Xe0ArllquIZ0sP+k=");
Lhead.setItemMeta(LskullMeta);
nInv.addItem(nInv.createItem(Lhead, nInv.addItem(nInv.createItem(Lhead,
configLoad.getString("Menu.Visitors.Item.Previous.Displayname"), null, null, null, null), 1); configLoad.getString("Menu.Visitors.Item.Previous.Displayname"), null, null, null, null), 1);
} }
if (!(nextEndIndex == 0 || nextEndIndex < 0)) { if (!(nextEndIndex == 0 || nextEndIndex < 0)) {
ItemStack Rhead = XMaterial.PLAYER_HEAD.parseItem(); ItemStack Rhead = SkullItemCreator.byTextureUrlHash("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b");
SkullMeta RskullMeta = (SkullMeta) Rhead.getItemMeta();
SkullUtils.setSkullBase64(RskullMeta,
"eyJ0aW1lc3RhbXAiOjE0OTM4NjgxMDA2NzMsInByb2ZpbGVJZCI6IjUwYzg1MTBiNWVhMDRkNjBiZTlhN2Q1NDJkNmNkMTU2IiwicHJvZmlsZU5hbWUiOiJNSEZfQXJyb3dSaWdodCIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMWI2ZjFhMjViNmJjMTk5OTQ2NDcyYWVkYjM3MDUyMjU4NGZmNmY0ZTgzMjIxZTU5NDZiZDJlNDFiNWNhMTNiIn19fQ==",
"wZPrsmxckJn4/ybw/iXoMWgAe+1titw3hjhmf7bfg9vtOl0f/J6YLNMOI0OTvqeRKzSQVCxqNOij6k2iM32ZRInCQyblDIFmFadQxryEJDJJPVs7rXR6LRXlN8ON2VDGtboRTL7LwMGpzsrdPNt0oYDJLpR0huEeZKc1+g4W13Y4YM5FUgEs8HvMcg4aaGokSbvrYRRcEh3LR1lVmgxtbiUIr2gZkR3jnwdmZaIw/Ujw28+Et2pDMVCf96E5vC0aNY0KHTdMYheT6hwgw0VAZS2VnJg+Gz4JCl4eQmN2fs4dUBELIW2Rdnp4U1Eb+ZL8DvTV7ofBeZupknqPOyoKIjpInDml9BB2/EkD3zxFtW6AWocRphn03Z203navBkR6ztCMz0BgbmQU/m8VL/s8o4cxOn+2ppjrlj0p8AQxEsBdHozrBi8kNOGf1j97SDHxnvVAF3X8XDso+MthRx5pbEqpxmLyKKgFh25pJE7UaMSnzH2lc7aAZiax67MFw55pDtgfpl+Nlum4r7CK2w5Xob2QTCovVhu78/6SV7qM2Lhlwx/Sjqcl8rn5UIoyM49QE5Iyf1tk+xHXkIvY0m7q358oXsfca4eKmxMe6DFRjUDo1VuWxdg9iVjn22flqz1LD1FhGlPoqv0k4jX5Q733LwtPPI6VOTK+QzqrmiuR6e8=");
Rhead.setItemMeta(RskullMeta);
nInv.addItem(nInv.createItem(Rhead, nInv.addItem(nInv.createItem(Rhead,
configLoad.getString("Menu.Visitors.Item.Next.Displayname"), null, null, null, null), 7); configLoad.getString("Menu.Visitors.Item.Next.Displayname"), null, null, null, null), 7);
} }
@ -229,7 +216,7 @@ public class Visitors {
if (islandVisitors.size() > index) { if (islandVisitors.size() > index) {
inventorySlot++; inventorySlot++;
OfflinePlayer targetPlayer = Bukkit.getServer().getPlayer((UUID) islandVisitors.toArray()[index]); Player targetPlayer = Bukkit.getServer().getPlayer((UUID) islandVisitors.toArray()[index]);
PlayerData targetPlayerData = playerDataManager.getPlayerData(targetPlayer.getUniqueId()); PlayerData targetPlayerData = playerDataManager.getPlayerData(targetPlayer.getUniqueId());
String[] targetPlayerTexture = targetPlayerData.getTexture(); String[] targetPlayerTexture = targetPlayerData.getTexture();
@ -282,7 +269,8 @@ public class Visitors {
"Menu.Visitors.Item.Visitor.Kick.NoPermission.Ban.NoPermission.Lore")); "Menu.Visitors.Item.Visitor.Kick.NoPermission.Ban.NoPermission.Lore"));
} }
} }
ItemStack phead = SkullUtils.getSkull(targetPlayer.getUniqueId());
ItemStack phead = SkullItemCreator.byPlayer(targetPlayer);
nInv.addItem( nInv.addItem(
nInv.createItem(phead, nInv.createItem(phead,
ChatColor.translateAlternateColorCodes('&', ChatColor.translateAlternateColorCodes('&',

View File

@ -1,12 +1,10 @@
package com.craftaro.skyblock.menus.admin; package com.craftaro.skyblock.menus.admin;
import com.craftaro.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.gui.AnvilGui; import com.craftaro.core.gui.AnvilGui;
import com.craftaro.third_party.com.cryptomorin.xseries.SkullUtils; import com.craftaro.core.utils.SkullItemCreator;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.ItemUtils;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.config.FileManager; import com.craftaro.skyblock.config.FileManager;
import com.craftaro.skyblock.config.FileManager.Config; import com.craftaro.skyblock.config.FileManager.Config;
@ -19,6 +17,8 @@ import com.craftaro.skyblock.sound.SoundManager;
import com.craftaro.skyblock.structure.Structure; import com.craftaro.skyblock.structure.Structure;
import com.craftaro.skyblock.structure.StructureManager; import com.craftaro.skyblock.structure.StructureManager;
import com.craftaro.skyblock.utils.item.nInventoryUtil; import com.craftaro.skyblock.utils.item.nInventoryUtil;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
@ -31,7 +31,6 @@ import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.SkullMeta;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -80,24 +79,14 @@ public class Creator implements Listener {
int playerMenuPage = playerData.getPage(MenuType.ADMIN_CREATOR), nextEndIndex = structures.size() - playerMenuPage * 36; int playerMenuPage = playerData.getPage(MenuType.ADMIN_CREATOR), nextEndIndex = structures.size() - playerMenuPage * 36;
if (playerMenuPage != 1) { if (playerMenuPage != 1) {
ItemStack Lhead = XMaterial.PLAYER_HEAD.parseItem(); ItemStack Lhead = SkullItemCreator.byTextureUrlHash("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23");
SkullMeta LskullMeta = (SkullMeta) Lhead.getItemMeta();
SkullUtils.setSkullBase64(LskullMeta,
"eyJ0aW1lc3RhbXAiOjE0OTU3NTE5MTYwNjksInByb2ZpbGVJZCI6ImE2OGYwYjY0OGQxNDQwMDBhOTVmNGI5YmExNGY4ZGY5IiwicHJvZmlsZU5hbWUiOiJNSEZfQXJyb3dMZWZ0Iiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8zZWJmOTA3NDk0YTkzNWU5NTViZmNhZGFiODFiZWFmYjkwZmI5YmU0OWM3MDI2YmE5N2Q3OThkNWYxYTIzIn19fQ==",
"ToR1w9ZV7zpzCiLBhoaJH3uixs5mAlMhNz42oaRRvrG4HRua5hC6oyyOPfn2HKdSseYA9b1be14fjNRQbSJRvXF3mlvt5/zct4sm+cPVmX8K5kbM2vfwHJgCnfjtPkzT8sqqg6YFdT35mAZGqb9/xY/wDSNSu/S3k2WgmHrJKirszaBZrZfnVnqITUOgM9TmixhcJn2obeqICv6tl7/Wyk/1W62wXlXGm9+WjS+8rRNB+vYxqKR3XmH2lhAiyVGbADsjjGtBVUTWjq+aPw670SjXkoii0YE8sqzUlMMGEkXdXl9fvGtnWKk3APSseuTsjedr7yq+AkXFVDqqkqcUuXwmZl2EjC2WRRbhmYdbtY5nEfqh5+MiBrGdR/JqdEUL4yRutyRTw8mSUAI6X2oSVge7EdM/8f4HwLf33EO4pTocTqAkNbpt6Z54asLe5Y12jSXbvd2dFsgeJbrslK7e4uy/TK8CXf0BP3KLU20QELYrjz9I70gtj9lJ9xwjdx4/xJtxDtrxfC4Afmpu+GNYA/mifpyP3GDeBB5CqN7btIvEWyVvRNH7ppAqZIPqYJ7dSDd2RFuhAId5Yq98GUTBn+eRzeigBvSi1bFkkEgldfghOoK5WhsQtQbXuBBXITMME3NaWCN6zG7DxspS6ew/rZ8E809Xe0ArllquIZ0sP+k=");
Lhead.setItemMeta(LskullMeta);
nInv.addItem(nInv.createItem(Lhead, nInv.addItem(nInv.createItem(Lhead,
configLoad.getString("Menu.Admin.Creator.Browse.Item.Previous.Displayname"), null, null, null, configLoad.getString("Menu.Admin.Creator.Browse.Item.Previous.Displayname"), null, null, null,
null), 1); null), 1);
} }
if (!(nextEndIndex == 0 || nextEndIndex < 0)) { if (!(nextEndIndex == 0 || nextEndIndex < 0)) {
ItemStack Rhead = XMaterial.PLAYER_HEAD.parseItem(); ItemStack Rhead = SkullItemCreator.byTextureUrlHash("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b");
SkullMeta RskullMeta = (SkullMeta) Rhead.getItemMeta();
SkullUtils.setSkullBase64(RskullMeta,
"eyJ0aW1lc3RhbXAiOjE0OTM4NjgxMDA2NzMsInByb2ZpbGVJZCI6IjUwYzg1MTBiNWVhMDRkNjBiZTlhN2Q1NDJkNmNkMTU2IiwicHJvZmlsZU5hbWUiOiJNSEZfQXJyb3dSaWdodCIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMWI2ZjFhMjViNmJjMTk5OTQ2NDcyYWVkYjM3MDUyMjU4NGZmNmY0ZTgzMjIxZTU5NDZiZDJlNDFiNWNhMTNiIn19fQ==",
"wZPrsmxckJn4/ybw/iXoMWgAe+1titw3hjhmf7bfg9vtOl0f/J6YLNMOI0OTvqeRKzSQVCxqNOij6k2iM32ZRInCQyblDIFmFadQxryEJDJJPVs7rXR6LRXlN8ON2VDGtboRTL7LwMGpzsrdPNt0oYDJLpR0huEeZKc1+g4W13Y4YM5FUgEs8HvMcg4aaGokSbvrYRRcEh3LR1lVmgxtbiUIr2gZkR3jnwdmZaIw/Ujw28+Et2pDMVCf96E5vC0aNY0KHTdMYheT6hwgw0VAZS2VnJg+Gz4JCl4eQmN2fs4dUBELIW2Rdnp4U1Eb+ZL8DvTV7ofBeZupknqPOyoKIjpInDml9BB2/EkD3zxFtW6AWocRphn03Z203navBkR6ztCMz0BgbmQU/m8VL/s8o4cxOn+2ppjrlj0p8AQxEsBdHozrBi8kNOGf1j97SDHxnvVAF3X8XDso+MthRx5pbEqpxmLyKKgFh25pJE7UaMSnzH2lc7aAZiax67MFw55pDtgfpl+Nlum4r7CK2w5Xob2QTCovVhu78/6SV7qM2Lhlwx/Sjqcl8rn5UIoyM49QE5Iyf1tk+xHXkIvY0m7q358oXsfca4eKmxMe6DFRjUDo1VuWxdg9iVjn22flqz1LD1FhGlPoqv0k4jX5Q733LwtPPI6VOTK+QzqrmiuR6e8=");
Rhead.setItemMeta(RskullMeta);
nInv.addItem(nInv.createItem(Rhead, nInv.addItem(nInv.createItem(Rhead,
configLoad.getString("Menu.Admin.Creator.Browse.Item.Next.Displayname"), null, null, null, configLoad.getString("Menu.Admin.Creator.Browse.Item.Next.Displayname"), null, null, null,
null), 7); null), 7);
@ -277,7 +266,7 @@ public class Creator implements Listener {
FileConfiguration configLoad = config.getFileConfiguration(); FileConfiguration configLoad = config.getFileConfiguration();
String inventoryName = ""; String inventoryName = "";
if (ServerVersion.isServerVersionAbove(ServerVersion.V1_13)) { if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_13)) {
inventoryName = event.getView().getTitle(); inventoryName = event.getView().getTitle();
} else { } else {
try { try {
@ -1224,7 +1213,7 @@ public class Creator implements Listener {
FileConfiguration configLoad = config.getFileConfiguration(); FileConfiguration configLoad = config.getFileConfiguration();
String inventoryName = ""; String inventoryName = "";
if (ServerVersion.isServerVersionAbove(ServerVersion.V1_13)) { if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_13)) {
inventoryName = event.getView().getTitle(); inventoryName = event.getView().getTitle();
} else { } else {
try { try {

View File

@ -1,12 +1,12 @@
package com.craftaro.skyblock.menus.admin; package com.craftaro.skyblock.menus.admin;
import com.craftaro.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.gui.AnvilGui; import com.craftaro.core.gui.AnvilGui;
import com.craftaro.third_party.com.cryptomorin.xseries.SkullUtils; import com.craftaro.core.utils.SkullItemCreator;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound; import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.ItemUtils;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.config.FileManager; import com.craftaro.skyblock.config.FileManager;
import com.craftaro.skyblock.config.FileManager.Config; import com.craftaro.skyblock.config.FileManager.Config;
@ -31,7 +31,6 @@ import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.SkullMeta;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -80,24 +79,14 @@ public class Generator implements Listener {
int playerMenuPage = playerData.getPage(MenuType.ADMIN_GENERATOR), nextEndIndex = generators.size() - playerMenuPage * 36; int playerMenuPage = playerData.getPage(MenuType.ADMIN_GENERATOR), nextEndIndex = generators.size() - playerMenuPage * 36;
if (playerMenuPage != 1) { if (playerMenuPage != 1) {
ItemStack Lhead = XMaterial.PLAYER_HEAD.parseItem(); ItemStack Lhead = SkullItemCreator.byTextureUrlHash("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23");
SkullMeta LskullMeta = (SkullMeta) Lhead.getItemMeta();
SkullUtils.setSkullBase64(LskullMeta,
"eyJ0aW1lc3RhbXAiOjE0OTU3NTE5MTYwNjksInByb2ZpbGVJZCI6ImE2OGYwYjY0OGQxNDQwMDBhOTVmNGI5YmExNGY4ZGY5IiwicHJvZmlsZU5hbWUiOiJNSEZfQXJyb3dMZWZ0Iiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8zZWJmOTA3NDk0YTkzNWU5NTViZmNhZGFiODFiZWFmYjkwZmI5YmU0OWM3MDI2YmE5N2Q3OThkNWYxYTIzIn19fQ==",
"ToR1w9ZV7zpzCiLBhoaJH3uixs5mAlMhNz42oaRRvrG4HRua5hC6oyyOPfn2HKdSseYA9b1be14fjNRQbSJRvXF3mlvt5/zct4sm+cPVmX8K5kbM2vfwHJgCnfjtPkzT8sqqg6YFdT35mAZGqb9/xY/wDSNSu/S3k2WgmHrJKirszaBZrZfnVnqITUOgM9TmixhcJn2obeqICv6tl7/Wyk/1W62wXlXGm9+WjS+8rRNB+vYxqKR3XmH2lhAiyVGbADsjjGtBVUTWjq+aPw670SjXkoii0YE8sqzUlMMGEkXdXl9fvGtnWKk3APSseuTsjedr7yq+AkXFVDqqkqcUuXwmZl2EjC2WRRbhmYdbtY5nEfqh5+MiBrGdR/JqdEUL4yRutyRTw8mSUAI6X2oSVge7EdM/8f4HwLf33EO4pTocTqAkNbpt6Z54asLe5Y12jSXbvd2dFsgeJbrslK7e4uy/TK8CXf0BP3KLU20QELYrjz9I70gtj9lJ9xwjdx4/xJtxDtrxfC4Afmpu+GNYA/mifpyP3GDeBB5CqN7btIvEWyVvRNH7ppAqZIPqYJ7dSDd2RFuhAId5Yq98GUTBn+eRzeigBvSi1bFkkEgldfghOoK5WhsQtQbXuBBXITMME3NaWCN6zG7DxspS6ew/rZ8E809Xe0ArllquIZ0sP+k=");
Lhead.setItemMeta(LskullMeta);
nInv.addItem(nInv.createItem(Lhead, nInv.addItem(nInv.createItem(Lhead,
configLoad.getString("Menu.Admin.Generator.Browse.Item.Previous.Displayname"), null, null, null, configLoad.getString("Menu.Admin.Generator.Browse.Item.Previous.Displayname"), null, null, null,
null), 1); null), 1);
} }
if (!(nextEndIndex == 0 || nextEndIndex < 0)) { if (!(nextEndIndex == 0 || nextEndIndex < 0)) {
ItemStack Rhead = XMaterial.PLAYER_HEAD.parseItem(); ItemStack Rhead = SkullItemCreator.byTextureUrlHash("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b");
SkullMeta RskullMeta = (SkullMeta) Rhead.getItemMeta();
SkullUtils.setSkullBase64(RskullMeta,
"eyJ0aW1lc3RhbXAiOjE0OTM4NjgxMDA2NzMsInByb2ZpbGVJZCI6IjUwYzg1MTBiNWVhMDRkNjBiZTlhN2Q1NDJkNmNkMTU2IiwicHJvZmlsZU5hbWUiOiJNSEZfQXJyb3dSaWdodCIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMWI2ZjFhMjViNmJjMTk5OTQ2NDcyYWVkYjM3MDUyMjU4NGZmNmY0ZTgzMjIxZTU5NDZiZDJlNDFiNWNhMTNiIn19fQ==",
"wZPrsmxckJn4/ybw/iXoMWgAe+1titw3hjhmf7bfg9vtOl0f/J6YLNMOI0OTvqeRKzSQVCxqNOij6k2iM32ZRInCQyblDIFmFadQxryEJDJJPVs7rXR6LRXlN8ON2VDGtboRTL7LwMGpzsrdPNt0oYDJLpR0huEeZKc1+g4W13Y4YM5FUgEs8HvMcg4aaGokSbvrYRRcEh3LR1lVmgxtbiUIr2gZkR3jnwdmZaIw/Ujw28+Et2pDMVCf96E5vC0aNY0KHTdMYheT6hwgw0VAZS2VnJg+Gz4JCl4eQmN2fs4dUBELIW2Rdnp4U1Eb+ZL8DvTV7ofBeZupknqPOyoKIjpInDml9BB2/EkD3zxFtW6AWocRphn03Z203navBkR6ztCMz0BgbmQU/m8VL/s8o4cxOn+2ppjrlj0p8AQxEsBdHozrBi8kNOGf1j97SDHxnvVAF3X8XDso+MthRx5pbEqpxmLyKKgFh25pJE7UaMSnzH2lc7aAZiax67MFw55pDtgfpl+Nlum4r7CK2w5Xob2QTCovVhu78/6SV7qM2Lhlwx/Sjqcl8rn5UIoyM49QE5Iyf1tk+xHXkIvY0m7q358oXsfca4eKmxMe6DFRjUDo1VuWxdg9iVjn22flqz1LD1FhGlPoqv0k4jX5Q733LwtPPI6VOTK+QzqrmiuR6e8=");
Rhead.setItemMeta(RskullMeta);
nInv.addItem(nInv.createItem(Rhead, nInv.addItem(nInv.createItem(Rhead,
configLoad.getString("Menu.Admin.Generator.Browse.Item.Next.Displayname"), null, null, null, configLoad.getString("Menu.Admin.Generator.Browse.Item.Next.Displayname"), null, null, null,
null), 7); null), 7);
@ -206,7 +195,7 @@ public class Generator implements Listener {
FileConfiguration configLoad = plugin.getLanguage(); FileConfiguration configLoad = plugin.getLanguage();
String inventoryName = ""; String inventoryName = "";
if (ServerVersion.isServerVersionAbove(ServerVersion.V1_13)) { if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_13)) {
inventoryName = event.getView().getTitle(); inventoryName = event.getView().getTitle();
} else { } else {
try { try {

View File

@ -1,12 +1,12 @@
package com.craftaro.skyblock.menus.admin; package com.craftaro.skyblock.menus.admin;
import com.craftaro.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.gui.AnvilGui; import com.craftaro.core.gui.AnvilGui;
import com.craftaro.third_party.com.cryptomorin.xseries.SkullUtils; import com.craftaro.core.utils.SkullItemCreator;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound; import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.core.utils.ItemUtils;
import com.craftaro.core.utils.NumberUtils; import com.craftaro.core.utils.NumberUtils;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.config.FileManager; import com.craftaro.skyblock.config.FileManager;
@ -31,7 +31,6 @@ import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.SkullMeta;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -105,23 +104,13 @@ public class Levelling implements Listener {
int playerMenuPage = playerData.getPage(MenuType.ADMIN_LEVELLING), nextEndIndex = levellingMaterials.size() - playerMenuPage * 36; int playerMenuPage = playerData.getPage(MenuType.ADMIN_LEVELLING), nextEndIndex = levellingMaterials.size() - playerMenuPage * 36;
if (playerMenuPage != 1) { if (playerMenuPage != 1) {
ItemStack Lhead = XMaterial.PLAYER_HEAD.parseItem(); ItemStack Lhead = SkullItemCreator.byTextureUrlHash("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23");
SkullMeta LskullMeta = (SkullMeta) Lhead.getItemMeta();
SkullUtils.setSkullBase64(LskullMeta,
"eyJ0aW1lc3RhbXAiOjE0OTU3NTE5MTYwNjksInByb2ZpbGVJZCI6ImE2OGYwYjY0OGQxNDQwMDBhOTVmNGI5YmExNGY4ZGY5IiwicHJvZmlsZU5hbWUiOiJNSEZfQXJyb3dMZWZ0Iiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8zZWJmOTA3NDk0YTkzNWU5NTViZmNhZGFiODFiZWFmYjkwZmI5YmU0OWM3MDI2YmE5N2Q3OThkNWYxYTIzIn19fQ==",
"ToR1w9ZV7zpzCiLBhoaJH3uixs5mAlMhNz42oaRRvrG4HRua5hC6oyyOPfn2HKdSseYA9b1be14fjNRQbSJRvXF3mlvt5/zct4sm+cPVmX8K5kbM2vfwHJgCnfjtPkzT8sqqg6YFdT35mAZGqb9/xY/wDSNSu/S3k2WgmHrJKirszaBZrZfnVnqITUOgM9TmixhcJn2obeqICv6tl7/Wyk/1W62wXlXGm9+WjS+8rRNB+vYxqKR3XmH2lhAiyVGbADsjjGtBVUTWjq+aPw670SjXkoii0YE8sqzUlMMGEkXdXl9fvGtnWKk3APSseuTsjedr7yq+AkXFVDqqkqcUuXwmZl2EjC2WRRbhmYdbtY5nEfqh5+MiBrGdR/JqdEUL4yRutyRTw8mSUAI6X2oSVge7EdM/8f4HwLf33EO4pTocTqAkNbpt6Z54asLe5Y12jSXbvd2dFsgeJbrslK7e4uy/TK8CXf0BP3KLU20QELYrjz9I70gtj9lJ9xwjdx4/xJtxDtrxfC4Afmpu+GNYA/mifpyP3GDeBB5CqN7btIvEWyVvRNH7ppAqZIPqYJ7dSDd2RFuhAId5Yq98GUTBn+eRzeigBvSi1bFkkEgldfghOoK5WhsQtQbXuBBXITMME3NaWCN6zG7DxspS6ew/rZ8E809Xe0ArllquIZ0sP+k=");
Lhead.setItemMeta(LskullMeta);
nInv.addItem(nInv.createItem(Lhead, nInv.addItem(nInv.createItem(Lhead,
configLoad.getString("Menu.Admin.Levelling.Item.Previous.Displayname"), null, null, null, null), 1); configLoad.getString("Menu.Admin.Levelling.Item.Previous.Displayname"), null, null, null, null), 1);
} }
if (!(nextEndIndex == 0 || nextEndIndex < 0)) { if (!(nextEndIndex == 0 || nextEndIndex < 0)) {
ItemStack Rhead = XMaterial.PLAYER_HEAD.parseItem(); ItemStack Rhead = SkullItemCreator.byTextureUrlHash("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b");
SkullMeta RskullMeta = (SkullMeta) Rhead.getItemMeta();
SkullUtils.setSkullBase64(RskullMeta,
"eyJ0aW1lc3RhbXAiOjE0OTM4NjgxMDA2NzMsInByb2ZpbGVJZCI6IjUwYzg1MTBiNWVhMDRkNjBiZTlhN2Q1NDJkNmNkMTU2IiwicHJvZmlsZU5hbWUiOiJNSEZfQXJyb3dSaWdodCIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMWI2ZjFhMjViNmJjMTk5OTQ2NDcyYWVkYjM3MDUyMjU4NGZmNmY0ZTgzMjIxZTU5NDZiZDJlNDFiNWNhMTNiIn19fQ==",
"wZPrsmxckJn4/ybw/iXoMWgAe+1titw3hjhmf7bfg9vtOl0f/J6YLNMOI0OTvqeRKzSQVCxqNOij6k2iM32ZRInCQyblDIFmFadQxryEJDJJPVs7rXR6LRXlN8ON2VDGtboRTL7LwMGpzsrdPNt0oYDJLpR0huEeZKc1+g4W13Y4YM5FUgEs8HvMcg4aaGokSbvrYRRcEh3LR1lVmgxtbiUIr2gZkR3jnwdmZaIw/Ujw28+Et2pDMVCf96E5vC0aNY0KHTdMYheT6hwgw0VAZS2VnJg+Gz4JCl4eQmN2fs4dUBELIW2Rdnp4U1Eb+ZL8DvTV7ofBeZupknqPOyoKIjpInDml9BB2/EkD3zxFtW6AWocRphn03Z203navBkR6ztCMz0BgbmQU/m8VL/s8o4cxOn+2ppjrlj0p8AQxEsBdHozrBi8kNOGf1j97SDHxnvVAF3X8XDso+MthRx5pbEqpxmLyKKgFh25pJE7UaMSnzH2lc7aAZiax67MFw55pDtgfpl+Nlum4r7CK2w5Xob2QTCovVhu78/6SV7qM2Lhlwx/Sjqcl8rn5UIoyM49QE5Iyf1tk+xHXkIvY0m7q358oXsfca4eKmxMe6DFRjUDo1VuWxdg9iVjn22flqz1LD1FhGlPoqv0k4jX5Q733LwtPPI6VOTK+QzqrmiuR6e8=");
Rhead.setItemMeta(RskullMeta);
nInv.addItem(nInv.createItem(Rhead, nInv.addItem(nInv.createItem(Rhead,
configLoad.getString("Menu.Admin.Levelling.Item.Next.Displayname"), null, null, null, null), 7); configLoad.getString("Menu.Admin.Levelling.Item.Next.Displayname"), null, null, null, null), 7);
} }
@ -180,7 +169,7 @@ public class Levelling implements Listener {
FileConfiguration configLoad = plugin.getLanguage(); FileConfiguration configLoad = plugin.getLanguage();
String inventoryName = ""; String inventoryName = "";
if (ServerVersion.isServerVersionAbove(ServerVersion.V1_13)) { if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_13)) {
inventoryName = event.getView().getTitle(); inventoryName = event.getView().getTitle();
} else { } else {
try { try {
@ -410,7 +399,7 @@ public class Levelling implements Listener {
XMaterial materials = CompatibleMaterial.getMaterial(event.getCurrentItem().getType()).get(); XMaterial materials = CompatibleMaterial.getMaterial(event.getCurrentItem().getType()).get();
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_13)) { if (MajorServerVersion.isServerVersionBelow(MajorServerVersion.V1_13)) {
materials.parseItem().setData(event.getCurrentItem().getData()); materials.parseItem().setData(event.getCurrentItem().getData());
} }

View File

@ -1,5 +1,6 @@
package com.craftaro.skyblock.menus.admin; package com.craftaro.skyblock.menus.admin;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.gui.AnvilGui; import com.craftaro.core.gui.AnvilGui;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
@ -240,7 +241,7 @@ public class Upgrade {
ItemStack jumpPotion = new ItemStack(Material.POTION); ItemStack jumpPotion = new ItemStack(Material.POTION);
com.craftaro.skyblock.upgrade.Upgrade upgrade; com.craftaro.skyblock.upgrade.Upgrade upgrade;
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) {
PotionMeta pm = (PotionMeta) speedPotion.getItemMeta(); PotionMeta pm = (PotionMeta) speedPotion.getItemMeta();
pm.setBasePotionData(new PotionData(PotionType.SPEED)); pm.setBasePotionData(new PotionData(PotionType.SPEED));
speedPotion.setItemMeta(pm); speedPotion.setItemMeta(pm);
@ -258,7 +259,7 @@ public class Upgrade {
new Placeholder("%status", getStatus(upgrade))}, new Placeholder("%status", getStatus(upgrade))},
null, new ItemFlag[]{ItemFlag.HIDE_POTION_EFFECTS}), 0); null, new ItemFlag[]{ItemFlag.HIDE_POTION_EFFECTS}), 0);
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) {
PotionMeta pm = (PotionMeta) jumpPotion.getItemMeta(); PotionMeta pm = (PotionMeta) jumpPotion.getItemMeta();
pm.setBasePotionData(new PotionData(PotionType.JUMP)); pm.setBasePotionData(new PotionData(PotionType.JUMP));
jumpPotion.setItemMeta(pm); jumpPotion.setItemMeta(pm);

View File

@ -12,17 +12,37 @@ import org.bukkit.inventory.meta.ItemMeta;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
public abstract class BasicPermission { public abstract class BasicPermission {
private final String name; private final String name;
private final XMaterial icon; private final XMaterial icon;
private final PermissionType type; private final PermissionType type;
//It used to write the permission's value
//to the global settings.yml which will be defaulted on all islands
private final Map<IslandRole, Boolean> defaultValues;
protected BasicPermission(@Nonnull String name, @Nonnull XMaterial icon, @Nonnull PermissionType type) { protected BasicPermission(@Nonnull String name, @Nonnull XMaterial icon, @Nonnull PermissionType type) {
this(name, icon, type, new HashMap<>());
}
protected BasicPermission(@Nonnull String name, @Nonnull XMaterial icon, @Nonnull PermissionType type, Map<IslandRole, Boolean> defaultValues) {
this.name = name; this.name = name;
this.icon = icon; this.icon = icon;
this.type = type; this.type = type;
if (defaultValues.isEmpty()) {
this.defaultValues = new HashMap<>();
this.defaultValues.put(IslandRole.VISITOR, false);
this.defaultValues.put(IslandRole.MEMBER, true);
this.defaultValues.put(IslandRole.OPERATOR, true);
this.defaultValues.put(IslandRole.COOP, true);
this.defaultValues.put(IslandRole.OWNER, true);
} else {
this.defaultValues = defaultValues;
}
} }
public ItemStack getItem(Island island, IslandRole role) { public ItemStack getItem(Island island, IslandRole role) {
@ -72,4 +92,8 @@ public abstract class BasicPermission {
public PermissionType getType() { public PermissionType getType() {
return this.type; return this.type;
} }
public Map<IslandRole, Boolean> getDefaultValues() {
return defaultValues;
}
} }

View File

@ -1,5 +1,6 @@
package com.craftaro.skyblock.permission; package com.craftaro.skyblock.permission;
import com.craftaro.skyblock.island.IslandRole;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound; import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
@ -34,11 +35,17 @@ import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.vehicle.VehicleDamageEvent; import org.bukkit.event.vehicle.VehicleDamageEvent;
import org.bukkit.event.vehicle.VehicleDestroyEvent; import org.bukkit.event.vehicle.VehicleDestroyEvent;
import java.util.Map;
public abstract class ListeningPermission extends BasicPermission { public abstract class ListeningPermission extends BasicPermission {
protected ListeningPermission(String name, XMaterial icon, PermissionType type) { protected ListeningPermission(String name, XMaterial icon, PermissionType type) {
super(name, icon, type); super(name, icon, type);
} }
protected ListeningPermission(String name, XMaterial icon, PermissionType type, Map<IslandRole, Boolean> defaultValues) {
super(name, icon, type, defaultValues);
}
public void onInteract(PlayerInteractEvent event) { public void onInteract(PlayerInteractEvent event) {
} }

View File

@ -1,5 +1,7 @@
package com.craftaro.skyblock.permission; package com.craftaro.skyblock.permission;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.config.FileManager; import com.craftaro.skyblock.config.FileManager;
import com.craftaro.skyblock.island.Island; import com.craftaro.skyblock.island.Island;
@ -141,6 +143,10 @@ public class PermissionManager {
registerPermission(new HungerPermission(plugin)); registerPermission(new HungerPermission(plugin));
} }
if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_20)) {
registerPermission(new SignEditPermission(plugin));
}
this.registeredHandlers = this.registeredHandlers.stream() this.registeredHandlers = this.registeredHandlers.stream()
.sorted(Comparator.comparingInt(h -> h.getHandler().getAnnotation(PermissionHandler.class).priority().ordinal())) .sorted(Comparator.comparingInt(h -> h.getHandler().getAnnotation(PermissionHandler.class).priority().ordinal()))
.collect(Collectors.toList()); .collect(Collectors.toList());
@ -153,13 +159,16 @@ public class PermissionManager {
switch (permission.getType()) { switch (permission.getType()) {
case GENERIC: case GENERIC:
if (settingsConfigLoad.getString("Settings.Visitor." + permission.getName()) == null) { if (settingsConfigLoad.getString("Settings.Visitor." + permission.getName()) == null) {
settingsConfigLoad.set("Settings.Visitor." + permission.getName(), true); settingsConfigLoad.set("Settings.Visitor." + permission.getName(), permission.getDefaultValues().get(IslandRole.VISITOR));
if (permission.getName().equals("EditSign")) {
System.err.println("Default EditSign Visitor permission set to: " + permission.getDefaultValues().get(IslandRole.VISITOR));
}
} }
if (settingsConfigLoad.getString("Settings.Member." + permission.getName()) == null) { if (settingsConfigLoad.getString("Settings.Member." + permission.getName()) == null) {
settingsConfigLoad.set("Settings.Member." + permission.getName(), true); settingsConfigLoad.set("Settings.Member." + permission.getName(), permission.getDefaultValues().get(IslandRole.MEMBER));
} }
if (settingsConfigLoad.getString("Settings.Coop." + permission.getName()) == null) { if (settingsConfigLoad.getString("Settings.Coop." + permission.getName()) == null) {
settingsConfigLoad.set("Settings.Coop." + permission.getName(), true); settingsConfigLoad.set("Settings.Coop." + permission.getName(), permission.getDefaultValues().get(IslandRole.COOP));
} }
break; break;
case OPERATOR: case OPERATOR:

View File

@ -1,5 +1,6 @@
package com.craftaro.skyblock.permission.permissions.listening; package com.craftaro.skyblock.permission.permissions.listening;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
@ -49,7 +50,7 @@ public class AnimalBreedingPermission extends ListeningPermission {
} else if (entity.getType() == EntityType.CHICKEN) { } else if (entity.getType() == EntityType.CHICKEN) {
if (!(XMaterial.WHEAT_SEEDS.isSimilar(is) if (!(XMaterial.WHEAT_SEEDS.isSimilar(is)
|| XMaterial.PUMPKIN_SEEDS.isSimilar(is) || XMaterial.MELON_SEEDS.isSimilar(is))) { || XMaterial.PUMPKIN_SEEDS.isSimilar(is) || XMaterial.MELON_SEEDS.isSimilar(is))) {
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_9)) {
if (!(XMaterial.BEETROOT_SEEDS.isSimilar(is))) { if (!(XMaterial.BEETROOT_SEEDS.isSimilar(is))) {
return; return;
} }
@ -86,12 +87,12 @@ public class AnimalBreedingPermission extends ListeningPermission {
return; return;
} }
} else { } else {
if (ServerVersion.isServerVersionAbove(ServerVersion.V1_10)) { if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_10)) {
if (entity.getType() == EntityType.LLAMA) { if (entity.getType() == EntityType.LLAMA) {
if (!(XMaterial.HAY_BLOCK.isSimilar(is))) { if (!(XMaterial.HAY_BLOCK.isSimilar(is))) {
return; return;
} }
} else if (ServerVersion.isServerVersionAbove(ServerVersion.V1_12)) { } else if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_12)) {
if (entity.getType() == EntityType.TURTLE) { if (entity.getType() == EntityType.TURTLE) {
if (!(XMaterial.SEAGRASS.isSimilar(is))) { if (!(XMaterial.SEAGRASS.isSimilar(is))) {
return; return;

View File

@ -1,5 +1,6 @@
package com.craftaro.skyblock.permission.permissions.listening; package com.craftaro.skyblock.permission.permissions.listening;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
@ -37,7 +38,7 @@ public class DamagePermission extends ListeningPermission {
return; return;
} }
} else { } else {
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_12)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_12)) {
if (event.getCause() == EntityDamageEvent.DamageCause.valueOf("ENTITY_SWEEP_ATTACK")) { if (event.getCause() == EntityDamageEvent.DamageCause.valueOf("ENTITY_SWEEP_ATTACK")) {
EntityDamageByEntityEvent entityDamageByEntityEvent = (EntityDamageByEntityEvent) event; EntityDamageByEntityEvent entityDamageByEntityEvent = (EntityDamageByEntityEvent) event;

View File

@ -1,6 +1,7 @@
package com.craftaro.skyblock.permission.permissions.listening; package com.craftaro.skyblock.permission.permissions.listening;
import com.craftaro.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
@ -59,7 +60,7 @@ public class PortalPermission extends ListeningPermission {
if (event.getCause() == PlayerTeleportEvent.TeleportCause.ENDER_PEARL if (event.getCause() == PlayerTeleportEvent.TeleportCause.ENDER_PEARL
|| event.getCause() == PlayerTeleportEvent.TeleportCause.NETHER_PORTAL || event.getCause() == PlayerTeleportEvent.TeleportCause.NETHER_PORTAL
|| event.getCause() == PlayerTeleportEvent.TeleportCause.END_PORTAL || event.getCause() == PlayerTeleportEvent.TeleportCause.END_PORTAL
|| (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9) || (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_9)
&& event.getCause() == PlayerTeleportEvent.TeleportCause.END_GATEWAY)) { && event.getCause() == PlayerTeleportEvent.TeleportCause.END_GATEWAY)) {
/*event.getPlayer().teleport(getToLocation(event.getFrom(), event.getPlayer())); /*event.getPlayer().teleport(getToLocation(event.getFrom(), event.getPlayer()));
Location to = getToLocation(event.getFrom(), event.getPlayer()); Location to = getToLocation(event.getFrom(), event.getPlayer());

View File

@ -0,0 +1,42 @@
package com.craftaro.skyblock.permission.permissions.listening;
import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.island.IslandRole;
import com.craftaro.skyblock.permission.ListeningPermission;
import com.craftaro.skyblock.permission.PermissionHandler;
import com.craftaro.skyblock.permission.PermissionType;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerInteractEvent;
import java.util.HashMap;
import java.util.Map;
public class SignEditPermission extends ListeningPermission {
private final SkyBlock plugin;
public SignEditPermission(SkyBlock plugin) {
super("EditSign", XMaterial.OAK_SIGN, PermissionType.GENERIC, new HashMap<IslandRole, Boolean>() {{
put(IslandRole.VISITOR, false);
put(IslandRole.MEMBER, true);
put(IslandRole.OPERATOR, true);
put(IslandRole.COOP, true);
put(IslandRole.OWNER, true);
}});
this.plugin = plugin;
}
@PermissionHandler
public void onInteract(PlayerInteractEvent event) {
if (event.getClickedBlock() == null) {
return;
}
Player player = event.getPlayer();
if (event.getClickedBlock().getType().name().contains("SIGN")) {
cancelAndMessage(event, player, this.plugin, this.plugin.getMessageManager());
}
}
}

View File

@ -1,5 +1,6 @@
package com.craftaro.skyblock.permission.permissions.listening; package com.craftaro.skyblock.permission.permissions.listening;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
@ -26,7 +27,7 @@ public class TradingPermission extends ListeningPermission {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (event.getRightClicked().getType() == EntityType.VILLAGER if (event.getRightClicked().getType() == EntityType.VILLAGER
|| ServerVersion.isServerVersionAtLeast(ServerVersion.V1_14) || MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_14)
&& event.getRightClicked().getType() == EntityType.WANDERING_TRADER) { && event.getRightClicked().getType() == EntityType.WANDERING_TRADER) {
cancelAndMessage(event, player, this.plugin, this.messageManager); cancelAndMessage(event, player, this.plugin, this.messageManager);
} }

View File

@ -1,5 +1,6 @@
package com.craftaro.skyblock.scoreboard; package com.craftaro.skyblock.scoreboard;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.placeholder.PlaceholderManager; import com.craftaro.skyblock.placeholder.PlaceholderManager;
@ -24,7 +25,7 @@ class Board {
this.player = player; this.player = player;
this.plugin = plugin; this.plugin = plugin;
this.board = this.plugin.getServer().getScoreboardManager().getNewScoreboard(); this.board = this.plugin.getServer().getScoreboardManager().getNewScoreboard();
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) {
this.objective = this.board.registerNewObjective("sb1", "sb2", "sb3"); this.objective = this.board.registerNewObjective("sb1", "sb2", "sb3");
} else { } else {
this.objective = this.board.registerNewObjective("sb1", "sb2"); this.objective = this.board.registerNewObjective("sb1", "sb2");
@ -66,7 +67,7 @@ class Board {
this.cache.put(line, string); this.cache.put(line, string);
ScoreboardLine parts; ScoreboardLine parts;
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) {
parts = convertIntoPieces(string, 64); parts = convertIntoPieces(string, 64);
} else { } else {
parts = convertIntoPieces(string, 16); parts = convertIntoPieces(string, 16);

View File

@ -1,5 +1,6 @@
package com.craftaro.skyblock.stackable; package com.craftaro.skyblock.stackable;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.third_party.com.cryptomorin.xseries.XSound; import com.craftaro.third_party.com.cryptomorin.xseries.XSound;
@ -147,7 +148,7 @@ public class Stackable {
as.setVisible(false); as.setVisible(false);
as.setGravity(false); as.setGravity(false);
as.setSmall(true); as.setSmall(true);
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_9)) {
as.setMarker(true); as.setMarker(true);
} }
as.setBasePlate(true); as.setBasePlate(true);

View File

@ -1,5 +1,6 @@
package com.craftaro.skyblock.tasks; package com.craftaro.skyblock.tasks;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
import com.craftaro.skyblock.island.IslandWorld; import com.craftaro.skyblock.island.IslandWorld;
@ -50,7 +51,7 @@ public class MobNetherWaterTask extends BukkitRunnable {
if (ent instanceof Blaze || ent instanceof MagmaCube || ent instanceof Wither || ent instanceof Ghast) if (ent instanceof Blaze || ent instanceof MagmaCube || ent instanceof Wither || ent instanceof Ghast)
return true; return true;
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_11)) {
return ent.getType() == EntityType.WITHER_SKELETON; return ent.getType() == EntityType.WITHER_SKELETON;
} else { } else {
return ent instanceof Skeleton && ((Skeleton) ent).getSkeletonType() == Skeleton.SkeletonType.WITHER; return ent instanceof Skeleton && ((Skeleton) ent).getSkeletonType() == Skeleton.SkeletonType.WITHER;

View File

@ -1,5 +1,6 @@
package com.craftaro.skyblock.utils.item; package com.craftaro.skyblock.utils.item;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Material; import org.bukkit.Material;
@ -20,7 +21,7 @@ public class InventoryUtil {
ItemStack is = ammo.get(index); ItemStack is = ammo.get(index);
ItemMeta im = is.getItemMeta(); ItemMeta im = is.getItemMeta();
if (ServerVersion.isServerVersionAbove(ServerVersion.V1_12)) { if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_12)) {
if (((Damageable) im).getDamage() != 0) { if (((Damageable) im).getDamage() != 0) {
continue; continue;
} }
@ -56,7 +57,7 @@ public class InventoryUtil {
ItemMeta im = is.getItemMeta(); ItemMeta im = is.getItemMeta();
if (!im.hasDisplayName()) { if (!im.hasDisplayName()) {
if (ServerVersion.isServerVersionAbove(ServerVersion.V1_12)) { if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_12)) {
if (((Damageable) im).getDamage() != 0) { if (((Damageable) im).getDamage() != 0) {
continue; continue;
} }

View File

@ -1,6 +1,7 @@
package com.craftaro.skyblock.utils.item; package com.craftaro.skyblock.utils.item;
import com.craftaro.core.compatibility.ClassMapping; import com.craftaro.core.compatibility.ClassMapping;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.MethodMapping; import com.craftaro.core.compatibility.MethodMapping;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
@ -15,10 +16,12 @@ import java.io.DataInputStream;
import java.io.DataOutput; import java.io.DataOutput;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.Arrays;
public class ItemStackUtil { public class ItemStackUtil {
private static final boolean isAbove1_16_R1 = ServerVersion.isServerVersionAtLeast(ServerVersion.V1_16) private static final boolean isAbove1_16_R1 = MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_16)
&& !ServerVersion.getServerVersionString().equals("v1_16_R1"); && !ServerVersion.getServerVersionString().equals("v1_16_R1");
public static ItemStack deserializeItemStack(String data) { public static ItemStack deserializeItemStack(String data) {
@ -27,47 +30,59 @@ public class ItemStackUtil {
ItemStack itemStack = null; ItemStack itemStack = null;
try { if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_20_5)) {
Class<?> NBTTagCompoundClass = ClassMapping.NBT_TAG_COMPOUND.getClazz(); //We need net.minecraft.nbt.NbtIo class in this version
Class<?> NMSItemStackClass = ClassMapping.ITEM_STACK.getClazz(); byte[] bytes = new BigInteger(data, 32).toByteArray();
Object NBTTagCompound = isAbove1_16_R1 ? ClassMapping.NBT_COMPRESSED_STREAM_TOOLS.getClazz() itemStack = ItemStack.deserializeBytes(bytes);
.getMethod("a", DataInput.class).invoke(null, dataInputStream) } else {
: ClassMapping.NBT_COMPRESSED_STREAM_TOOLS.getClazz() try {
.getMethod("a", DataInputStream.class).invoke(null, dataInputStream); Class<?> NBTTagCompoundClass = ClassMapping.NBT_TAG_COMPOUND.getClazz();
Object craftItemStack; Class<?> NMSItemStackClass = ClassMapping.ITEM_STACK.getClazz();
Object NBTTagCompound = isAbove1_16_R1 ? ClassMapping.NBT_COMPRESSED_STREAM_TOOLS.getClazz()
.getMethod("a", DataInput.class).invoke(null, dataInputStream)
: ClassMapping.NBT_COMPRESSED_STREAM_TOOLS.getClazz()
.getMethod("a", DataInputStream.class).invoke(null, dataInputStream);
Object craftItemStack;
assert NMSItemStackClass != null; assert NMSItemStackClass != null;
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) {
craftItemStack = NMSItemStackClass.getMethod("a", NBTTagCompoundClass).invoke(null, NBTTagCompound); craftItemStack = NMSItemStackClass.getMethod("a", NBTTagCompoundClass).invoke(null, NBTTagCompound);
} else if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)) { } else if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_11)) {
craftItemStack = NMSItemStackClass.getConstructor(NBTTagCompoundClass).newInstance(NBTTagCompound); craftItemStack = NMSItemStackClass.getConstructor(NBTTagCompoundClass).newInstance(NBTTagCompound);
} else { } else {
craftItemStack = NMSItemStackClass.getMethod("createStack", NBTTagCompoundClass).invoke(null, craftItemStack = NMSItemStackClass.getMethod("createStack", NBTTagCompoundClass).invoke(null,
NBTTagCompound); NBTTagCompound);
}
itemStack = (ItemStack) NMSUtils.getCraftClass("inventory.CraftItemStack")
.getMethod("asBukkitCopy", NMSItemStackClass).invoke(null, craftItemStack);
// TODO: This method of serialization has some issues. Not all the names are the same between versions
// Make an exception for reeds/melon, they NEED to load in the island chest
// This code is here SPECIFICALLY to get the default.structure to load properly in all versions
// Other structures people make NEED to be saved from the version that they will be using so everything loads properly
if (itemStack.getType() == Material.AIR) {
if (NBTTagCompound.toString().equals("{id:\"minecraft:sugar_cane\",Count:1b}")) {
itemStack = XMaterial.SUGAR_CANE.parseItem();
} else if (NBTTagCompound.toString().equals("{id:\"minecraft:melon_slice\",Count:1b}")) {
itemStack = XMaterial.MELON_SLICE.parseItem();
} }
itemStack = (ItemStack) NMSUtils.getCraftClass("inventory.CraftItemStack")
.getMethod("asBukkitCopy", NMSItemStackClass).invoke(null, craftItemStack);
// TODO: This method of serialization has some issues. Not all the names are the same between versions
// Make an exception for reeds/melon, they NEED to load in the island chest
// This code is here SPECIFICALLY to get the default.structure to load properly in all versions
// Other structures people make NEED to be saved from the version that they will be using so everything loads properly
if (itemStack.getType() == Material.AIR) {
if (NBTTagCompound.toString().equals("{id:\"minecraft:sugar_cane\",Count:1b}")) {
itemStack = XMaterial.SUGAR_CANE.parseItem();
} else if (NBTTagCompound.toString().equals("{id:\"minecraft:melon_slice\",Count:1b}")) {
itemStack = XMaterial.MELON_SLICE.parseItem();
}
}
} catch (Exception ex) {
ex.printStackTrace();
} }
} catch (Exception ex) {
ex.printStackTrace();
} }
return itemStack; return itemStack;
} }
public static String serializeItemStack(ItemStack item) { public static String serializeItemStack(ItemStack item) {
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_20_5)) {
//We need net.minecraft.nbt.NbtIo class in this version
byte[] bytes = item.serializeAsBytes();
return new BigInteger(bytes).toString(32);
}
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
DataOutputStream dataOutput = new DataOutputStream(outputStream); DataOutputStream dataOutput = new DataOutputStream(outputStream);

View File

@ -1,5 +1,6 @@
package com.craftaro.skyblock.utils.structure; package com.craftaro.skyblock.utils.structure;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -20,7 +21,7 @@ public class SchematicUtil {
} }
Runnable pasteTask = () -> { Runnable pasteTask = () -> {
if (ServerVersion.isServerVersionAbove(ServerVersion.V1_12)) { // WorldEdit 7 if (MajorServerVersion.isServerVersionAbove(MajorServerVersion.V1_12)) { // WorldEdit 7
com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat format = com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats.findByFile(schematicFile); com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat format = com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats.findByFile(schematicFile);
try (com.sk89q.worldedit.extent.clipboard.io.ClipboardReader reader = format.getReader(Files.newInputStream(schematicFile.toPath()))) { try (com.sk89q.worldedit.extent.clipboard.io.ClipboardReader reader = format.getReader(Files.newInputStream(schematicFile.toPath()))) {
com.sk89q.worldedit.extent.clipboard.Clipboard clipboard = reader.read(); com.sk89q.worldedit.extent.clipboard.Clipboard clipboard = reader.read();

View File

@ -1,5 +1,6 @@
package com.craftaro.skyblock.utils.version; package com.craftaro.skyblock.utils.version;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import org.bukkit.Material; import org.bukkit.Material;
@ -197,7 +198,7 @@ public enum CompatibleSpawners {
} }
public static CompatibleSpawners getMaterials(Material material, byte data) { public static CompatibleSpawners getMaterials(Material material, byte data) {
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) {
return fromString(material.name()); return fromString(material.name());
} }

View File

@ -1,5 +1,6 @@
package com.craftaro.skyblock.utils.version; package com.craftaro.skyblock.utils.version;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.skyblock.utils.StringUtil; import com.craftaro.skyblock.utils.StringUtil;
@ -34,7 +35,7 @@ public enum SBiome {
THE_VOID("SKY", XMaterial.OBSIDIAN), THE_VOID("SKY", XMaterial.OBSIDIAN),
WARM_OCEAN(true, XMaterial.TROPICAL_FISH); WARM_OCEAN(true, XMaterial.TROPICAL_FISH);
private static final boolean isPostVersion = ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13); private static final boolean isPostVersion = MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13);
private final String legacyName; private final String legacyName;
private final boolean isPost13; private final boolean isPost13;

View File

@ -1,6 +1,7 @@
package com.craftaro.skyblock.utils.world; package com.craftaro.skyblock.utils.world;
import com.craftaro.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
@ -35,7 +36,7 @@ public final class LocationUtil {
Location tempLoc = LocationUtil.getDefinitiveLocation(loc.clone()); Location tempLoc = LocationUtil.getDefinitiveLocation(loc.clone());
if (tempLoc.getBlock().getType() == Material.WATER) { if (tempLoc.getBlock().getType() == Material.WATER) {
tempLoc.getBlock().setType(Material.AIR); tempLoc.getBlock().setType(Material.AIR);
} else if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { } else if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) {
LocationUtil113.removeWaterLoggedFromLocation(tempLoc); LocationUtil113.removeWaterLoggedFromLocation(tempLoc);
} }
} }
@ -72,7 +73,7 @@ public final class LocationUtil {
for (locWorking.setY(locWorking.getBlockY()); locWorking.getBlockY() >= 0; locWorking.setY(locWorking.getBlockY() - 1)) { for (locWorking.setY(locWorking.getBlockY()); locWorking.getBlockY() >= 0; locWorking.setY(locWorking.getBlockY() - 1)) {
if (!locWorking.getBlock().isEmpty()) { if (!locWorking.getBlock().isEmpty()) {
if (locWorking.getBlock().getType() == XMaterial.WATER.parseMaterial() || if (locWorking.getBlock().getType() == XMaterial.WATER.parseMaterial() ||
(ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13) && (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13) &&
locWorking.getBlock().getBlockData() instanceof org.bukkit.block.data.Waterlogged)) { locWorking.getBlock().getBlockData() instanceof org.bukkit.block.data.Waterlogged)) {
loc = locWorking; loc = locWorking;
} }
@ -90,7 +91,7 @@ public final class LocationUtil {
locChecked.getBlock().getType().isBlock() && locChecked.getBlock().getType().isBlock() &&
locChecked.add(0d, 1d, 0d).getBlock().getType() == XMaterial.AIR.parseMaterial() && locChecked.add(0d, 1d, 0d).getBlock().getType() == XMaterial.AIR.parseMaterial() &&
locChecked.add(0d, 2d, 0d).getBlock().getType() == XMaterial.AIR.parseMaterial() && locChecked.add(0d, 2d, 0d).getBlock().getType() == XMaterial.AIR.parseMaterial() &&
!(ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13) && locChecked.getBlock().getBlockData() instanceof org.bukkit.block.data.Waterlogged)) { !(MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13) && locChecked.getBlock().getBlockData() instanceof org.bukkit.block.data.Waterlogged)) {
safe = true; safe = true;
switch (CompatibleMaterial.getMaterial(locChecked.getBlock().getType()).orElse(XMaterial.AIR)) { switch (CompatibleMaterial.getMaterial(locChecked.getBlock().getType()).orElse(XMaterial.AIR)) {
case ACACIA_DOOR: // <= 1.8.8 case ACACIA_DOOR: // <= 1.8.8

View File

@ -1,6 +1,7 @@
package com.craftaro.skyblock.utils.world.block; package com.craftaro.skyblock.utils.world.block;
import com.craftaro.core.compatibility.ClassMapping; import com.craftaro.core.compatibility.ClassMapping;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.MethodMapping; import com.craftaro.core.compatibility.MethodMapping;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
@ -54,7 +55,7 @@ public final class BlockUtil extends BlockUtils {
blockData.setVersion(Integer.parseInt(ServerVersion.getVersionReleaseNumber())); blockData.setVersion(Integer.parseInt(ServerVersion.getVersionReleaseNumber()));
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) {
blockData.setBlockData(block.getBlockData().getAsString()); blockData.setBlockData(block.getBlockData().getAsString());
} }
@ -77,7 +78,7 @@ public final class BlockUtil extends BlockUtils {
blockData.setPotionEffect(primaryEffectName + ":" + secondaryEffectName); blockData.setPotionEffect(primaryEffectName + ":" + secondaryEffectName);
blockData.setStateType(BlockStateType.BEACON.toString()); blockData.setStateType(BlockStateType.BEACON.toString());
} else if (blockState instanceof BrewingStand && ServerVersion.isServerVersionAtLeast(ServerVersion.V1_12)) { } else if (blockState instanceof BrewingStand && MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_12)) {
BrewingStand brewingStand = (BrewingStand) blockState; BrewingStand brewingStand = (BrewingStand) blockState;
blockData.setBrewingTime(brewingStand.getBrewingTime()); blockData.setBrewingTime(brewingStand.getBrewingTime());
blockData.setFuelLevel(brewingStand.getFuelLevel()); blockData.setFuelLevel(brewingStand.getFuelLevel());
@ -191,7 +192,7 @@ public final class BlockUtil extends BlockUtils {
blockData.setRotateFace(skull.getRotation().toString()); blockData.setRotateFace(skull.getRotation().toString());
blockData.setStateType(BlockStateType.SKULL.toString()); blockData.setStateType(BlockStateType.SKULL.toString());
} else { } else {
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_9)) {
if (blockState instanceof EndGateway) { if (blockState instanceof EndGateway) {
EndGateway endGateway = (EndGateway) blockState; EndGateway endGateway = (EndGateway) blockState;
blockData.setExactTeleport(endGateway.isExactTeleport()); blockData.setExactTeleport(endGateway.isExactTeleport());
@ -201,7 +202,7 @@ public final class BlockUtil extends BlockUtils {
blockData.setStateType(BlockStateType.ENDGATEWAY.toString()); blockData.setStateType(BlockStateType.ENDGATEWAY.toString());
} }
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_11)) {
if (blockState instanceof ShulkerBox) { if (blockState instanceof ShulkerBox) {
ShulkerBox shulkerBox = (ShulkerBox) blockState; ShulkerBox shulkerBox = (ShulkerBox) blockState;
@ -217,7 +218,7 @@ public final class BlockUtil extends BlockUtils {
} }
} }
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_14)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_14)) {
if (blockState instanceof Barrel) { if (blockState instanceof Barrel) {
Barrel barrel = (Barrel) blockState; Barrel barrel = (Barrel) blockState;
@ -232,7 +233,7 @@ public final class BlockUtil extends BlockUtils {
blockData.setStateType(BlockStateType.BARREL.toString()); blockData.setStateType(BlockStateType.BARREL.toString());
} }
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_16)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_16)) {
if (blockState instanceof RespawnAnchor) { if (blockState instanceof RespawnAnchor) {
RespawnAnchor respawnAnchor = (RespawnAnchor) blockState; RespawnAnchor respawnAnchor = (RespawnAnchor) blockState;
blockData.setCharges(respawnAnchor.getCharges()); blockData.setCharges(respawnAnchor.getCharges());
@ -247,7 +248,7 @@ public final class BlockUtil extends BlockUtils {
blockData.setFacing(((Stairs) materialData).getFacing().toString()); blockData.setFacing(((Stairs) materialData).getFacing().toString());
blockData.setDataType(BlockDataType.STAIRS.toString()); blockData.setDataType(BlockDataType.STAIRS.toString());
} else if (materialData instanceof org.bukkit.material.FlowerPot) { } else if (materialData instanceof org.bukkit.material.FlowerPot) {
if (ServerVersion.isServerVersionAtOrBelow(ServerVersion.V1_12)) { if (MajorServerVersion.isServerVersionAtOrBelow(MajorServerVersion.V1_12)) {
try { try {
World world = block.getWorld(); World world = block.getWorld();
@ -301,7 +302,7 @@ public final class BlockUtil extends BlockUtils {
return; return;
} }
if (ServerVersion.isServerVersionAtOrBelow(ServerVersion.V1_12)) { if (MajorServerVersion.isServerVersionAtOrBelow(MajorServerVersion.V1_12)) {
setBlockFast(block.getWorld(), block.getX(), block.getY(), block.getZ(), material, blockData.getData()); setBlockFast(block.getWorld(), block.getX(), block.getY(), block.getZ(), material, blockData.getData());
} else { } else {
block.setBlockData(Bukkit.getServer().createBlockData(blockData.getBlockData())); block.setBlockData(Bukkit.getServer().createBlockData(blockData.getBlockData()));
@ -334,7 +335,7 @@ public final class BlockUtil extends BlockUtils {
beacon.setSecondaryEffect(PotionEffectType.getByName(potionEffect[1].toUpperCase())); beacon.setSecondaryEffect(PotionEffectType.getByName(potionEffect[1].toUpperCase()));
} }
state.update(); state.update();
} else if (blockTypeState == BlockStateType.BREWINGSTAND && ServerVersion.isServerVersionAtLeast(ServerVersion.V1_12)) { } else if (blockTypeState == BlockStateType.BREWINGSTAND && MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_12)) {
BrewingStand brewingStand = (BrewingStand) state; BrewingStand brewingStand = (BrewingStand) state;
brewingStand.setBrewingTime(blockData.getBrewingTime()); brewingStand.setBrewingTime(blockData.getBrewingTime());
brewingStand.setFuelLevel(blockData.getFuelLevel()); brewingStand.setFuelLevel(blockData.getFuelLevel());
@ -422,14 +423,14 @@ public final class BlockUtil extends BlockUtils {
skull.setRotation(BlockFace.valueOf(blockData.getRotateFace().toUpperCase())); skull.setRotation(BlockFace.valueOf(blockData.getRotateFace().toUpperCase()));
skull.setSkullType(SkullType.valueOf(blockData.getSkullType().toUpperCase())); skull.setSkullType(SkullType.valueOf(blockData.getSkullType().toUpperCase()));
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_10)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_10)) {
skull.setOwningPlayer(Bukkit.getServer().getOfflinePlayer(blockData.getSkullOwner())); skull.setOwningPlayer(Bukkit.getServer().getOfflinePlayer(blockData.getSkullOwner()));
} else { } else {
skull.setOwner(blockData.getSkullOwner()); skull.setOwner(blockData.getSkullOwner());
} }
state.update(); state.update();
} else { } else {
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_9)) {
if (blockTypeState == BlockStateType.ENDGATEWAY) { if (blockTypeState == BlockStateType.ENDGATEWAY) {
EndGateway endGateway = (EndGateway) state; EndGateway endGateway = (EndGateway) state;
endGateway.setExactTeleport(blockData.isExactTeleport()); endGateway.setExactTeleport(blockData.isExactTeleport());
@ -445,7 +446,7 @@ public final class BlockUtil extends BlockUtils {
state.update(); state.update();
} }
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_11)) {
if (blockTypeState == BlockStateType.SHULKERBOX) { if (blockTypeState == BlockStateType.SHULKERBOX) {
ShulkerBox shulkerBox = (ShulkerBox) state; ShulkerBox shulkerBox = (ShulkerBox) state;
@ -456,7 +457,7 @@ public final class BlockUtil extends BlockUtils {
} }
} }
} }
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_14)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_14)) {
if (blockTypeState == BlockStateType.BARREL) { if (blockTypeState == BlockStateType.BARREL) {
Barrel barrel = (Barrel) state; Barrel barrel = (Barrel) state;
@ -469,7 +470,7 @@ public final class BlockUtil extends BlockUtils {
} }
} }
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_16)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_16)) {
if (blockTypeState == BlockStateType.RESPAWN_ANCHOR) { if (blockTypeState == BlockStateType.RESPAWN_ANCHOR) {
RespawnAnchor respawnAnchor = (RespawnAnchor) state; RespawnAnchor respawnAnchor = (RespawnAnchor) state;
respawnAnchor.setCharges(blockData.getCharges()); respawnAnchor.setCharges(blockData.getCharges());
@ -488,7 +489,7 @@ public final class BlockUtil extends BlockUtils {
state.setData(stairs); state.setData(stairs);
} else if (blockDataType == BlockDataType.FLOWERPOT) { } else if (blockDataType == BlockDataType.FLOWERPOT) {
setBlockFast(block.getWorld(), block.getX(), block.getY() - 1, block.getZ(), XMaterial.STONE, (byte) 0); setBlockFast(block.getWorld(), block.getX(), block.getY() - 1, block.getZ(), XMaterial.STONE, (byte) 0);
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_8) && ServerVersion.isServerVersionAtOrBelow(ServerVersion.V1_12)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_8) && MajorServerVersion.isServerVersionAtOrBelow(MajorServerVersion.V1_12)) {
if (block.getLocation().clone().subtract(0.0D, 1.0D, 0.0D).getBlock().getType() == Material.AIR) { if (block.getLocation().clone().subtract(0.0D, 1.0D, 0.0D).getBlock().getType() == Material.AIR) {
setBlockFast(block.getWorld(), block.getX(), block.getY() - 1, block.getZ(), XMaterial.STONE, (byte) 0); setBlockFast(block.getWorld(), block.getX(), block.getY() - 1, block.getZ(), XMaterial.STONE, (byte) 0);
} }
@ -533,11 +534,11 @@ public final class BlockUtil extends BlockUtils {
materialStr = null; materialStr = null;
if (blockData.getVersion() > 12) { if (blockData.getVersion() > 12) {
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) {
materialStr = flower[0].toUpperCase(); materialStr = flower[0].toUpperCase();
} }
} else { } else {
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_13)) { if (MajorServerVersion.isServerVersionBelow(MajorServerVersion.V1_13)) {
materialStr = flower[0].toUpperCase(); materialStr = flower[0].toUpperCase();
} }
} }
@ -558,7 +559,7 @@ public final class BlockUtil extends BlockUtils {
if (bottomBlock.getType() == Material.AIR && !topBlock.getType().name().equals("DOUBLE_PLANT")) { if (bottomBlock.getType() == Material.AIR && !topBlock.getType().name().equals("DOUBLE_PLANT")) {
bottomBlock.setType(XMaterial.LARGE_FERN.parseMaterial()); bottomBlock.setType(XMaterial.LARGE_FERN.parseMaterial());
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_13)) { if (MajorServerVersion.isServerVersionBelow(MajorServerVersion.V1_13)) {
try { try {
bottomBlock.getClass().getMethod("setData", byte.class).invoke(bottomBlock, (byte) 2); bottomBlock.getClass().getMethod("setData", byte.class).invoke(bottomBlock, (byte) 2);
} catch (Exception ex) { } catch (Exception ex) {

View File

@ -1,6 +1,7 @@
package com.craftaro.skyblock.utils.world.entity; package com.craftaro.skyblock.utils.world.entity;
import com.craftaro.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.CompatibleMaterial;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.nms.Nms; import com.craftaro.core.nms.Nms;
import com.craftaro.skyblock.utils.item.ItemStackUtil; import com.craftaro.skyblock.utils.item.ItemStackUtil;
@ -119,8 +120,8 @@ public final class EntityUtil {
LivingEntity livingEntity = (LivingEntity) entity; LivingEntity livingEntity = (LivingEntity) entity;
EntityEquipment entityEquipment = livingEntity.getEquipment(); EntityEquipment entityEquipment = livingEntity.getEquipment();
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_9)) {
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_10)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_10)) {
livingEntity.setAI(entityData.hasAI()); livingEntity.setAI(entityData.hasAI());
} }
@ -175,7 +176,7 @@ public final class EntityUtil {
Material material = CompatibleMaterial.getMaterial(materialData[0].toUpperCase()).get().parseMaterial(); Material material = CompatibleMaterial.getMaterial(materialData[0].toUpperCase()).get().parseMaterial();
if (material != null) { if (material != null) {
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_13)) {
((Enderman) entity).setCarriedBlock(Bukkit.getServer().createBlockData(material)); ((Enderman) entity).setCarriedBlock(Bukkit.getServer().createBlockData(material));
} else { } else {
((Enderman) entity).setCarriedMaterial(new MaterialData(material, data)); ((Enderman) entity).setCarriedMaterial(new MaterialData(material, data));
@ -229,7 +230,7 @@ public final class EntityUtil {
villager.getInventory().setContents(items.toArray(new ItemStack[0])); villager.getInventory().setContents(items.toArray(new ItemStack[0]));
} }
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_11)) {
if (entity instanceof Llama) { if (entity instanceof Llama) {
Llama llama = ((Llama) entity); Llama llama = ((Llama) entity);
llama.setColor(Llama.Color.valueOf(entityData.getLlamaColor().toUpperCase())); llama.setColor(Llama.Color.valueOf(entityData.getLlamaColor().toUpperCase()));
@ -244,7 +245,7 @@ public final class EntityUtil {
llama.getInventory().setContents(items.toArray(new ItemStack[0])); llama.getInventory().setContents(items.toArray(new ItemStack[0]));
} }
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)) { if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_11)) {
if (entity instanceof Parrot) { if (entity instanceof Parrot) {
((Parrot) entity) ((Parrot) entity)
.setVariant(Parrot.Variant.valueOf(entityData.getParrotVariant().toUpperCase())); .setVariant(Parrot.Variant.valueOf(entityData.getParrotVariant().toUpperCase()));

View File

@ -1,6 +1,7 @@
package com.craftaro.skyblock.world.generator; package com.craftaro.skyblock.world.generator;
import com.craftaro.core.compatibility.CompatibleBiome; import com.craftaro.core.compatibility.CompatibleBiome;
import com.craftaro.core.compatibility.MajorServerVersion;
import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.SkyBlock;
@ -56,7 +57,7 @@ public class VoidGenerator extends ChunkGenerator {
throw new IllegalStateException("Unexpected value: " + world.getEnvironment()); throw new IllegalStateException("Unexpected value: " + world.getEnvironment());
} }
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_16)) { // TODO Should be 1.15 but it works fine there if (MajorServerVersion.isServerVersionAtLeast(MajorServerVersion.V1_16)) { // TODO Should be 1.15 but it works fine there
setChunkBiome3D(biome, biomeGrid, world); setChunkBiome3D(biome, biomeGrid, world);
} else { } else {
setChunkBiome2D(biome, biomeGrid); setChunkBiome2D(biome, biomeGrid);

View File

@ -19,7 +19,6 @@ softdepend:
- WorldEdit - WorldEdit
loadbefore: loadbefore:
- Multiverse-Core - Multiverse-Core
- ProtocolLib
author: Craftaro author: Craftaro
authors: [ Fabrimat ] authors: [ Fabrimat ]

File diff suppressed because one or more lines are too long