9
0
mirror of https://gitlab.com/SamB440/rpgregions-2.git synced 2025-12-29 19:59:11 +00:00

Remove usage of XMaterial, shadow apache commons

This commit is contained in:
SamB440
2021-07-09 18:53:25 +01:00
parent d660c008ca
commit e9120be874
11 changed files with 50 additions and 2119 deletions

View File

@@ -1,6 +1,6 @@
package net.islandearth.rpgregions.editor.annotate;
import net.islandearth.rpgregions.utils.XMaterial;
import org.bukkit.Material;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -15,7 +15,7 @@ import java.lang.annotation.Target;
@Deprecated
public @interface EditableField {
XMaterial material() default XMaterial.OAK_SIGN;
Material material() default Material.OAK_SIGN;
String name();

View File

@@ -2,8 +2,8 @@ package net.islandearth.rpgregions.editor.field;
import net.islandearth.rpgregions.editor.annotate.EditableField;
import net.islandearth.rpgregions.managers.data.region.ConfiguredRegion;
import net.islandearth.rpgregions.utils.XMaterial;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
@@ -16,7 +16,7 @@ public class EditField {
private final ConfiguredRegion clazz;
private final Field field;
private final XMaterial material;
private final Material material;
private final String name;
private final String description;
@@ -34,7 +34,7 @@ public class EditField {
return field;
}
public XMaterial getMaterial() {
public Material getMaterial() {
return material;
}

View File

@@ -11,11 +11,11 @@ import net.islandearth.rpgregions.regenerate.Regenerate;
import net.islandearth.rpgregions.requirements.RegionRequirement;
import net.islandearth.rpgregions.rewards.DiscoveryReward;
import net.islandearth.rpgregions.translation.Translations;
import net.islandearth.rpgregions.utils.XMaterial;
import net.islandearth.rpgregions.utils.XSound;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.World;
import org.bukkit.entity.Player;
@@ -41,7 +41,7 @@ public class ConfiguredRegion {
private final UUID world;
private final String id;
@EditableField(material = XMaterial.NAME_TAG, name = "Set name", description = "Set the display name of the region")
@EditableField(material = Material.NAME_TAG, name = "Set name", description = "Set the display name of the region")
private String customName;
private final List<DiscoveryReward> rewards;
private Sound sound;
@@ -50,7 +50,7 @@ public class ConfiguredRegion {
private final List<IconCommand> iconCommand;
@EditableField(description = "Toggle whether the coordinates of the region are shown", name = "Toggle coordinates")
private final boolean showCoords;
@EditableField(material = XMaterial.ENDER_PEARL, name = "Set teleport location", description = "Set the teleport location to your current location")
@EditableField(material = Material.ENDER_PEARL, name = "Set teleport location", description = "Set the teleport location to your current location")
private Location location;
private final List<String> hints;
@EditableField(description = "Toggle whether the hint is shown", name = "Toggle hint")
@@ -71,10 +71,10 @@ public class ConfiguredRegion {
private List<String> discoveredTitle;
private List<String> discoveredSubtitle;
private Regenerate regenerate;
@EditableField(material = XMaterial.NETHER_STAR, name = "Set teleport cooldown", description = "Set the cooldown for teleportation")
@EditableField(material = Material.NETHER_STAR, name = "Set teleport cooldown", description = "Set the cooldown for teleportation")
private int teleportCooldown;
private boolean showActionbar;
@EditableField(material = XMaterial.RED_DYE, name = "Hex display colour", description = "Set the colour of the region. It is a hex colour (e.g 0x42f4f1 for red) and is used in dynmap.")
@EditableField(material = Material.RED_DYE, name = "Hex display colour", description = "Set the colour of the region. It is a hex colour (e.g 0x42f4f1 for red) and is used in dynmap.")
private final String colour;
private final String lineColour;
private final boolean dynmap;
@@ -86,9 +86,9 @@ public class ConfiguredRegion {
this.customName = customName;
this.rewards = rewards;
this.sound = XSound.UI_TOAST_CHALLENGE_COMPLETE.parseSound();
Optional<XMaterial> defaultIcon = XMaterial.matchXMaterial(RPGRegionsAPI.getAPI().getConfig().getString("settings.server.gui.default_region_icon"));
this.icon = defaultIcon.map(Enum::name).orElseGet(XMaterial.TOTEM_OF_UNDYING::name);
this.undiscoveredIcon = defaultIcon.map(Enum::name).orElseGet(XMaterial.TOTEM_OF_UNDYING::name);
Optional<Material> defaultIcon = Optional.of(Material.valueOf(RPGRegionsAPI.getAPI().getConfig().getString("settings.server.gui.default_region_icon")));
this.icon = defaultIcon.map(Enum::name).orElseGet(Material.TOTEM_OF_UNDYING::name);
this.undiscoveredIcon = defaultIcon.map(Enum::name).orElseGet(Material.TOTEM_OF_UNDYING::name);
this.iconCommand = new ArrayList<>();
this.showCoords = false;
this.hints = new ArrayList<>();
@@ -108,7 +108,7 @@ public class ConfiguredRegion {
}
public ConfiguredRegion(@Nullable World world, String id, String customName,
List<DiscoveryReward> rewards, List<RegionEffect> effects, Sound sound, XMaterial icon) {
List<DiscoveryReward> rewards, List<RegionEffect> effects, Sound sound, Material icon) {
this(world, id, customName, rewards, effects);
this.sound = sound;
this.icon = icon.name();
@@ -138,23 +138,23 @@ public class ConfiguredRegion {
@Nullable
public ItemStack getIcon() {
if (icon == null) return new ItemStack(XMaterial.TOTEM_OF_UNDYING.parseMaterial(true));
if (icon == null) return new ItemStack(Material.TOTEM_OF_UNDYING);
if (icon.startsWith("hdb-") && RPGRegionsAPI.getAPI().hasHeadDatabase()) return new ItemStack(new HeadDatabaseAPI().getItemHead(icon.replace("hdb-", "")));
return XMaterial.valueOf(icon).parseItem(true);
return new ItemStack(Material.valueOf(icon));
}
public void setIcon(@NotNull XMaterial material) {
public void setIcon(@NotNull Material material) {
this.icon = material.name();
}
@Nullable
public ItemStack getUndiscoveredIcon() {
if (undiscoveredIcon == null) return new ItemStack(XMaterial.TOTEM_OF_UNDYING.parseMaterial(true));
if (undiscoveredIcon == null) return new ItemStack(Material.TOTEM_OF_UNDYING);
if (undiscoveredIcon.startsWith("hdb-") && RPGRegionsAPI.getAPI().hasHeadDatabase()) return new ItemStack(new HeadDatabaseAPI().getItemHead(undiscoveredIcon.replace("hdb-", "")));
return XMaterial.valueOf(undiscoveredIcon).parseItem(true);
return new ItemStack(Material.valueOf(undiscoveredIcon));
}
public void setUndiscoveredIcon(@NotNull XMaterial material) {
public void setUndiscoveredIcon(@NotNull Material material) {
this.undiscoveredIcon = material.name();
}