diff --git a/src/main/java/us/mytheria/bloblib/BlobLib.java b/src/main/java/us/mytheria/bloblib/BlobLib.java index d83b3be6..4c324442 100644 --- a/src/main/java/us/mytheria/bloblib/BlobLib.java +++ b/src/main/java/us/mytheria/bloblib/BlobLib.java @@ -1,20 +1,20 @@ package us.mytheria.bloblib; import org.bukkit.Bukkit; +import org.bukkit.World; import org.bukkit.plugin.java.JavaPlugin; +import org.jetbrains.annotations.NotNull; import us.mytheria.bloblib.command.BlobLibCmd; import us.mytheria.bloblib.disguises.DisguiseManager; import us.mytheria.bloblib.enginehub.EngineHubManager; import us.mytheria.bloblib.entities.DataAssetType; +import us.mytheria.bloblib.entities.area.WorldGuardArea; import us.mytheria.bloblib.entities.logger.BlobPluginLogger; import us.mytheria.bloblib.entities.positionable.Positionable; import us.mytheria.bloblib.entities.positionable.PositionableReader; import us.mytheria.bloblib.entities.tag.TagSet; import us.mytheria.bloblib.entities.tag.TagSetReader; -import us.mytheria.bloblib.entities.translatable.BlobTranslatablePositionable; -import us.mytheria.bloblib.entities.translatable.TranslatableItem; -import us.mytheria.bloblib.entities.translatable.TranslatablePositionable; -import us.mytheria.bloblib.entities.translatable.TranslatableReader; +import us.mytheria.bloblib.entities.translatable.*; import us.mytheria.bloblib.exception.ConfigurationFieldException; import us.mytheria.bloblib.hologram.HologramManager; import us.mytheria.bloblib.managers.*; @@ -59,6 +59,7 @@ public class BlobLib extends JavaPlugin { private LocalizableDataAssetManager translatableItemManager; private LocalizableDataAssetManager translatablePositionableManager; + private LocalizableDataAssetManager translatableAreaManager; private DataAssetManager tagSetManager; private MinecraftVersion running; @@ -103,6 +104,7 @@ public void onEnable() { colorManager = new ColorManager(); fileManager = new BlobLibFileManager(); fileManager.unpackYamlFile("/BlobInventory", "CurrencyBuilder", false); + engineHubManager = EngineHubManager.getInstance(); inventoryManager = new InventoryManager(); inventoryTrackerManager = new InventoryTrackerManager(); @@ -128,12 +130,26 @@ public void onEnable() { }, DataAssetType.TRANSLATABLE_POSITIONABLE, section -> section.isDouble("X") && section.isDouble("Y") && section.isDouble("Z")); + translatableAreaManager = LocalizableDataAssetManager + .of(fileManager.getDirectory(DataAssetType.TRANSLATABLE_AREA), + (section, locale, key) -> { + if (!engineHubManager.isWorldGuardInstalled()) { + getLogger().severe("WorldGuard is not installed, failed to load Area: " + key); + return null; + } + String worldName = section.getString("World"); + @NotNull World world = SerializationLib.deserializeWorld(worldName); + String id = section.getString("Id"); + String display = section.getString("Display"); + return BlobTranslatableArea.of(key, locale, display, WorldGuardArea.of(world, id)); + }, + DataAssetType.TRANSLATABLE_AREA, + section -> section.isString("World") && section.isString("Id")); messageManager = new MessageManager(); actionManager = new ActionManager(); soundManager = new SoundManager(); fillerManager = new FillerManager(); vaultManager = new VaultManager(); - engineHubManager = new EngineHubManager(); disguiseManager = new DisguiseManager(); hologramManager = new HologramManager(); chatManager = new ChatListenerManager(); @@ -244,6 +260,10 @@ public LocalizableDataAssetManager getTranslatablePosi return translatablePositionableManager; } + public LocalizableDataAssetManager getTranslatableAreaManager() { + return translatableAreaManager; + } + public DataAssetManager getTagSetManager() { return tagSetManager; } diff --git a/src/main/java/us/mytheria/bloblib/api/BlobLibTranslatableAPI.java b/src/main/java/us/mytheria/bloblib/api/BlobLibTranslatableAPI.java index e4b30730..872beee6 100644 --- a/src/main/java/us/mytheria/bloblib/api/BlobLibTranslatableAPI.java +++ b/src/main/java/us/mytheria/bloblib/api/BlobLibTranslatableAPI.java @@ -4,10 +4,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import us.mytheria.bloblib.BlobLib; -import us.mytheria.bloblib.entities.translatable.TranslatableBlock; -import us.mytheria.bloblib.entities.translatable.TranslatableItem; -import us.mytheria.bloblib.entities.translatable.TranslatablePositionable; -import us.mytheria.bloblib.entities.translatable.TranslatableSnippet; +import us.mytheria.bloblib.entities.translatable.*; import us.mytheria.bloblib.managers.BlobLibConfigManager; import us.mytheria.bloblib.managers.TranslatableManager; @@ -198,7 +195,7 @@ public TranslatablePositionable getTranslatablePositionable(@NotNull String key) * * @param key The key of the translatable * @param player The player to get the locale from - * @return The TranslatableItem + * @return The TranslatablePositionable */ @Nullable public TranslatablePositionable getTranslatablePositionable(@NotNull String key, @@ -218,6 +215,55 @@ public List getTranslatablePositionables(@NotNull Stri return plugin.getTranslatablePositionableManager().getAssets(locale); } + /** + * Will get a TranslatableArea by its key and locale. + * + * @param key The key of the translatable + * @param locale The locale of the translatable + * @return The TranslatableArea + */ + @Nullable + public TranslatableArea getTranslatableArea(@NotNull String key, + @NotNull String locale) { + return plugin.getTranslatableAreaManager().getAsset(key, locale); + } + + /** + * Will get a TranslatableArea by its key and the default locale. + * + * @param key The key of the translatable + * @return The TranslatableArea + */ + @Nullable + public TranslatableArea getTranslatableArea(@NotNull String key) { + return plugin.getTranslatableAreaManager().getAsset(key); + } + + /** + * Will get a TranslatableArea by its key and the player's locale. + * + * @param key The key of the translatable + * @param player The player to get the locale from + * @return The TranslatableArea + */ + @Nullable + public TranslatableArea getTranslatableArea(@NotNull String key, + @NotNull Player player) { + Objects.requireNonNull(player); + return plugin.getTranslatableAreaManager().getAsset(key, player.getLocale()); + } + + /** + * Get all the TranslatableAreas by their key. + * + * @param locale The locale for the TranslatableAreas + * @return The list of TranslatableArea + */ + @NotNull + public List getTranslatableAreas(@NotNull String locale) { + return plugin.getTranslatableAreaManager().getAssets(locale); + } + /** * Will get the real locale from the locale. * diff --git a/src/main/java/us/mytheria/bloblib/disguises/DisguiseManager.java b/src/main/java/us/mytheria/bloblib/disguises/DisguiseManager.java index 958eb2b3..23fe40bb 100644 --- a/src/main/java/us/mytheria/bloblib/disguises/DisguiseManager.java +++ b/src/main/java/us/mytheria/bloblib/disguises/DisguiseManager.java @@ -14,6 +14,8 @@ public DisguiseManager() { * Should not be run by plugins, only by BlobLib */ public void load() { + if (loaded) + return; if (Bukkit.getPluginManager().getPlugin("LibsDisguises") != null) { updateDisguiser(new LibsDisguises()); } else { @@ -25,7 +27,7 @@ public void load() { private void updateDisguiser(Disguiser disguiser) { this.disguiser = disguiser; } - + public Disguiser getDisguiser() { if (!loaded) throw new IllegalStateException("DisguiseManager loads after world load!"); diff --git a/src/main/java/us/mytheria/bloblib/enginehub/EngineHubAPI.java b/src/main/java/us/mytheria/bloblib/enginehub/EngineHubAPI.java deleted file mode 100644 index a3509fea..00000000 --- a/src/main/java/us/mytheria/bloblib/enginehub/EngineHubAPI.java +++ /dev/null @@ -1,70 +0,0 @@ -package us.mytheria.bloblib.enginehub; - -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.function.pattern.Pattern; -import com.sk89q.worldedit.math.BlockVector2; -import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.world.World; -import com.sk89q.worldguard.protection.managers.RegionManager; -import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion; -import com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion; -import com.sk89q.worldguard.protection.regions.ProtectedRegion; -import com.sk89q.worldguard.protection.regions.RegionContainer; -import org.bukkit.Location; -import us.mytheria.bloblib.BlobLib; - -import java.util.List; - -public class EngineHubAPI { - - public static World world(org.bukkit.World world) { - return BlobLib.getInstance().getEngineHubManager().getWorldEditWorker().world(world); - } - - public static BlockVector3 blockVector3(Location location) { - return BlobLib.getInstance().getEngineHubManager().getWorldEditWorker().blockVector3(location); - } - - public static BlockVector2 blockVector2(Location location) { - return BlobLib.getInstance().getEngineHubManager().getWorldEditWorker().blockVector2(location); - } - - public static EditSession editSession(org.bukkit.World world) { - return BlobLib.getInstance().getEngineHubManager().getWorldEditWorker().editSession(world); - } - - public static Pattern parse(String string) { - return BlobLib.getInstance().getEngineHubManager().getWorldEditWorker().parse(string); - } - - public static boolean setBlocks(EditSession session, com.sk89q.worldedit.regions.Region region, Pattern pattern) { - return BlobLib.getInstance().getEngineHubManager().getWorldEditWorker().setBlocks(session, region, pattern); - } - - public static com.sk89q.worldedit.regions.CuboidRegion cuboidRegion(Location min, Location max) { - return BlobLib.getInstance().getEngineHubManager().getWorldEditWorker().cuboidRegion(min, max); - } - - public static RegionContainer regionContainer() { - return BlobLib.getInstance().getEngineHubManager().getWorldGuardWorker().regionContainer(); - } - - public static RegionManager regionManager(org.bukkit.World world) { - return BlobLib.getInstance().getEngineHubManager().getWorldGuardWorker().regionManager(world); - } - - public static ProtectedCuboidRegion protectedCuboidRegion(String id, boolean isTransient, - Location min, Location max) { - return BlobLib.getInstance().getEngineHubManager().getWorldGuardWorker().protectedCuboidRegion(id, isTransient, min, max); - } - - public static ProtectedPolygonalRegion protectedPolygonalRegion(String id, boolean isTransient, - List points, int minY, int maxY) { - return BlobLib.getInstance().getEngineHubManager().getWorldGuardWorker().protectedPolygonalRegion(id, isTransient, points, - minY, maxY); - } - - public static ProtectedRegion getRegion(org.bukkit.World world, String id) { - return BlobLib.getInstance().getEngineHubManager().getWorldGuardWorker().getRegion(world, id); - } -} diff --git a/src/main/java/us/mytheria/bloblib/enginehub/EngineHubManager.java b/src/main/java/us/mytheria/bloblib/enginehub/EngineHubManager.java index a2386c8f..acb1e297 100644 --- a/src/main/java/us/mytheria/bloblib/enginehub/EngineHubManager.java +++ b/src/main/java/us/mytheria/bloblib/enginehub/EngineHubManager.java @@ -12,7 +12,15 @@ public class EngineHubManager { private final WorldGuardWorker worldGuard; private boolean worldGuardInstalled = false; - public EngineHubManager() { + private static EngineHubManager instance; + + public static EngineHubManager getInstance() { + if (instance == null) + instance = new EngineHubManager(); + return instance; + } + + private EngineHubManager() { if (Bukkit.getPluginManager().getPlugin("WorldEdit") == null) { Bukkit.getLogger().info("[BlobLib] WorldEdit not found, disabling its features."); worldEdit = new Absent(); @@ -24,7 +32,7 @@ public EngineHubManager() { Bukkit.getLogger().info("[BlobLib] WorldGuard not found, disabling its features."); worldGuard = new us.mytheria.bloblib.enginehub.worldguard.Absent(); } else { - worldGuard = new us.mytheria.bloblib.enginehub.worldguard.Found(); + worldGuard = new us.mytheria.bloblib.enginehub.worldguard.Found(worldEdit); worldGuardInstalled = true; } } diff --git a/src/main/java/us/mytheria/bloblib/enginehub/worldedit/Absent.java b/src/main/java/us/mytheria/bloblib/enginehub/worldedit/Absent.java index 8f5262a1..7e104f35 100644 --- a/src/main/java/us/mytheria/bloblib/enginehub/worldedit/Absent.java +++ b/src/main/java/us/mytheria/bloblib/enginehub/worldedit/Absent.java @@ -1,11 +1,5 @@ package us.mytheria.bloblib.enginehub.worldedit; -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.function.pattern.Pattern; -import com.sk89q.worldedit.math.BlockVector2; -import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.regions.CuboidRegion; -import com.sk89q.worldedit.regions.Region; import org.bukkit.Location; import org.bukkit.World; @@ -20,7 +14,7 @@ public class Absent implements WorldEditWorker { * @return null */ @Override - public EditSession editSession(World world) { + public Object editSession(World world) { return null; } @@ -31,7 +25,7 @@ public EditSession editSession(World world) { * @return null */ @Override - public com.sk89q.worldedit.world.World world(World world) { + public Object world(World world) { return null; } @@ -42,7 +36,7 @@ public com.sk89q.worldedit.world.World world(World world) { * @return null */ @Override - public Pattern parse(String string) { + public Object pattern(String string) { return null; } @@ -55,7 +49,7 @@ public Pattern parse(String string) { * @return true */ @Override - public boolean setBlocks(EditSession session, Region region, Pattern pattern) { + public boolean setBlocks(Object session, Object region, Object pattern) { return true; } @@ -67,7 +61,7 @@ public boolean setBlocks(EditSession session, Region region, Pattern pattern) { * @return null */ @Override - public CuboidRegion cuboidRegion(Location min, Location max) { + public Object cuboidRegion(Location min, Location max) { return null; } @@ -78,7 +72,7 @@ public CuboidRegion cuboidRegion(Location min, Location max) { * @return null */ @Override - public BlockVector3 blockVector3(Location location) { + public Object blockVector3(Location location) { return null; } @@ -89,7 +83,7 @@ public BlockVector3 blockVector3(Location location) { * @return null */ @Override - public BlockVector2 blockVector2(Location location) { + public Object blockVector2(Location location) { return null; } } diff --git a/src/main/java/us/mytheria/bloblib/enginehub/worldedit/Found.java b/src/main/java/us/mytheria/bloblib/enginehub/worldedit/Found.java index 367112d6..3d5437ab 100644 --- a/src/main/java/us/mytheria/bloblib/enginehub/worldedit/Found.java +++ b/src/main/java/us/mytheria/bloblib/enginehub/worldedit/Found.java @@ -28,7 +28,7 @@ public com.sk89q.worldedit.world.World world(World world) { } @Override - public Pattern parse(String string) { + public Pattern pattern(String string) { PatternFactory factory = com.sk89q.worldedit.WorldEdit.getInstance().getPatternFactory(); try { ParserContext context = new ParserContext(); @@ -42,7 +42,13 @@ public Pattern parse(String string) { } @Override - public boolean setBlocks(EditSession session, Region region, Pattern pattern) { + public boolean setBlocks(Object sessionObject, Object regionObject, Object patternObject) { + if (!(sessionObject instanceof EditSession session)) + return false; + if (!(regionObject instanceof Region region)) + return false; + if (!(patternObject instanceof Pattern pattern)) + return false; try { session.setBlocks(region, pattern); Operation operation = session.commit(); diff --git a/src/main/java/us/mytheria/bloblib/enginehub/worldedit/WorldEditWorker.java b/src/main/java/us/mytheria/bloblib/enginehub/worldedit/WorldEditWorker.java index 1a98bcf2..d7621df7 100644 --- a/src/main/java/us/mytheria/bloblib/enginehub/worldedit/WorldEditWorker.java +++ b/src/main/java/us/mytheria/bloblib/enginehub/worldedit/WorldEditWorker.java @@ -1,38 +1,36 @@ package us.mytheria.bloblib.enginehub.worldedit; -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.function.pattern.Pattern; -import com.sk89q.worldedit.math.BlockVector2; -import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.regions.CuboidRegion; -import com.sk89q.worldedit.regions.Region; import org.bukkit.Location; import org.bukkit.World; +import org.jetbrains.annotations.Nullable; public interface WorldEditWorker { /** * Creates an EditSession for the given world * * @param world the world - * @return the EditSession + * @return the EditSession (cast to EditSession) */ - EditSession editSession(World world); + @Nullable + Object editSession(World world); /** * Converts a Bukkit world to a WorldEdit world * * @param world the Bukkit world - * @return the WorldEdit world + * @return the WorldEdit world (cast to com.sk89q.worldedit.world.World) */ - com.sk89q.worldedit.world.World world(World world); + @Nullable + Object world(World world); /** - * Converts a Bukkit location to a WorldEdit location + * Creates a pattern * - * @param string the Bukkit location - * @return the WorldEdit location + * @param string The string to use + * @return The pattern (cast to Pattern) */ - Pattern parse(String string); + @Nullable + Object pattern(String string); /** * Sets the blocks in the given region to the given pattern @@ -42,30 +40,33 @@ public interface WorldEditWorker { * @param pattern the pattern * @return true if the operation was successful */ - boolean setBlocks(EditSession session, Region region, Pattern pattern); + boolean setBlocks(Object session, Object region, Object pattern); /** * Creates a cuboid region from the given locations * * @param min the minimum location * @param max the maximum location - * @return the cuboid region + * @return the cuboid region (cast to CuboidRegion) */ - CuboidRegion cuboidRegion(Location min, Location max); + @Nullable + Object cuboidRegion(Location min, Location max); /** * Creates a block vector from the given location * * @param location the location - * @return the block vector + * @return the block vector (cast to BlockVector3) */ - BlockVector3 blockVector3(Location location); + @Nullable + Object blockVector3(Location location); /** * Creates a block vector from the given location * * @param location the location - * @return the block vector + * @return the block vector (cast to BlockVector2) */ - BlockVector2 blockVector2(Location location); + @Nullable + Object blockVector2(Location location); } diff --git a/src/main/java/us/mytheria/bloblib/enginehub/worldguard/Absent.java b/src/main/java/us/mytheria/bloblib/enginehub/worldguard/Absent.java index b2764726..a8b48b58 100644 --- a/src/main/java/us/mytheria/bloblib/enginehub/worldguard/Absent.java +++ b/src/main/java/us/mytheria/bloblib/enginehub/worldguard/Absent.java @@ -1,10 +1,5 @@ package us.mytheria.bloblib.enginehub.worldguard; -import com.sk89q.worldguard.protection.managers.RegionManager; -import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion; -import com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion; -import com.sk89q.worldguard.protection.regions.ProtectedRegion; -import com.sk89q.worldguard.protection.regions.RegionContainer; import org.bukkit.Location; import org.bukkit.World; @@ -20,7 +15,7 @@ public class Absent implements WorldGuardWorker { * @return null */ @Override - public RegionContainer regionContainer() { + public Object regionContainer() { return null; } @@ -31,7 +26,7 @@ public RegionContainer regionContainer() { * @return null */ @Override - public RegionManager regionManager(World world) { + public Object regionManager(World world) { return null; } @@ -45,7 +40,7 @@ public RegionManager regionManager(World world) { * @return null */ @Override - public ProtectedCuboidRegion protectedCuboidRegion(String id, boolean isTransient, Location min, Location max) { + public Object protectedCuboidRegion(String id, boolean isTransient, Location min, Location max) { return null; } @@ -60,7 +55,7 @@ public ProtectedCuboidRegion protectedCuboidRegion(String id, boolean isTransien * @return null */ @Override - public ProtectedPolygonalRegion protectedPolygonalRegion(String id, boolean isTransient, List points, int minY, int maxY) { + public Object protectedPolygonalRegion(String id, boolean isTransient, List points, int minY, int maxY) { return null; } @@ -72,7 +67,7 @@ public ProtectedPolygonalRegion protectedPolygonalRegion(String id, boolean isTr * @return null */ @Override - public ProtectedRegion getRegion(World world, String id) { + public Object getRegion(World world, String id) { return null; } } diff --git a/src/main/java/us/mytheria/bloblib/enginehub/worldguard/Found.java b/src/main/java/us/mytheria/bloblib/enginehub/worldguard/Found.java index 11be277a..0c515e9f 100644 --- a/src/main/java/us/mytheria/bloblib/enginehub/worldguard/Found.java +++ b/src/main/java/us/mytheria/bloblib/enginehub/worldguard/Found.java @@ -1,6 +1,7 @@ package us.mytheria.bloblib.enginehub.worldguard; import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldguard.WorldGuard; import com.sk89q.worldguard.protection.managers.RegionManager; import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion; @@ -9,12 +10,18 @@ import com.sk89q.worldguard.protection.regions.RegionContainer; import org.bukkit.Location; import org.bukkit.World; -import us.mytheria.bloblib.enginehub.EngineHubAPI; +import us.mytheria.bloblib.enginehub.worldedit.WorldEditWorker; import java.util.ArrayList; import java.util.List; public class Found implements WorldGuardWorker { + private final WorldEditWorker worldEditWorker; + + public Found(WorldEditWorker worldEditWorker) { + this.worldEditWorker = worldEditWorker; + } + @Override public RegionContainer regionContainer() { return WorldGuard.getInstance().getPlatform().getRegionContainer(); @@ -22,14 +29,14 @@ public RegionContainer regionContainer() { @Override public RegionManager regionManager(World world) { - return regionContainer().get(EngineHubAPI.world(world)); + return regionContainer().get((com.sk89q.worldedit.world.World) worldEditWorker.world(world)); } @Override public ProtectedCuboidRegion protectedCuboidRegion(String id, boolean isTransient, Location min, Location max) { return new ProtectedCuboidRegion(id, isTransient, - EngineHubAPI.blockVector3(min), EngineHubAPI.blockVector3(max)); + (BlockVector3) worldEditWorker.blockVector3(min), (BlockVector3) worldEditWorker.blockVector3(max)); } @Override @@ -38,7 +45,7 @@ public ProtectedPolygonalRegion protectedPolygonalRegion(String id, boolean isTr int maxY) { List list = new ArrayList<>(); for (Location point : points) { - list.add(EngineHubAPI.blockVector2(point)); + list.add((BlockVector2) worldEditWorker.blockVector2(point)); } return new ProtectedPolygonalRegion(id, isTransient, list, minY, maxY); } diff --git a/src/main/java/us/mytheria/bloblib/enginehub/worldguard/WorldGuardWorker.java b/src/main/java/us/mytheria/bloblib/enginehub/worldguard/WorldGuardWorker.java index 3a5af28f..d67f393e 100644 --- a/src/main/java/us/mytheria/bloblib/enginehub/worldguard/WorldGuardWorker.java +++ b/src/main/java/us/mytheria/bloblib/enginehub/worldguard/WorldGuardWorker.java @@ -1,12 +1,8 @@ package us.mytheria.bloblib.enginehub.worldguard; -import com.sk89q.worldguard.protection.managers.RegionManager; -import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion; -import com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion; -import com.sk89q.worldguard.protection.regions.ProtectedRegion; -import com.sk89q.worldguard.protection.regions.RegionContainer; import org.bukkit.Location; import org.bukkit.World; +import org.jetbrains.annotations.Nullable; import java.util.List; @@ -14,17 +10,19 @@ public interface WorldGuardWorker { /** * Gets the region container * - * @return the region container + * @return the region container (cast to RegionContainer) */ - RegionContainer regionContainer(); + @Nullable + Object regionContainer(); /** * Gets the region manager for the given world * * @param world the world - * @return the region manager + * @return the region manager (cast to RegionManager) */ - RegionManager regionManager(World world); + @Nullable + Object regionManager(World world); /** * Creates a protected cuboid region @@ -33,10 +31,11 @@ public interface WorldGuardWorker { * @param isTransient whether the region is transient * @param min the minimum location * @param max the maximum location - * @return the protected cuboid region + * @return the protected cuboid region (cast to ProtectedCuboidRegion) */ - ProtectedCuboidRegion protectedCuboidRegion(String id, boolean isTransient, - Location min, Location max); + @Nullable + Object protectedCuboidRegion(String id, boolean isTransient, + Location min, Location max); /** * Creates a protected polygonal region @@ -46,18 +45,20 @@ ProtectedCuboidRegion protectedCuboidRegion(String id, boolean isTransient, * @param points the points * @param minY the minimum y * @param maxY the maximum y - * @return the protected polygonal region + * @return the protected polygonal region (cast to ProtectedPolygonalRegion) */ - ProtectedPolygonalRegion protectedPolygonalRegion(String id, boolean isTransient, - List points, - int minY, int maxY); + @Nullable + Object protectedPolygonalRegion(String id, boolean isTransient, + List points, + int minY, int maxY); /** * Gets the region with the given id in the given world * * @param world the world * @param id the id - * @return the region + * @return the region (cast to ProtectedRegion) */ - ProtectedRegion getRegion(World world, String id); + @Nullable + Object getRegion(World world, String id); } diff --git a/src/main/java/us/mytheria/bloblib/entities/DataAssetType.java b/src/main/java/us/mytheria/bloblib/entities/DataAssetType.java index c4822b85..62d1773b 100644 --- a/src/main/java/us/mytheria/bloblib/entities/DataAssetType.java +++ b/src/main/java/us/mytheria/bloblib/entities/DataAssetType.java @@ -2,29 +2,57 @@ import me.anjoismysign.anjo.entities.NamingConventions; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import us.mytheria.bloblib.BlobLib; +import us.mytheria.bloblib.managers.*; + +import java.io.File; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.BiConsumer; public enum DataAssetType { - BLOB_MESSAGE("messages", "/BlobMessage", "_lang.yml"), - BLOB_SOUND("sounds", "/BlobSound", "_sounds.yml"), - BLOB_INVENTORY("blobInventories", "/BlobInventory", "_inventories.yml"), - META_BLOB_INVENTORY("metaBlobInventories", "/MetaBlobInventory", "_meta_inventories.yml"), - ACTION("actions", "/Action", "_actions.yml"), - TRANSLATABLE_BLOCK("translatableBlocks", "/TranslatableBlock", "_translatable_blocks.yml"), - TRANSLATABLE_SNIPPET("translatableSnippets", "/TranslatableSnippet", "_translatable_snippets.yml"), - TRANSLATABLE_ITEM("translatableItems", "/TranslatableItem", "_translatable_items.yml"), - TAG_SET("tagSets", "/TagSet", "_tag_sets.yml"), - TRANSLATABLE_POSITIONABLE("translatablePositionables", "/TranslatablePositionable", "_translatable_positionables.yml"); + BLOB_MESSAGE("messages", "/BlobMessage", "_lang.yml", + (plugin, files) -> MessageManager.continueLoadingMessages(plugin, true, files.toArray(new File[0]))), + BLOB_SOUND("sounds", "/BlobSound", "_sounds.yml", + (plugin, files) -> SoundManager.continueLoadingSounds(plugin, true, files.toArray(new File[0]))), + BLOB_INVENTORY("blobInventories", "/BlobInventory", "_inventories.yml", + (plugin, files) -> InventoryManager.continueLoadingBlobInventories(plugin, files.toArray(new File[0]))), + META_BLOB_INVENTORY("metaBlobInventories", "/MetaBlobInventory", "_meta_inventories.yml", + (plugin, files) -> InventoryManager.continueLoadingMetaInventories(plugin, files.toArray(new File[0]))), + ACTION("actions", "/Action", "_actions.yml", + (plugin, files) -> { + }), + TRANSLATABLE_BLOCK("translatableBlocks", "/TranslatableBlock", "_translatable_blocks.yml", + (plugin, files) -> TranslatableManager.continueLoadingBlocks(plugin, true, files.toArray(new File[0]))), + TRANSLATABLE_SNIPPET("translatableSnippets", "/TranslatableSnippet", "_translatable_snippets.yml", + (plugin, files) -> TranslatableManager.continueLoadingSnippets(plugin, true, files.toArray(new File[0]))), + TRANSLATABLE_ITEM("translatableItems", "/TranslatableItem", "_translatable_items.yml", + (plugin, files) -> BlobLib.getInstance().getTranslatableItemManager().continueLoadingAssets(plugin, true, files.toArray(new File[0]))), + TAG_SET("tagSets", "/TagSet", "_tag_sets.yml", + (plugin, files) -> BlobLib.getInstance().getTagSetManager().continueLoadingAssets(plugin, true, files.toArray(new File[0]))), + TRANSLATABLE_POSITIONABLE("translatablePositionables", "/TranslatablePositionable", "_translatable_positionables.yml", + (plugin, files) -> BlobLib.getInstance().getTranslatablePositionableManager().continueLoadingAssets(plugin, true, files.toArray(new File[0]))), + TRANSLATABLE_AREA("translatableAreas", "/TranslatableArea", "_translatable_areas.yml", + (plugin, files) -> BlobLib.getInstance().getTranslatableAreaManager().continueLoadingAssets(plugin, true, files.toArray(new File[0]))); @NotNull private final String key, directoryPath, defaultFilePath; + @NotNull + private final BiConsumer> continueLoading; + private DataAssetType( @NotNull String key, @NotNull String directoryPath, - @NotNull String defaultFilePath) { + @NotNull String defaultFilePath, + @NotNull BiConsumer> continueLoading) { this.key = key; this.directoryPath = directoryPath; this.defaultFilePath = defaultFilePath; + this.continueLoading = continueLoading; } @NotNull @@ -48,7 +76,25 @@ public String getDirectoryPath() { return directoryPath; } + public @NotNull BiConsumer> getContinueLoading() { + return continueLoading; + } + public String getObjectName() { return name().replace("_", ""); } + + private static final Map byEqualsIgnoreObjectName = new HashMap<>(); + + static { + for (DataAssetType assetType : values()) { + byEqualsIgnoreObjectName.put(assetType.getObjectName().toLowerCase(), assetType); + } + } + + @Nullable + public static DataAssetType byEqualsIgnoreObjectName(@NotNull String objectName) { + Objects.requireNonNull(objectName, "'objectName' cannot be null"); + return byEqualsIgnoreObjectName.get(objectName.toLowerCase()); + } } diff --git a/src/main/java/us/mytheria/bloblib/entities/area/Area.java b/src/main/java/us/mytheria/bloblib/entities/area/Area.java new file mode 100644 index 00000000..fa56c726 --- /dev/null +++ b/src/main/java/us/mytheria/bloblib/entities/area/Area.java @@ -0,0 +1,26 @@ +package us.mytheria.bloblib.entities.area; + +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.jetbrains.annotations.NotNull; + +import java.util.Objects; + +public interface Area { + @NotNull + World getWorld(); + + boolean isInside(@NotNull Location location); + + default boolean isInside(@NotNull Entity entity) { + Objects.requireNonNull(entity, "'entity' cannot be null"); + return isInside(entity.getLocation()); + } + + default boolean isInside(@NotNull Block block) { + Objects.requireNonNull(block, "'block' cannot be null"); + return isInside(block.getLocation()); + } +} diff --git a/src/main/java/us/mytheria/bloblib/entities/area/WorldGuardArea.java b/src/main/java/us/mytheria/bloblib/entities/area/WorldGuardArea.java new file mode 100644 index 00000000..4f852889 --- /dev/null +++ b/src/main/java/us/mytheria/bloblib/entities/area/WorldGuardArea.java @@ -0,0 +1,58 @@ +package us.mytheria.bloblib.entities.area; + +import com.sk89q.worldguard.protection.regions.ProtectedRegion; +import org.bukkit.Location; +import org.bukkit.World; +import org.jetbrains.annotations.NotNull; +import us.mytheria.bloblib.enginehub.EngineHubManager; + +import java.util.Objects; + +public class WorldGuardArea implements Area { + private final World world; + private final String id; + + /** + * Instances a WorldGuard Area. + * It's implied that before calling this method, it needs to check that WorldGuard is installed. + * + * @param world The world the ProtectedRegion belongs to + * @param id The ProtectedRegion's ID + * @return The WorldGuardArea + */ + public static WorldGuardArea of( + @NotNull World world, + @NotNull String id) { + Objects.requireNonNull(world, "'world' cannot be null"); + Objects.requireNonNull(id, "'id' cannot be null"); + return new WorldGuardArea(world, id); + } + + private WorldGuardArea( + World world, + String id) { + this.world = world; + this.id = id; + } + + @NotNull + private ProtectedRegion getProtectedRegion() { + Object result = EngineHubManager.getInstance() + .getWorldGuardWorker() + .getRegion(world, id); + Objects.requireNonNull(result, "Couldn't find " + id + " in: " + world); + return (ProtectedRegion) result; + } + + @Override + public @NotNull World getWorld() { + return world; + } + + @Override + public boolean isInside(@NotNull Location location) { + World locationWorld = location.getWorld(); + return locationWorld != null && locationWorld.getName().equals(world.getName()) + && getProtectedRegion().contains(location.getBlockX(), location.getBlockY(), location.getBlockZ()); + } +} diff --git a/src/main/java/us/mytheria/bloblib/entities/translatable/BlobTranslatableArea.java b/src/main/java/us/mytheria/bloblib/entities/translatable/BlobTranslatableArea.java new file mode 100644 index 00000000..df96597a --- /dev/null +++ b/src/main/java/us/mytheria/bloblib/entities/translatable/BlobTranslatableArea.java @@ -0,0 +1,66 @@ +package us.mytheria.bloblib.entities.translatable; + +import org.jetbrains.annotations.NotNull; +import us.mytheria.bloblib.entities.DataAssetType; +import us.mytheria.bloblib.entities.area.Area; + +import java.util.Objects; +import java.util.function.Function; + +public class BlobTranslatableArea implements TranslatableArea { + + @NotNull + private final String locale, display, key; + + @NotNull + private final Area area; + + public static BlobTranslatableArea of(@NotNull String key, + @NotNull String locale, + @NotNull String display, + @NotNull Area area) { + Objects.requireNonNull(locale, "Locale cannot be null"); + Objects.requireNonNull(display, "Display cannot be null"); + Objects.requireNonNull(area, "Area cannot be null"); + return new BlobTranslatableArea(key, locale, display, area); + } + + private BlobTranslatableArea(@NotNull String key, + @NotNull String locale, + @NotNull String display, + @NotNull Area area) { + this.key = key; + this.locale = locale; + this.display = BlobTranslatableSnippet.PARSE(display, locale); + this.area = area; + } + + @NotNull + public String getLocale() { + return locale; + } + + @NotNull + public Area get() { + return area; + } + + @NotNull + public String getReference() { + return key; + } + + public DataAssetType getType() { + return DataAssetType.TRANSLATABLE_AREA; + } + + @NotNull + public TranslatableArea modify(Function function) { + return new BlobTranslatableArea(key, locale, function.apply(display), area); + } + + @NotNull + public String getDisplay() { + return display; + } +} diff --git a/src/main/java/us/mytheria/bloblib/entities/translatable/TranslatableArea.java b/src/main/java/us/mytheria/bloblib/entities/translatable/TranslatableArea.java new file mode 100644 index 00000000..851f03a4 --- /dev/null +++ b/src/main/java/us/mytheria/bloblib/entities/translatable/TranslatableArea.java @@ -0,0 +1,68 @@ +package us.mytheria.bloblib.entities.translatable; + +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import us.mytheria.bloblib.api.BlobLibTranslatableAPI; +import us.mytheria.bloblib.entities.area.Area; + +import java.util.Objects; + +public interface TranslatableArea extends Translatable { + + /** + * Gets a TranslatableArea by its key. Key is the same as getReference. + * + * @param key The key to get the tag set by. + * @return The TranslatableArea, or null if it doesn't exist. + */ + @Nullable + static TranslatableArea by(@NotNull String key) { + Objects.requireNonNull(key); + return BlobLibTranslatableAPI.getInstance().getTranslatableArea(key); + } + + /** + * Gets the display of this TranslatableArea + * + * @return The name + */ + @NotNull + String getDisplay(); + + /** + * Localizes the TranslatableArea to a specific locale. + * + * @param locale The locale to localize to. + * @return The localized TranslatableArea. + */ + @Nullable + default TranslatableArea localize(@NotNull String locale) { + Objects.requireNonNull(locale, "'locale' cannot be null"); + if (getLocale().equals(locale)) + return this; + return BlobLibTranslatableAPI.getInstance() + .getTranslatableArea(getReference(), + locale); + } + + /** + * Localizes the TranslatableArea to a specific player's locale. + * + * @param player The player to localize to. + * @return The localized TranslatableArea. + */ + default TranslatableArea localize(@NotNull Player player) { + Objects.requireNonNull(player, "'player' cannot be null"); + return localize(player.getLocale()); + } + + /** + * Will get the TranslatableAreaModder for this TranslatableArea. + * + * @return The TranslatableAreaModder. + */ + default TranslatableAreaModder modder() { + return TranslatableAreaModder.mod(this); + } +} diff --git a/src/main/java/us/mytheria/bloblib/entities/translatable/TranslatableAreaModder.java b/src/main/java/us/mytheria/bloblib/entities/translatable/TranslatableAreaModder.java new file mode 100644 index 00000000..d168b435 --- /dev/null +++ b/src/main/java/us/mytheria/bloblib/entities/translatable/TranslatableAreaModder.java @@ -0,0 +1,18 @@ +package us.mytheria.bloblib.entities.translatable; + +import us.mytheria.bloblib.entities.area.Area; + +public class TranslatableAreaModder extends BlobTranslatableModder { + + /** + * Will create a new instance of BlobTranslatableModder. + * + * @param translatable The translatable to modify + * @return The BlobTranslatableModder + */ + public static TranslatableAreaModder mod(TranslatableArea translatable) { + TranslatableAreaModder translatableModder = new TranslatableAreaModder(); + translatableModder.translatable = translatable; + return translatableModder; + } +} diff --git a/src/main/java/us/mytheria/bloblib/managers/ManagerDirector.java b/src/main/java/us/mytheria/bloblib/managers/ManagerDirector.java index b862aff0..83b1b7fc 100644 --- a/src/main/java/us/mytheria/bloblib/managers/ManagerDirector.java +++ b/src/main/java/us/mytheria/bloblib/managers/ManagerDirector.java @@ -819,6 +819,58 @@ public ManagerDirector registerTagSet(String... fileNames) { return registerTagSet(false, fileNames); } + /** + * Will detach all TranslatablePositionables provided. + * + * @param debug Whether to print debug messages + * @param fileNames The names of the files to detach. Needs to include the extension. + * @return The ManagerDirector instance for method chaining + */ + public ManagerDirector registerTranslatablePositionable(boolean debug, String... fileNames) { + String[] yaml = addYml(fileNames); + File[] freshFiles = freshFiles(debug, getRealFileManager().getDirectory(DataAssetType.TRANSLATABLE_POSITIONABLE), yaml); + BlobLib.getInstance().getTranslatablePositionableManager().continueLoadingAssets(plugin, true, freshFiles); + if (debug) + getPlugin().getAnjoLogger().debug(" translatable positionable asset " + Arrays.toString(fileNames) + " successfully registered"); + return this; + } + + /** + * Will detach all TranslatablePositionables provided. + * + * @param fileNames The names of the files to detach. Needs to include the extension. + * @return The ManagerDirector instance for method chaining + */ + public ManagerDirector registerTranslatablePositionable(String... fileNames) { + return registerTranslatablePositionable(false, fileNames); + } + + /** + * Will detach all TranslatableAreas provided. + * + * @param debug Whether to print debug messages + * @param fileNames The names of the files to detach. Needs to include the extension. + * @return The ManagerDirector instance for method chaining + */ + public ManagerDirector registerTranslatableArea(boolean debug, String... fileNames) { + String[] yaml = addYml(fileNames); + File[] freshFiles = freshFiles(debug, getRealFileManager().getDirectory(DataAssetType.TRANSLATABLE_AREA), yaml); + BlobLib.getInstance().getTranslatableAreaManager().continueLoadingAssets(plugin, true, freshFiles); + if (debug) + getPlugin().getAnjoLogger().debug(" translatable area asset " + Arrays.toString(fileNames) + " successfully registered"); + return this; + } + + /** + * Will detach all TranslatableAreas provided. + * + * @param fileNames The names of the files to detach. Needs to include the extension. + * @return The ManagerDirector instance for method chaining + */ + public ManagerDirector registerTranslatableArea(String... fileNames) { + return registerTranslatableArea(false, fileNames); + } + /** * Creates a new NamespacedKey. * @@ -870,136 +922,25 @@ public boolean loadBlobLibExpansion(@NotNull File expansion) { Map> assets = new HashMap<>(); Map assetsDirectory = new HashMap<>(); for (File directory : handyDirectory.listDirectories()) { - if (directory.getName().equalsIgnoreCase(DataAssetType.BLOB_SOUND.getObjectName())) { - HandyDirectory subDirectory = HandyDirectory.of(directory); - List list = subDirectory.listRecursively("yml").stream().toList(); - assets.put(DataAssetType.BLOB_SOUND, list); - assetsDirectory.put(DataAssetType.BLOB_SOUND, directory); - continue; - } - if (directory.getName().equalsIgnoreCase(DataAssetType.BLOB_MESSAGE.getObjectName())) { - HandyDirectory subDirectory = HandyDirectory.of(directory); - List list = subDirectory.listRecursively("yml").stream().toList(); - assets.put(DataAssetType.BLOB_MESSAGE, list); - assetsDirectory.put(DataAssetType.BLOB_MESSAGE, directory); - continue; - } - if (directory.getName().equalsIgnoreCase(DataAssetType.BLOB_INVENTORY.getObjectName())) { - HandyDirectory subDirectory = HandyDirectory.of(directory); - List list = subDirectory.listRecursively("yml").stream().toList(); - assets.put(DataAssetType.BLOB_INVENTORY, list); - assetsDirectory.put(DataAssetType.BLOB_INVENTORY, directory); - continue; - } - if (directory.getName().equalsIgnoreCase(DataAssetType.META_BLOB_INVENTORY.getObjectName())) { - HandyDirectory subDirectory = HandyDirectory.of(directory); - List list = subDirectory.listRecursively("yml").stream().toList(); - assets.put(DataAssetType.META_BLOB_INVENTORY, list); - assetsDirectory.put(DataAssetType.META_BLOB_INVENTORY, directory); - continue; - } - if (directory.getName().equalsIgnoreCase(DataAssetType.TRANSLATABLE_BLOCK.getObjectName())) { - HandyDirectory subDirectory = HandyDirectory.of(directory); - List list = subDirectory.listRecursively("yml").stream().toList(); - assets.put(DataAssetType.TRANSLATABLE_BLOCK, list); - assetsDirectory.put(DataAssetType.TRANSLATABLE_BLOCK, directory); - continue; - } - if (directory.getName().equalsIgnoreCase(DataAssetType.TRANSLATABLE_SNIPPET.getObjectName())) { - HandyDirectory subDirectory = HandyDirectory.of(directory); - List list = subDirectory.listRecursively("yml").stream().toList(); - assets.put(DataAssetType.TRANSLATABLE_SNIPPET, list); - assetsDirectory.put(DataAssetType.TRANSLATABLE_SNIPPET, directory); - continue; - } - if (directory.getName().equalsIgnoreCase(DataAssetType.TRANSLATABLE_ITEM.getObjectName())) { - HandyDirectory subDirectory = HandyDirectory.of(directory); - List list = subDirectory.listRecursively("yml").stream().toList(); - assets.put(DataAssetType.TRANSLATABLE_ITEM, list); - assetsDirectory.put(DataAssetType.TRANSLATABLE_ITEM, directory); + DataAssetType match = DataAssetType.byEqualsIgnoreObjectName(directory.getName()); + if (match == null) continue; - } - if (directory.getName().equalsIgnoreCase(DataAssetType.TAG_SET.getObjectName())) { - HandyDirectory subDirectory = HandyDirectory.of(directory); - List list = subDirectory.listRecursively("yml").stream().toList(); - assets.put(DataAssetType.TAG_SET, list); - assetsDirectory.put(DataAssetType.TAG_SET, directory); - } + HandyDirectory subDirectory = HandyDirectory.of(directory); + List list = subDirectory.listRecursively("yml").stream().toList(); + assets.put(match, list); + assetsDirectory.put(match, directory); } if (assets.isEmpty()) return true; - BlobLib blobLib = BlobLib.getInstance(); - List blobSound = assets.get(DataAssetType.BLOB_SOUND); - if (blobSound != null && !blobSound.isEmpty()) { - SoundManager.continueLoadingSounds(plugin, true, blobSound.toArray(new File[0])); - try { - FileUtils.deleteDirectory(assetsDirectory.get(DataAssetType.BLOB_SOUND)); - } catch (IOException e) { - e.printStackTrace(); - } - } - List blobMessage = assets.get(DataAssetType.BLOB_MESSAGE); - if (blobMessage != null && !blobMessage.isEmpty()) { - MessageManager.continueLoadingMessages(plugin, true, blobMessage.toArray(new File[0])); - try { - FileUtils.deleteDirectory(assetsDirectory.get(DataAssetType.BLOB_MESSAGE)); - } catch (IOException e) { - e.printStackTrace(); - } - } - List blobInventory = assets.get(DataAssetType.BLOB_INVENTORY); - if (blobInventory != null && !blobInventory.isEmpty()) { - InventoryManager.continueLoadingBlobInventories(plugin, blobInventory.toArray(new File[0])); - try { - FileUtils.deleteDirectory(assetsDirectory.get(DataAssetType.BLOB_INVENTORY)); - } catch (IOException e) { - e.printStackTrace(); - } - } - List metaBlobInventory = assets.get(DataAssetType.META_BLOB_INVENTORY); - if (metaBlobInventory != null && !metaBlobInventory.isEmpty()) { - InventoryManager.continueLoadingMetaInventories(plugin, metaBlobInventory.toArray(new File[0])); - try { - FileUtils.deleteDirectory(assetsDirectory.get(DataAssetType.META_BLOB_INVENTORY)); - } catch (IOException e) { - e.printStackTrace(); - } - } - List translatableBlock = assets.get(DataAssetType.TRANSLATABLE_BLOCK); - if (translatableBlock != null - && !translatableBlock.isEmpty()) { - TranslatableManager.continueLoadingBlocks(plugin, true, translatableBlock.toArray(new File[0])); - try { - FileUtils.deleteDirectory(assetsDirectory.get(DataAssetType.TRANSLATABLE_BLOCK)); - } catch (IOException e) { - e.printStackTrace(); - } - } - List translatableSnippet = assets.get(DataAssetType.TRANSLATABLE_SNIPPET); - if (translatableSnippet != null && !translatableSnippet.isEmpty()) { - TranslatableManager.continueLoadingSnippets(plugin, true, translatableSnippet.toArray(new File[0])); - try { - FileUtils.deleteDirectory(assetsDirectory.get(DataAssetType.TRANSLATABLE_SNIPPET)); - } catch (IOException e) { - e.printStackTrace(); - } - } - List translatableItem = assets.get(DataAssetType.TRANSLATABLE_ITEM); - if (translatableItem != null && !translatableItem.isEmpty()) { - blobLib.getTranslatableItemManager().continueLoadingAssets(plugin, true, translatableItem.toArray(new File[0])); - try { - FileUtils.deleteDirectory(assetsDirectory.get(DataAssetType.TRANSLATABLE_ITEM)); - } catch (IOException e) { - e.printStackTrace(); - } - } - List tagSet = assets.get(DataAssetType.TAG_SET); - if (tagSet != null && !tagSet.isEmpty()) { - blobLib.getTagSetManager().continueLoadingAssets(plugin, true, tagSet.toArray(new File[0])); - try { - FileUtils.deleteDirectory(assetsDirectory.get(DataAssetType.TAG_SET)); - } catch (IOException e) { - e.printStackTrace(); + for (DataAssetType assetType : DataAssetType.values()) { + List files = assets.get(assetType); + if (files != null && !files.isEmpty()) { + assetType.getContinueLoading().accept(plugin, files); + try { + FileUtils.deleteDirectory(assetsDirectory.get(assetType)); + } catch (IOException e) { + e.printStackTrace(); + } } } return true; diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 3953dea7..2be9b04d 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -3,7 +3,10 @@ version: ${project.parent.version} main: us.mytheria.bloblib.BlobLib api-version: 1.17 load: STARTUP -loadbefore: [ Vault, WorldGuard, WorldEdit, LibsDisguises, ProtocolLib ] +loadbefore: [ Vault, LibsDisguises, ProtocolLib ] +softdepend: + - WorldEdit + - WorldGuard authors: [ promorrom, j0ach1mmall3, Dean B, SmallCode ] commands: bloblib: