diff --git a/README.md b/README.md
index 15490c0..8c5a1cf 100644
--- a/README.md
+++ b/README.md
@@ -35,8 +35,7 @@ and more! While still being lightweight and efficient.
## Supports
-* 1.7.\*, 1.8.\*, 1.9.\*, 1.10.\*, 1.11.\*, 1.12.\*, 1.13.\*, 1.14.\*, 1.15.\*, 1.16.\*, 1.17.\*, 1.18.\*, 1.19.\*,
- 1.20.\*
+* 1.18.\*, 1.19.\*, 1.20.\*
* Spigot, Paper, Purpur, Airplane, Pufferfish, Tuinity, CraftBukkit, CatServer, Mohist, Magma, MultiPaper
* GeyserMC (Bedrock Players)
* Forge/Bukkit Hybrid servers (Mohist, Magma, CatServer)
diff --git a/pom.xml b/pom.xml
index 6aea973..cf1dda4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,18 +23,19 @@
0.0.0-SNAPSHOT
- 1.8
+ 17
UTF-8
clean package
${project.name}-${project.version}
+ e:/minecraft/server/plugins
org.apache.maven.plugins
maven-compiler-plugin
- 3.8.1
+ 3.11.0
${java.version}
${java.version}
@@ -184,7 +185,7 @@
org.spigotmc
spigot-api
- 1.20.4-R0.1-SNAPSHOT
+ 1.18-R0.1-SNAPSHOT
provided
diff --git a/src/main/java/org/avarion/graves/Graves.java b/src/main/java/org/avarion/graves/Graves.java
index 03f82cd..3bcf587 100644
--- a/src/main/java/org/avarion/graves/Graves.java
+++ b/src/main/java/org/avarion/graves/Graves.java
@@ -5,7 +5,6 @@
import org.avarion.graves.command.GraveyardsCommand;
import org.avarion.graves.compatibility.Compatibility;
import org.avarion.graves.compatibility.CompatibilityBlockData;
-import org.avarion.graves.compatibility.CompatibilityMaterialData;
import org.avarion.graves.listener.*;
import org.avarion.graves.manager.*;
import org.avarion.graves.type.Grave;
@@ -223,14 +222,8 @@ public void registerListeners() {
getServer().getPluginManager().registerEvents(new InventoryCloseListener(this), this);
getServer().getPluginManager().registerEvents(new InventoryOpenListener(this), this);
getServer().getPluginManager().registerEvents(new CreatureSpawnListener(this), this);
-
- if (!versionManager.is_v1_7()) {
- getServer().getPluginManager().registerEvents(new PlayerInteractAtEntityListener(this), this);
- }
-
- if (!versionManager.is_v1_7() && !versionManager.is_v1_8()) {
- getServer().getPluginManager().registerEvents(new BlockExplodeListener(this), this);
- }
+ getServer().getPluginManager().registerEvents(new PlayerInteractAtEntityListener(this), this);
+ getServer().getPluginManager().registerEvents(new BlockExplodeListener(this), this);
//getServer().getPluginManager().registerEvents(new GraveTestListener(this), this); // Test Listener
}
@@ -240,7 +233,7 @@ public void unregisterListeners() {
}
private void registerRecipes() {
- if (versionManager.hasPersistentData() && !versionManager.isMohist()) {
+ if (!versionManager.isMohist) {
recipeManager = new RecipeManager(this);
}
}
@@ -387,19 +380,13 @@ private void updateChecker() {
}
private void compatibilityChecker() {
- compatibility = versionManager.hasBlockData() ? new CompatibilityBlockData() : new CompatibilityMaterialData();
-
- if (!versionManager.hasBlockData()) {
- infoMessage("Legacy version detected, Graves will run but may have problems with material names, "
- + "the default config is setup for the latest version of the game, you can alter the config manually to fix "
- + "any issues you encounter, you will need to find the names of materials and sounds for your version.");
- }
+ compatibility = new CompatibilityBlockData();
- if (versionManager.isBukkit()) {
+ if (versionManager.isBukkit) {
infoMessage("Bukkit detected, some functions won't work on Bukkit, like hex codes.");
}
- if (versionManager.isMohist()) {
+ if (versionManager.isMohist) {
infoMessage("Mohist detected, not injecting custom recipes.");
}
}
@@ -528,9 +515,7 @@ public ConfigurationSection getConfig(String config, EntityType entityType, List
if (getConfig().isConfigurationSection(section)) {
ConfigurationSection configurationSection = getConfig().getConfigurationSection(section);
- if (configurationSection != null && (versionManager.hasConfigContains()
- ? configurationSection.contains(config, true)
- : configurationSection.contains(config))) {
+ if (configurationSection != null && configurationSection.contains(config, true)) {
return configurationSection;
}
}
@@ -543,9 +528,7 @@ public ConfigurationSection getConfig(String config, EntityType entityType, List
if (getConfig().isConfigurationSection(section)) {
ConfigurationSection configurationSection = getConfig().getConfigurationSection(section);
- if (configurationSection != null && (versionManager.hasConfigContains()
- ? configurationSection.contains(config, true)
- : configurationSection.contains(config))) {
+ if (configurationSection != null && configurationSection.contains(config, true)) {
return configurationSection;
}
}
diff --git a/src/main/java/org/avarion/graves/compatibility/CompatibilityMaterialData.java b/src/main/java/org/avarion/graves/compatibility/CompatibilityMaterialData.java
deleted file mode 100644
index a1679c1..0000000
--- a/src/main/java/org/avarion/graves/compatibility/CompatibilityMaterialData.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package org.avarion.graves.compatibility;
-
-import org.avarion.graves.Graves;
-import org.avarion.graves.data.BlockData;
-import org.avarion.graves.type.Grave;
-import org.avarion.graves.util.BlockFaceUtil;
-import org.avarion.graves.util.SkinUtil;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.block.BlockState;
-import org.bukkit.block.Skull;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.Player;
-import org.bukkit.event.block.BlockPlaceEvent;
-import org.bukkit.inventory.EquipmentSlot;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.SkullMeta;
-import org.bukkit.material.Openable;
-
-public final class CompatibilityMaterialData implements Compatibility {
-
- @Override
- public BlockData setBlockData(Location location, Material material, Grave grave, Graves plugin) {
- if (material != null) {
- Block block = location.getBlock();
- String replaceMaterial = location.getBlock().getType().name();
-
- // Air
- if (block.getType().name().equals("NETHER_PORTAL") || block.getState().getData() instanceof Openable) {
- replaceMaterial = null;
- }
-
- // Set type
- location.getBlock().setType(material);
-
- // Update skull
- if (material.name().equals("SKULL") && block.getState() instanceof Skull) {
- updateSkullBlock(block, grave, plugin);
- }
-
- return new BlockData(location, grave.getUUID(), replaceMaterial, null);
- }
-
- return new BlockData(location, grave.getUUID(), null, null);
- }
-
- @Override
- public boolean canBuild(Player player, Location location, Graves plugin) {
- BlockPlaceEvent blockPlaceEvent = new BlockPlaceEvent(location.getBlock(), location.getBlock()
- .getState(), location.getBlock(), player.getInventory()
- .getItemInMainHand(), player, true, EquipmentSlot.HAND);
-
- plugin.getServer().getPluginManager().callEvent(blockPlaceEvent);
-
- return blockPlaceEvent.canBuild() && !blockPlaceEvent.isCancelled();
- }
-
- @SuppressWarnings("ConstantConditions")
- @Override
- public boolean hasTitleData(Block block) {
- return block.getState() instanceof BlockState;
- }
-
- private void updateSkullBlock(Block block, Grave grave, Graves plugin) {
- int headType = plugin.getConfig("block.head.type", grave).getInt("block.head.type");
- String headBase64 = plugin.getConfig("block.head.base64", grave).getString("block.head.base64");
- String headName = plugin.getConfig("block.head.name", grave).getString("block.head.name");
- Skull skull = (Skull) block.getState();
-
- block.setType(Material.PLAYER_HEAD);
- skull.setRotation(BlockFaceUtil.getYawBlockFace(grave.getYaw()).getOppositeFace());
-
- if (headType == 0) {
- if (grave.getOwnerType() == EntityType.PLAYER) {
- skull.setOwner(grave.getOwnerName());
- }
- else {
- if (!plugin.getVersionManager().is_v1_7()) {
- SkinUtil.setSkullBlockTexture(skull, grave.getOwnerName(), headBase64);
- }
- else {
- skull.setOwner(grave.getOwnerName());
- }
- }
- }
- else if (headType == 1 && headBase64 != null && !headBase64.equals("")) {
- if (!plugin.getVersionManager().is_v1_7()) {
- SkinUtil.setSkullBlockTexture(skull, grave.getOwnerName(), headBase64);
- }
- else {
- skull.setOwner(grave.getOwnerName());
- }
- }
- else if (headType == 2 && headName != null && headName.length() <= 16) {
- skull.setOwner(headName);
- }
-
- skull.update();
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public ItemStack getSkullItemStack(Grave grave, Graves plugin) {
- Material material = Material.matchMaterial("SKULL_ITEM");
-
- if (material != null) {
- ItemStack itemStack = new ItemStack(material, 1, (short) 3);
-
- if (itemStack.getItemMeta() != null) {
- if (grave.getOwnerType() == EntityType.PLAYER) {
- SkullMeta skullMeta = (SkullMeta) itemStack.getItemMeta();
-
- skullMeta.setOwner(grave.getOwnerName());
- itemStack.setItemMeta(skullMeta);
- }
- else {
- // TODO ENTITY
- }
- }
-
- return itemStack;
- }
-
- return null;
- }
-
- @Override
- public String getSkullTexture(ItemStack itemStack) {
- Material material = Material.matchMaterial("SKULL_ITEM");
-
- if (material != null && itemStack.getType() == material) {
- return getSkullMetaData(itemStack);
- }
-
- return null;
- }
-
-}
diff --git a/src/main/java/org/avarion/graves/integration/ItemBridge.java b/src/main/java/org/avarion/graves/integration/ItemBridge.java
index df46dd2..ef5cf47 100644
--- a/src/main/java/org/avarion/graves/integration/ItemBridge.java
+++ b/src/main/java/org/avarion/graves/integration/ItemBridge.java
@@ -39,7 +39,7 @@ public ItemBridgeListenerPriority getPriority() {
public ItemStack fetchItemStack(@NotNull String string) {
string = string.toLowerCase();
- if (plugin.getVersionManager().hasPersistentData() && string.startsWith("token_")) {
+ if (string.startsWith("token_")) {
string = string.replaceFirst("token_", "");
return plugin.getConfig().isSet("settings.token." + string)
@@ -52,7 +52,7 @@ public ItemStack fetchItemStack(@NotNull String string) {
@Override
public String getItemName(@NotNull ItemStack itemStack) {
- if (plugin.getVersionManager().hasPersistentData() && plugin.getRecipeManager().isToken(itemStack)) {
+ if (plugin.getRecipeManager().isToken(itemStack)) {
return plugin.getRecipeManager().getTokenName(itemStack);
}
diff --git a/src/main/java/org/avarion/graves/integration/PlayerNPC.java b/src/main/java/org/avarion/graves/integration/PlayerNPC.java
index 0e1646c..f0da228 100644
--- a/src/main/java/org/avarion/graves/integration/PlayerNPC.java
+++ b/src/main/java/org/avarion/graves/integration/PlayerNPC.java
@@ -137,8 +137,7 @@ public void createCorpse(UUID uuid, Location location, Grave grave, boolean crea
npc.setItemInRightHand(grave.getEquipmentMap().get(EquipmentSlot.HAND));
}
- if (plugin.getVersionManager().hasSecondHand() && grave.getEquipmentMap()
- .containsKey(EquipmentSlot.OFF_HAND)) {
+ if (grave.getEquipmentMap().containsKey(EquipmentSlot.OFF_HAND)) {
npc.setItemInLeftHand(grave.getEquipmentMap().get(EquipmentSlot.OFF_HAND));
}
}
diff --git a/src/main/java/org/avarion/graves/listener/EntityDamageByEntityListener.java b/src/main/java/org/avarion/graves/listener/EntityDamageByEntityListener.java
index bebde43..872260a 100644
--- a/src/main/java/org/avarion/graves/listener/EntityDamageByEntityListener.java
+++ b/src/main/java/org/avarion/graves/listener/EntityDamageByEntityListener.java
@@ -21,7 +21,7 @@ public EntityDamageByEntityListener(Graves plugin) {
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
Entity entity = event.getEntity();
- if (entity instanceof ItemFrame || (plugin.getVersionManager().is_v1_7() || entity instanceof ArmorStand)) {
+ if (entity instanceof ItemFrame || entity instanceof ArmorStand) {
event.setCancelled(plugin.getEntityDataManager().getGrave(entity) != null);
}
}
diff --git a/src/main/java/org/avarion/graves/listener/EntityDeathListener.java b/src/main/java/org/avarion/graves/listener/EntityDeathListener.java
index 13bdd02..7d9c6e8 100644
--- a/src/main/java/org/avarion/graves/listener/EntityDeathListener.java
+++ b/src/main/java/org/avarion/graves/listener/EntityDeathListener.java
@@ -242,8 +242,7 @@ else if (!plugin.getLocationManager().canBuild(livingEntity, location, permissio
}
// Token
- if (plugin.getVersionManager().hasPersistentData()
- && plugin.getConfig("token.enabled", livingEntity, permissionList).getBoolean("token.enabled")) {
+ if (plugin.getConfig("token.enabled", livingEntity, permissionList).getBoolean("token.enabled")) {
String name = plugin.getConfig("token.name", livingEntity).getString("token.name", "basic");
if (plugin.getConfig().isConfigurationSection("settings.token." + name)) {
@@ -314,10 +313,8 @@ else if (plugin.getConfig("compass.ignore", livingEntity, permissionList)
grave.setTimeAlive(plugin.getConfig("grave.time", grave).getInt("grave.time") * 1000L);
// Skin
- if (!plugin.getVersionManager().is_v1_7()) {
- grave.setOwnerTexture(SkinUtil.getTexture(livingEntity));
- grave.setOwnerTextureSignature(SkinUtil.getSignature(livingEntity));
- }
+ grave.setOwnerTexture(SkinUtil.getTexture(livingEntity));
+ grave.setOwnerTextureSignature(SkinUtil.getSignature(livingEntity));
// Experience
float experiencePercent = (float) plugin.getConfig("experience.store", grave).getDouble("experience.store");
@@ -448,10 +445,7 @@ else if (livingEntity.getLastDamageCause() != null) {
.getGraveInventory(grave, livingEntity, graveItemStackList, removedItemStackList, permissionList));
// Equipment
- grave.setEquipmentMap(!plugin.getVersionManager().is_v1_7()
- ? plugin.getEntityManager()
- .getEquipmentMap(livingEntity, grave)
- : new HashMap<>());
+ grave.setEquipmentMap(plugin.getEntityManager().getEquipmentMap(livingEntity, grave));
// Placeable
locationMap.entrySet()
diff --git a/src/main/java/org/avarion/graves/listener/PlayerInteractAtEntityListener.java b/src/main/java/org/avarion/graves/listener/PlayerInteractAtEntityListener.java
index 9944de6..adf6286 100644
--- a/src/main/java/org/avarion/graves/listener/PlayerInteractAtEntityListener.java
+++ b/src/main/java/org/avarion/graves/listener/PlayerInteractAtEntityListener.java
@@ -24,9 +24,9 @@ public PlayerInteractAtEntityListener(Graves plugin) {
public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent event) {
Player player = event.getPlayer();
- if ((!plugin.getVersionManager().hasSecondHand() || event.getHand() == EquipmentSlot.HAND)
+ if (event.getHand() == EquipmentSlot.HAND
&& event.getRightClicked() instanceof ArmorStand
- && (plugin.getVersionManager().is_v1_7() || player.getGameMode() != GameMode.SPECTATOR)) {
+ && player.getGameMode() != GameMode.SPECTATOR) {
Entity entity = event.getRightClicked();
Grave grave = plugin.getEntityDataManager().getGrave(entity);
diff --git a/src/main/java/org/avarion/graves/listener/PlayerInteractEntityListener.java b/src/main/java/org/avarion/graves/listener/PlayerInteractEntityListener.java
index 28fd879..b0d7b8e 100644
--- a/src/main/java/org/avarion/graves/listener/PlayerInteractEntityListener.java
+++ b/src/main/java/org/avarion/graves/listener/PlayerInteractEntityListener.java
@@ -24,9 +24,9 @@ public PlayerInteractEntityListener(Graves plugin) {
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
Player player = event.getPlayer();
- if ((!plugin.getVersionManager().hasSecondHand() || event.getHand() == EquipmentSlot.HAND)
+ if (event.getHand() == EquipmentSlot.HAND
&& event.getRightClicked() instanceof ItemFrame
- && (plugin.getVersionManager().is_v1_7() || player.getGameMode() != GameMode.SPECTATOR)) {
+ && player.getGameMode() != GameMode.SPECTATOR) {
Entity entity = event.getRightClicked();
Grave grave = plugin.getEntityDataManager().getGrave(entity);
diff --git a/src/main/java/org/avarion/graves/listener/PlayerInteractListener.java b/src/main/java/org/avarion/graves/listener/PlayerInteractListener.java
index 717457c..f2d034a 100644
--- a/src/main/java/org/avarion/graves/listener/PlayerInteractListener.java
+++ b/src/main/java/org/avarion/graves/listener/PlayerInteractListener.java
@@ -33,9 +33,9 @@ public PlayerInteractListener(Graves plugin) {
public void onPlayerInteract(@NotNull PlayerInteractEvent event) {
Player player = event.getPlayer();
- if ((!plugin.getVersionManager().hasSecondHand() || (event.getHand() != null
- && event.getHand() == EquipmentSlot.HAND))
- && (plugin.getVersionManager().is_v1_7() || player.getGameMode() != GameMode.SPECTATOR)) {
+ if (event.getHand() != null
+ && event.getHand() == EquipmentSlot.HAND
+ && player.getGameMode() != GameMode.SPECTATOR) {
// Grave
if (event.getClickedBlock() != null
&& event.useInteractedBlock() != Event.Result.DENY
diff --git a/src/main/java/org/avarion/graves/listener/PlayerMoveListener.java b/src/main/java/org/avarion/graves/listener/PlayerMoveListener.java
index d342a56..f83e8b5 100644
--- a/src/main/java/org/avarion/graves/listener/PlayerMoveListener.java
+++ b/src/main/java/org/avarion/graves/listener/PlayerMoveListener.java
@@ -26,7 +26,7 @@ public PlayerMoveListener(Graves plugin) {
public void onPlayerMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
- if (plugin.getVersionManager().is_v1_7() || player.getGameMode() != GameMode.SPECTATOR) {
+ if (player.getGameMode() != GameMode.SPECTATOR) {
if (event.getTo() != null && (event.getTo().getBlockX() != event.getFrom().getBlockX()
|| event.getTo().getBlockY() != event.getFrom().getBlockY()
|| event.getTo().getBlockZ() != event.getFrom().getBlockZ())) {
diff --git a/src/main/java/org/avarion/graves/listener/PlayerRespawnListener.java b/src/main/java/org/avarion/graves/listener/PlayerRespawnListener.java
index 552a68b..b84a9f5 100644
--- a/src/main/java/org/avarion/graves/listener/PlayerRespawnListener.java
+++ b/src/main/java/org/avarion/graves/listener/PlayerRespawnListener.java
@@ -35,8 +35,7 @@ public void onPlayerRespawn(PlayerRespawnEvent event) {
.getString("respawn.function", "none"), grave);
}, 1L);
- if (plugin.getVersionManager().hasCompassMeta()
- && plugin.getConfig("respawn.compass", player, permissionList).getBoolean("respawn.compass")
+ if (plugin.getConfig("respawn.compass", player, permissionList).getBoolean("respawn.compass")
&& grave.getLivedTime()
<= plugin.getConfig("respawn.compass-time", player, permissionList).getInt("respawn.compass-time")
* 1000L) {
diff --git a/src/main/java/org/avarion/graves/manager/BlockManager.java b/src/main/java/org/avarion/graves/manager/BlockManager.java
index f5b464c..7fd21ec 100644
--- a/src/main/java/org/avarion/graves/manager/BlockManager.java
+++ b/src/main/java/org/avarion/graves/manager/BlockManager.java
@@ -50,10 +50,6 @@ public void createBlock(Location location, Grave grave) {
if (plugin.getConfig("block.enabled", grave).getBoolean("block.enabled")) {
String materialString = plugin.getConfig("block.material", grave).getString("block.material", "CHEST");
- if (materialString.equals("PLAYER_HEAD") && !plugin.getVersionManager().hasBlockData()) {
- materialString = "SKULL";
- }
-
material = Material.matchMaterial(materialString);
}
else {
diff --git a/src/main/java/org/avarion/graves/manager/EntityManager.java b/src/main/java/org/avarion/graves/manager/EntityManager.java
index e844b89..09b95c7 100644
--- a/src/main/java/org/avarion/graves/manager/EntityManager.java
+++ b/src/main/java/org/avarion/graves/manager/EntityManager.java
@@ -21,6 +21,7 @@
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.util.NumberConversions;
+import java.lang.reflect.Method;
import java.util.*;
public final class EntityManager extends EntityDataManager {
@@ -34,16 +35,11 @@ public EntityManager(Graves plugin) {
}
public void swingMainHand(Player player) {
- if (plugin.getVersionManager().hasSwingHand()) {
- player.swingMainHand();
- }
- else {
- ReflectionUtil.swingMainHand(player);
- }
+ player.swingMainHand();
}
public ItemStack createGraveCompass(Player player, Location location, Grave grave) {
- if (plugin.getVersionManager().hasPersistentData()) {
+ if (true) {
Material material = Material.COMPASS;
if (plugin.getConfig("compass.recovery", grave).getBoolean("compass.recovery")) {
@@ -58,7 +54,7 @@ public ItemStack createGraveCompass(Player player, Location location, Grave grav
ItemMeta itemMeta = itemStack.getItemMeta();
if (itemMeta != null) {
- if (plugin.getVersionManager().hasCompassMeta() && itemMeta instanceof CompassMeta) {
+ if (itemMeta instanceof CompassMeta) {
CompassMeta compassMeta = (CompassMeta) itemMeta;
compassMeta.setLodestoneTracked(false);
@@ -66,9 +62,10 @@ public ItemStack createGraveCompass(Player player, Location location, Grave grav
}
else if (itemStack.getType().name().equals("RECOVERY_COMPASS")) {
try {
- player.setLastDeathLocation(location);
- }
- catch (NoSuchMethodError ignored) {
+ // Not known in 1.18 yet...
+ Method setLastDeathLocationMethod = player.getClass().getMethod("setLastDeathLocation", Location.class);
+ setLastDeathLocationMethod.invoke(player, location); }
+ catch (Exception ignored) {
}
}
@@ -107,7 +104,7 @@ else if (itemStack.getType().name().equals("RECOVERY_COMPASS")) {
public Map getCompassesFromInventory(HumanEntity player) {
Map itemStackUUIDMap = new HashMap<>();
- if (plugin.getVersionManager().hasPersistentData()) {
+ if (true) {
for (ItemStack itemStack : player.getInventory().getContents()) {
UUID uuid = getGraveUUIDFromItemStack(itemStack);
@@ -121,7 +118,7 @@ public Map getCompassesFromInventory(HumanEntity player) {
}
public UUID getGraveUUIDFromItemStack(ItemStack itemStack) {
- if (plugin.getVersionManager().hasPersistentData() && itemStack != null && itemStack.getItemMeta() != null) {
+ if (itemStack != null && itemStack.getItemMeta() != null) {
if (itemStack.getItemMeta()
.getPersistentDataContainer()
.has(new NamespacedKey(plugin, "graveUUID"), PersistentDataType.STRING)) {
@@ -379,8 +376,7 @@ private void runConsoleCommand(String string) {
plugin.getServer().getPluginManager().callEvent(serverCommandEvent);
- if ((plugin.getVersionManager().is_v1_7() || plugin.getVersionManager().is_v1_8())
- || !serverCommandEvent.isCancelled()) {
+ if (!serverCommandEvent.isCancelled()) {
plugin.getServer()
.getScheduler()
.callSyncMethod(plugin, () -> plugin.getServer()
@@ -615,8 +611,7 @@ private void spawnZombie(Location location, LivingEntity targetEntity, Grave gra
}
public void createArmorStand(Location location, Grave grave) {
- if (!plugin.getVersionManager().is_v1_7() && plugin.getConfig("armor-stand.enabled", grave)
- .getBoolean("armor-stand.enabled")) {
+ if (plugin.getConfig("armor-stand.enabled", grave).getBoolean("armor-stand.enabled")) {
double offsetX = plugin.getConfig("armor-stand.offset.x", grave).getDouble("armor-stand.offset.x");
double offsetY = plugin.getConfig("armor-stand.offset.y", grave).getDouble("armor-stand.offset.y");
double offsetZ = plugin.getConfig("armor-stand.offset.z", grave).getDouble("armor-stand.offset.z");
@@ -648,7 +643,7 @@ public void createArmorStand(Location location, Grave grave) {
createEntityData(location, armorStand.getUniqueId(), grave.getUUID(), EntityData.Type.ARMOR_STAND);
- if (!plugin.getVersionManager().is_v1_7()) {
+ if (true) {
try {
armorStand.setMarker(marker);
}
@@ -656,11 +651,11 @@ public void createArmorStand(Location location, Grave grave) {
}
}
- if (!plugin.getVersionManager().is_v1_7() && !plugin.getVersionManager().is_v1_8()) {
+ if (true) {
armorStand.setInvulnerable(true);
}
- if (plugin.getVersionManager().hasScoreboardTags()) {
+ if (true) {
armorStand.getScoreboardTags().add("graveArmorStand");
armorStand.getScoreboardTags().add("graveArmorStandUUID:" + grave.getUUID());
}
@@ -726,11 +721,11 @@ public void createItemFrame(Location location, Grave grave) {
itemFrame.setCustomNameVisible(false);
itemFrame.setItem(itemStack);
- if (!plugin.getVersionManager().is_v1_7() && !plugin.getVersionManager().is_v1_8()) {
+ if (true) {
itemFrame.setInvulnerable(true);
}
- if (plugin.getVersionManager().hasScoreboardTags()) {
+ if (true) {
itemFrame.getScoreboardTags().add("graveItemFrame");
itemFrame.getScoreboardTags().add("graveItemFrameUUID:" + grave.getUUID());
}
@@ -784,7 +779,7 @@ public Map getEquipmentMap(LivingEntity livingEntity,
equipmentSlotItemStackMap.put(EquipmentSlot.FEET, entityEquipment.getBoots());
}
- if (plugin.getVersionManager().hasSecondHand()) {
+ if (true) {
if (entityEquipment.getItemInMainHand().getType() != Material.AIR && grave.getInventory()
.contains(entityEquipment.getItemInMainHand())) {
equipmentSlotItemStackMap.put(EquipmentSlot.HAND, entityEquipment.getItemInMainHand());
@@ -812,7 +807,7 @@ public String getEntityName(Entity entity) {
if (entity instanceof Player) {
return entity.getName(); // Need redundancy for legacy support
}
- else if (!plugin.getVersionManager().is_v1_7()) {
+ else if (true) {
return entity.getName();
}
@@ -823,22 +818,15 @@ else if (!plugin.getVersionManager().is_v1_7()) {
}
public boolean hasDataString(Entity entity, String string) {
- return plugin.getVersionManager().hasPersistentData()
- ? entity.getPersistentDataContainer()
- .has(new NamespacedKey(plugin, string), PersistentDataType.STRING)
- : entity.hasMetadata(string);
+ return entity.getPersistentDataContainer().has(new NamespacedKey(plugin, string), PersistentDataType.STRING);
}
public boolean hasDataByte(Entity entity, String string) {
- return plugin.getVersionManager().hasPersistentData()
- ? entity.getPersistentDataContainer()
- .has(new NamespacedKey(plugin, string), PersistentDataType.BYTE)
- : entity.hasMetadata(string);
+ return entity.getPersistentDataContainer().has(new NamespacedKey(plugin, string), PersistentDataType.BYTE);
}
public String getDataString(Entity entity, String key) {
- if (plugin.getVersionManager().hasPersistentData() && entity.getPersistentDataContainer()
- .has(new NamespacedKey(plugin, key), PersistentDataType.STRING)) {
+ if (entity.getPersistentDataContainer().has(new NamespacedKey(plugin, key), PersistentDataType.STRING)) {
return entity.getPersistentDataContainer().get(new NamespacedKey(plugin, key), PersistentDataType.STRING);
}
else {
@@ -847,7 +835,7 @@ public String getDataString(Entity entity, String key) {
}
public void setDataString(Entity entity, String key, String string) {
- if (plugin.getVersionManager().hasPersistentData()) {
+ if (true) {
entity.getPersistentDataContainer().set(new NamespacedKey(plugin, key), PersistentDataType.STRING, string);
}
else {
@@ -856,7 +844,7 @@ public void setDataString(Entity entity, String key, String string) {
}
public void setDataByte(Entity entity, String key) {
- if (plugin.getVersionManager().hasPersistentData()) {
+ if (true) {
entity.getPersistentDataContainer().set(new NamespacedKey(plugin, key), PersistentDataType.BYTE, (byte) 1);
}
else {
@@ -865,8 +853,8 @@ public void setDataByte(Entity entity, String key) {
}
public Grave getGraveFromEntityData(Entity entity) {
- if (plugin.getVersionManager().hasPersistentData() && entity.getPersistentDataContainer()
- .has(new NamespacedKey(plugin, "graveUUID"), PersistentDataType.STRING)) {
+ if (entity.getPersistentDataContainer()
+ .has(new NamespacedKey(plugin, "graveUUID"), PersistentDataType.STRING)) {
return plugin.getCacheManager()
.getGraveMap()
.get(UUIDUtil.getUUID(entity.getPersistentDataContainer()
diff --git a/src/main/java/org/avarion/graves/manager/GraveManager.java b/src/main/java/org/avarion/graves/manager/GraveManager.java
index 269fe99..5a65c06 100644
--- a/src/main/java/org/avarion/graves/manager/GraveManager.java
+++ b/src/main/java/org/avarion/graves/manager/GraveManager.java
@@ -169,9 +169,7 @@ public void toggleGraveProtection(Grave grave) {
}
public void graveParticle(Location location, Grave grave) {
- if (plugin.getVersionManager().hasParticle()
- && location.getWorld() != null
- && plugin.getConfig("particle.enabled", grave).getBoolean("particle.enabled")) {
+ if (location.getWorld() != null && plugin.getConfig("particle.enabled", grave).getBoolean("particle.enabled")) {
Particle particle = Particle.REDSTONE;
String particleType = plugin.getConfig("particle.type", grave).getString("particle.type");
@@ -368,6 +366,9 @@ public Inventory getGraveInventory(Grave grave, LivingEntity livingEntity, List<
}
public Inventory createGraveInventory(InventoryHolder inventoryHolder, Location location, List itemStackList, String title, Grave.StorageMode storageMode) {
+ itemStackList.removeIf(itemStack -> itemStack != null
+ && itemStack.containsEnchantment(Enchantment.VANISHING_CURSE));
+
if (storageMode == Grave.StorageMode.COMPACT || storageMode == Grave.StorageMode.CHESTSORT) {
Inventory tempInventory = plugin.getServer().createInventory(null, 54);
int counter = 0;
@@ -407,12 +408,8 @@ else if (itemStack != null && location != null && location.getWorld() != null) {
return inventory;
}
- else if (storageMode == Grave.StorageMode.EXACT) {
- if (plugin.getVersionManager().hasEnchantmentCurse()) {
- itemStackList.removeIf(itemStack -> itemStack != null
- && itemStack.containsEnchantment(Enchantment.VANISHING_CURSE));
- }
+ if (storageMode == Grave.StorageMode.EXACT) {
ItemStack itemStackAir = new ItemStack(Material.AIR);
Inventory inventory = plugin.getServer()
.createInventory(inventoryHolder, InventoryUtil.getInventorySize(itemStackList.size()), title);
diff --git a/src/main/java/org/avarion/graves/manager/HologramManager.java b/src/main/java/org/avarion/graves/manager/HologramManager.java
index a991dde..b0ddfbf 100644
--- a/src/main/java/org/avarion/graves/manager/HologramManager.java
+++ b/src/main/java/org/avarion/graves/manager/HologramManager.java
@@ -23,8 +23,7 @@ public HologramManager(Graves plugin) {
}
public void createHologram(Location location, Grave grave) {
- if (!plugin.getVersionManager().is_v1_7() && plugin.getConfig("hologram.enabled", grave)
- .getBoolean("hologram.enabled")) {
+ if (plugin.getConfig("hologram.enabled", grave).getBoolean("hologram.enabled")) {
double offsetX = plugin.getConfig("hologram.offset.x", grave).getDouble("hologram.offset.x");
double offsetY = plugin.getConfig("hologram.offset.y", grave).getDouble("hologram.offset.y");
double offsetZ = plugin.getConfig("hologram.offset.z", grave).getDouble("hologram.offset.z");
@@ -49,22 +48,15 @@ public void createHologram(Location location, Grave grave) {
armorStand.setSmall(true);
armorStand.setCustomName(StringUtil.parseString(line, location, grave, plugin));
- if (!plugin.getVersionManager().is_v1_7()) {
- try {
- armorStand.setMarker(marker);
- }
- catch (NoSuchMethodError ignored) {
- }
+ try {
+ armorStand.setMarker(marker);
}
-
- if (!plugin.getVersionManager().is_v1_7() && !plugin.getVersionManager().is_v1_8()) {
- armorStand.setInvulnerable(true);
+ catch (NoSuchMethodError ignored) {
}
- if (plugin.getVersionManager().hasScoreboardTags()) {
- armorStand.getScoreboardTags().add("graveHologram");
- armorStand.getScoreboardTags().add("graveHologramGraveUUID:" + grave.getUUID());
- }
+ armorStand.setInvulnerable(true);
+ armorStand.getScoreboardTags().add("graveHologram");
+ armorStand.getScoreboardTags().add("graveHologramGraveUUID:" + grave.getUUID());
HologramData hologramData = new HologramData(location, armorStand.getUniqueId(), grave.getUUID(), lineNumber);
diff --git a/src/main/java/org/avarion/graves/manager/ItemStackManager.java b/src/main/java/org/avarion/graves/manager/ItemStackManager.java
index 46c5ee4..1a30d4c 100644
--- a/src/main/java/org/avarion/graves/manager/ItemStackManager.java
+++ b/src/main/java/org/avarion/graves/manager/ItemStackManager.java
@@ -48,17 +48,10 @@ public ItemStack getGraveObituary(Grave grave) {
if (plugin.getConfig("obituary.glow", grave).getBoolean("obituary.glow")) {
bookMeta.addEnchant(Enchantment.DURABILITY, 1, true);
- if (!plugin.getVersionManager().is_v1_7()) {
- bookMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
- }
- }
-
- if (!plugin.getVersionManager().is_v1_7()
- && !plugin.getVersionManager().is_v1_8()
- && !plugin.getVersionManager().is_v1_9()) {
- bookMeta.setGeneration(null);
+ bookMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
}
+ bookMeta.setGeneration(null);
bookMeta.setPages(String.join("\n", lineList));
bookMeta.setLore(loreList);
bookMeta.setTitle(ChatColor.WHITE + StringUtil.parseString(plugin.getConfig("obituary.title", grave)
@@ -103,10 +96,6 @@ public ItemStack createGraveListItemStack(int number, Grave grave) {
if (plugin.getConfig("gui.menu.list.item.block", grave).getBoolean("gui.menu.list.item.block")) {
String materialString = plugin.getConfig("block.material", grave).getString("block.material", "CHEST");
- if (materialString.equals("PLAYER_HEAD") && !plugin.getVersionManager().hasBlockData()) {
- materialString = "SKULL_ITEM";
- }
-
material = Material.matchMaterial(materialString);
}
else {
diff --git a/src/main/java/org/avarion/graves/manager/LocationManager.java b/src/main/java/org/avarion/graves/manager/LocationManager.java
index d613a4e..058440b 100644
--- a/src/main/java/org/avarion/graves/manager/LocationManager.java
+++ b/src/main/java/org/avarion/graves/manager/LocationManager.java
@@ -266,12 +266,7 @@ public boolean hasGrave(Location location) {
}
public boolean isInsideBorder(Location location) {
- return plugin.getVersionManager().is_v1_7()
- || plugin.getVersionManager().is_v1_8()
- || plugin.getVersionManager().is_v1_9()
- || plugin.getVersionManager().is_v1_10()
- || plugin.getVersionManager().is_v1_11()
- || (location.getWorld() != null && location.getWorld().getWorldBorder().isInside(location));
+ return (location.getWorld() != null && location.getWorld().getWorldBorder().isInside(location));
}
public boolean isVoid(Location location) {
@@ -280,8 +275,7 @@ public boolean isVoid(Location location) {
}
public int getMinHeight(Location location) {
- return location.getWorld() != null && plugin.getVersionManager().hasMinHeight() ? location.getWorld()
- .getMinHeight() : 0;
+ return location.getWorld() != null ? location.getWorld().getMinHeight() : 0;
}
}
diff --git a/src/main/java/org/avarion/graves/manager/RecipeManager.java b/src/main/java/org/avarion/graves/manager/RecipeManager.java
index 3573871..d0465ae 100644
--- a/src/main/java/org/avarion/graves/manager/RecipeManager.java
+++ b/src/main/java/org/avarion/graves/manager/RecipeManager.java
@@ -183,57 +183,45 @@ public ItemStack getGraveTokenFromPlayer(String token, List itemStack
}
public void setRecipeData(String token, ItemStack itemStack) {
- if (plugin.getVersionManager().hasPersistentData()) {
- ItemMeta itemMeta = itemStack.getItemMeta();
+ ItemMeta itemMeta = itemStack.getItemMeta();
- if (itemMeta != null) {
- itemMeta.getPersistentDataContainer()
- .set(new NamespacedKey(plugin, "token"), PersistentDataType.STRING, token);
- itemStack.setItemMeta(itemMeta);
- }
+ if (itemMeta != null) {
+ itemMeta.getPersistentDataContainer()
+ .set(new NamespacedKey(plugin, "token"), PersistentDataType.STRING, token);
+ itemStack.setItemMeta(itemMeta);
}
}
public boolean isToken(String token, ItemStack itemStack) {
- if (plugin.getVersionManager().hasPersistentData()) {
- if (itemStack.getItemMeta() != null && itemStack.getItemMeta()
- .getPersistentDataContainer()
- .has(new NamespacedKey(plugin, "token"), PersistentDataType.STRING)) {
- String string = itemStack.getItemMeta()
- .getPersistentDataContainer()
- .get(new NamespacedKey(plugin, "token"), PersistentDataType.STRING);
-
- return string != null && string.equals(token);
- }
- }
- else {
- // TODO
- return false;
+ if (itemStack.getItemMeta() != null && itemStack.getItemMeta()
+ .getPersistentDataContainer()
+ .has(new NamespacedKey(plugin, "token"), PersistentDataType.STRING)) {
+ String string = itemStack.getItemMeta()
+ .getPersistentDataContainer()
+ .get(new NamespacedKey(plugin, "token"), PersistentDataType.STRING);
+
+ return string != null && string.equals(token);
}
return false;
}
public String getTokenName(ItemStack itemStack) {
- if (plugin.getVersionManager().hasPersistentData()) {
- if (itemStack.getItemMeta() != null && itemStack.getItemMeta()
- .getPersistentDataContainer()
- .has(new NamespacedKey(plugin, "token"), PersistentDataType.STRING)) {
- return itemStack.getItemMeta()
- .getPersistentDataContainer()
- .get(new NamespacedKey(plugin, "token"), PersistentDataType.STRING);
- }
+ if (itemStack.getItemMeta() != null && itemStack.getItemMeta()
+ .getPersistentDataContainer()
+ .has(new NamespacedKey(plugin, "token"), PersistentDataType.STRING)) {
+ return itemStack.getItemMeta()
+ .getPersistentDataContainer()
+ .get(new NamespacedKey(plugin, "token"), PersistentDataType.STRING);
}
return null;
}
public boolean isToken(ItemStack itemStack) {
- return plugin.getVersionManager().hasPersistentData()
- && itemStack.getItemMeta() != null
- && itemStack.getItemMeta()
- .getPersistentDataContainer()
- .has(new NamespacedKey(plugin, "token"), PersistentDataType.STRING);
+ return itemStack.getItemMeta() != null && itemStack.getItemMeta()
+ .getPersistentDataContainer()
+ .has(new NamespacedKey(plugin, "token"), PersistentDataType.STRING);
}
private char getChar(int count) {
diff --git a/src/main/java/org/avarion/graves/manager/VersionManager.java b/src/main/java/org/avarion/graves/manager/VersionManager.java
index 1279c28..6694a9c 100644
--- a/src/main/java/org/avarion/graves/manager/VersionManager.java
+++ b/src/main/java/org/avarion/graves/manager/VersionManager.java
@@ -1,211 +1,33 @@
package org.avarion.graves.manager;
public final class VersionManager {
- private final String version;
- private final boolean hasConfigContains;
- private final boolean hasAPIVersion;
- private final boolean hasBlockData;
- private final boolean hasPersistentData;
- private final boolean hasScoreboardTags;
- private final boolean hasHexColors;
- private final boolean hasCompassMeta;
- private final boolean hasSwingHand;
- private final boolean hasWorldHeight;
- private final boolean hasSecondHand;
- private final boolean hasEnchantmentCurse;
- private final boolean hasParticle;
- private boolean isBukkit;
- private boolean isMohist;
+ public final String version;
+ public final boolean hasHexColors;
+ public final boolean isBukkit;
+ public final boolean isMohist;
public VersionManager() {
+ boolean isMohist = false;
+ boolean isBukkit = false;
this.version = BukkitVersion.getVersion();
- this.hasConfigContains = !is_v1_7() && !is_v1_8() && !is_v1_9();
- this.hasAPIVersion = !is_v1_7() && !is_v1_8() && !is_v1_9() && !is_v1_10() && !is_v1_11() && !is_v1_12();
- this.hasBlockData = !is_v1_7() && !is_v1_8() && !is_v1_9() && !is_v1_10() && !is_v1_11() && !is_v1_12();
- this.hasPersistentData = !is_v1_7()
- && !is_v1_8()
- && !is_v1_9()
- && !is_v1_10()
- && !is_v1_11()
- && !is_v1_12()
- && !is_v1_13();
- this.hasScoreboardTags = !is_v1_7() && !is_v1_8() && !is_v1_9() && !is_v1_10();
- this.hasHexColors = !is_v1_7()
- && !is_v1_8()
- && !is_v1_9()
- && !is_v1_10()
- && !is_v1_11()
- && !is_v1_12()
- && !is_v1_13()
- && !is_v1_14()
- && !is_v1_15()
- && !isBukkit();
- this.hasCompassMeta = !is_v1_7()
- && !is_v1_8()
- && !is_v1_9()
- && !is_v1_10()
- && !is_v1_11()
- && !is_v1_12()
- && !is_v1_13()
- && !is_v1_14()
- && !is_v1_15()
- && !version.matches("(?i)v1_16_R1|");
- this.hasSwingHand = !is_v1_7()
- && !is_v1_8()
- && !is_v1_9()
- && !is_v1_10()
- && !is_v1_11()
- && !is_v1_12()
- && !is_v1_13()
- && !is_v1_14()
- && !is_v1_15();
- this.hasWorldHeight = !is_v1_7()
- && !is_v1_8()
- && !is_v1_9()
- && !is_v1_10()
- && !is_v1_11()
- && !is_v1_12()
- && !is_v1_13()
- && !is_v1_14()
- && !is_v1_15()
- && !is_v1_16();
- this.hasSecondHand = !is_v1_7() && !is_v1_8();
- this.hasEnchantmentCurse = !is_v1_7() && !is_v1_8() && !is_v1_9() && !is_v1_10();
- this.hasParticle = !is_v1_7() && !is_v1_8();
try {
Class.forName("org.spigotmc.SpigotConfig", false, getClass().getClassLoader());
-
- this.isBukkit = false;
}
catch (ClassNotFoundException ignored) {
- this.isBukkit = true;
+ isBukkit = true;
}
try {
Class.forName("com.mohistmc.config.MohistConfigUtil", false, getClass().getClassLoader());
- this.isMohist = true;
+ isMohist = true;
}
catch (ClassNotFoundException ignored) {
- this.isBukkit = false;
}
- }
-
- public boolean isBukkit() {
- return isBukkit;
- }
-
- public boolean isMohist() {
- return isMohist;
- }
-
- public boolean hasConfigContains() {
- return hasConfigContains;
- }
-
- public boolean hasAPIVersion() {
- return hasAPIVersion;
- }
-
- public boolean hasBlockData() {
- return hasBlockData;
- }
-
- public boolean hasPersistentData() {
- return hasPersistentData;
- }
-
- public boolean hasScoreboardTags() {
- return hasScoreboardTags;
- }
-
- public boolean hasHexColors() {
- return hasHexColors;
- }
-
- public boolean hasCompassMeta() {
- return hasCompassMeta;
- }
-
- public boolean hasSwingHand() {
- return hasSwingHand;
- }
-
- public boolean hasMinHeight() {
- return hasWorldHeight;
- }
-
- @SuppressWarnings("BooleanMethodIsAlwaysInverted")
- public boolean hasSecondHand() {
- return hasSecondHand;
- }
-
- public boolean hasEnchantmentCurse() {
- return hasEnchantmentCurse;
- }
-
- public boolean hasParticle() {
- return hasParticle;
- }
-
- @SuppressWarnings("BooleanMethodIsAlwaysInverted")
- public boolean is_v1_7() {
- return version.matches("(?i)v1_7_R1|v1_7_R2|v1_7_R3|v1_7_R4");
- }
-
- @SuppressWarnings("BooleanMethodIsAlwaysInverted")
- public boolean is_v1_8() {
- return version.matches("(?i)v1_8_R1|v1_8_R2|v1_8_R3");
- }
-
- @SuppressWarnings("BooleanMethodIsAlwaysInverted")
- public boolean is_v1_9() {
- return version.matches("(?i)v1_9_R1|v1_9_R2");
- }
-
- @SuppressWarnings("BooleanMethodIsAlwaysInverted")
- public boolean is_v1_10() {
- return version.matches("(?i)v1_10_R1");
- }
-
- @SuppressWarnings("BooleanMethodIsAlwaysInverted")
- public boolean is_v1_11() {
- return version.matches("(?i)v1_11_R1");
- }
-
- @SuppressWarnings("BooleanMethodIsAlwaysInverted")
- public boolean is_v1_12() {
- return version.matches("(?i)v1_12_R1");
- }
-
- @SuppressWarnings("BooleanMethodIsAlwaysInverted")
- public boolean is_v1_13() {
- return version.matches("(?i)v1_13_R1|v1_13_R2");
- }
-
- @SuppressWarnings("BooleanMethodIsAlwaysInverted")
- public boolean is_v1_14() {
- return version.matches("(?i)v1_14_R1");
- }
-
- @SuppressWarnings("BooleanMethodIsAlwaysInverted")
- public boolean is_v1_15() {
- return version.matches("(?i)v1_15_R1");
- }
-
- @SuppressWarnings("BooleanMethodIsAlwaysInverted")
- public boolean is_v1_16() {
- return version.matches("(?i)v1_16_R1|v1_16_R2|v1_16_R3");
- }
-
- @SuppressWarnings("BooleanMethodIsAlwaysInverted")
- public boolean is_v1_17() {
- return version.matches("(?i)v1_17_R1");
- }
- @SuppressWarnings("BooleanMethodIsAlwaysInverted")
- public boolean is_v1_18() {
- return version.matches("(?i)v1_18_R1|v1_18_R2");
+ this.isMohist = isMohist;
+ this.isBukkit = isBukkit;
+ this.hasHexColors = !isBukkit;
}
}
diff --git a/src/main/java/org/avarion/graves/util/ServerUtil.java b/src/main/java/org/avarion/graves/util/ServerUtil.java
index 56fe425..e8ae642 100644
--- a/src/main/java/org/avarion/graves/util/ServerUtil.java
+++ b/src/main/java/org/avarion/graves/util/ServerUtil.java
@@ -30,12 +30,7 @@ public static String getServerDumpInfo(Graves plugin) {
.map(Plugin::getName)
.collect(Collectors.joining(", ")));
stringList.add(plugin.getDescription().getName() + " Version: " + plugin.getDescription().getVersion());
-
- if (plugin.getVersionManager().hasAPIVersion()) {
- stringList.add(plugin.getDescription().getName() + " API Version: " + plugin.getDescription()
- .getAPIVersion());
- }
-
+ stringList.add(plugin.getDescription().getName() + " API Version: " + plugin.getDescription().getAPIVersion());
stringList.add(plugin.getDescription().getName() + " Config Version: " + plugin.getConfig()
.getInt("config-version"));
stringList.add(plugin.getDescription().getName() + " Config Base64: " + Base64.getEncoder()
diff --git a/src/main/java/org/avarion/graves/util/StringUtil.java b/src/main/java/org/avarion/graves/util/StringUtil.java
index 42b02cb..52132e3 100644
--- a/src/main/java/org/avarion/graves/util/StringUtil.java
+++ b/src/main/java/org/avarion/graves/util/StringUtil.java
@@ -17,6 +17,7 @@
import java.util.regex.Pattern;
public final class StringUtil {
+ private static final Pattern hexColorPattern = Pattern.compile("[a-fA-F0-9]{6}");
public static String format(String string) {
return capitalizeFully(string.replace("_", " "));
@@ -147,16 +148,15 @@ public static String parseString(String string, Entity entity, String name, Loca
string = plugin.getIntegrationManager().getMineDown().parseString(string);
}
- Pattern pattern = Pattern.compile("[a-fA-f0-9]{6}");
- Matcher matcher = pattern.matcher(string);
+ Matcher matcher = hexColorPattern.matcher(string);
while (matcher.find()) {
String colorHex = string.substring(matcher.start() + 1, matcher.end());
- string = plugin.getVersionManager().hasHexColors()
+ string = plugin.getVersionManager().hasHexColors
? string.replace("&" + colorHex, ChatColor.of(colorHex)
.toString())
: string.replace(colorHex, "");
- matcher = pattern.matcher(string);
+ matcher = hexColorPattern.matcher(string);
}
if (plugin.getIntegrationManager().hasMiniMessage()) {
diff --git a/src/main/resources/config/config.yml b/src/main/resources/config/config.yml
index d15d116..efe440b 100644
--- a/src/main/resources/config/config.yml
+++ b/src/main/resources/config/config.yml
@@ -29,7 +29,6 @@ settings:
# Debug information, debug level 2 can be useful in finding out why a Grave does not spawn on your server.
debug:
admin: # UUID or name of admins to send debug information to. https://mcuuid.net/
- - "12345678-9123-4567-8912-345678912345"
level: 0 # 0 = Nothing, 1 = Information, 2 = Failures
#########
diff --git a/src/main/resources/config/grave.yml b/src/main/resources/config/grave.yml
index f848d64..741f444 100644
--- a/src/main/resources/config/grave.yml
+++ b/src/main/resources/config/grave.yml
@@ -129,7 +129,7 @@ settings:
###########
# How the items are saved in graves, compact mode stacks all items and puts them into a small as possible inventory. exact mode matches the players inventory exactly.
storage:
- mode: COMPACT # Storage mode: COMPACT, EXACT, CHESTSORT (Requires ChestSort).
+ mode: EXACT # Storage mode: COMPACT, EXACT, CHESTSORT (Requires ChestSort).
##############
# Experience #
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 8fe111c..8d33fa2 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -2,7 +2,7 @@ name: ${project.name}
description: ${project.description}
version: ${project.version}
main: org.avarion.graves.Graves
-api-version: 1.20.4
+api-version: 1.18
author: Ranull, svaningelgem
load: POSTWORLD