├── src └── main │ └── resources │ ├── lang │ └── en_US.json │ ├── config.yml │ └── plugin.yml ├── gradle.properties ├── core ├── src │ └── main │ │ └── java │ │ ├── com │ │ └── wolfyscript │ │ │ └── utilities │ │ │ ├── Copyable.java │ │ │ ├── verification │ │ │ ├── ObjectVerifier.java │ │ │ ├── CollectionVerifier.java │ │ │ ├── ObjectVerifierBuilder.java │ │ │ ├── Verifier.java │ │ │ ├── VerifierEntry.java │ │ │ └── CollectionVerifierBuilder.java │ │ │ ├── bukkit │ │ │ ├── package-info.java │ │ │ ├── events │ │ │ │ └── persistent │ │ │ │ │ ├── BlockStorageEvent.java │ │ │ │ │ ├── BlockStorageExpEvent.java │ │ │ │ │ └── BlockStorageMoveEvent.java │ │ │ ├── adapters │ │ │ │ ├── PlayerImpl.java │ │ │ │ ├── BukkitRefAdapter.java │ │ │ │ ├── LocationImpl.java │ │ │ │ ├── BukkitWrapper.java │ │ │ │ └── WorldImpl.java │ │ │ ├── nms │ │ │ │ ├── inventory │ │ │ │ │ └── NMSInventoryUtils.java │ │ │ │ ├── ServerProperties.java │ │ │ │ └── fallback │ │ │ │ │ ├── FallbackBlockUtilImpl.java │ │ │ │ │ ├── FallbackInventoryUtilImpl.java │ │ │ │ │ └── FallbackNMSEntry.java │ │ │ ├── world │ │ │ │ └── items │ │ │ │ │ └── reference │ │ │ │ │ ├── LegacyParser.java │ │ │ │ │ ├── StackIdentifierParser.java │ │ │ │ │ └── LegacyStackReference.java │ │ │ ├── dependency │ │ │ │ ├── PluginIntegrationDependencyResolverSettings.java │ │ │ │ ├── PluginIntegrationDependency.java │ │ │ │ └── PluginIntegrationDependencyResolver.java │ │ │ ├── nbt │ │ │ │ ├── QueryNodeListLong.java │ │ │ │ ├── QueryNodeListInt.java │ │ │ │ ├── QueryNodeListFloat.java │ │ │ │ ├── QueryNodeListDouble.java │ │ │ │ ├── QueryNodeListString.java │ │ │ │ ├── QueryNodeListCompound.java │ │ │ │ ├── QueryNodeIntArray.java │ │ │ │ ├── QueryNodeByteArray.java │ │ │ │ ├── QueryNodeString.java │ │ │ │ ├── QueryNodeByte.java │ │ │ │ ├── QueryNodeLong.java │ │ │ │ ├── QueryNodeFloat.java │ │ │ │ ├── QueryNodeInt.java │ │ │ │ ├── QueryNodeShort.java │ │ │ │ └── QueryNodeDouble.java │ │ │ ├── listeners │ │ │ │ └── PlayerListener.java │ │ │ └── items │ │ │ │ ├── CustomBlockSettings.java │ │ │ │ └── CustomItemData.java │ │ │ ├── package-info.java │ │ │ ├── dependency │ │ │ ├── Dependency.java │ │ │ ├── DependencySource.java │ │ │ └── DependencyResolverSettings.java │ │ │ ├── json │ │ │ └── jackson │ │ │ │ ├── MissingDependencyException.java │ │ │ │ └── MissingImplementationException.java │ │ │ └── paper │ │ │ └── WolfyUtilsBootstrap.java │ │ └── me │ │ └── wolfyscript │ │ └── utilities │ │ ├── api │ │ ├── nms │ │ │ ├── inventory │ │ │ │ ├── generated │ │ │ │ │ └── PermissionReference.java │ │ │ │ └── RecipeType.java │ │ │ ├── nbt │ │ │ │ ├── NBTTagEnd.java │ │ │ │ ├── NBTTagInt.java │ │ │ │ ├── NBTTagDouble.java │ │ │ │ ├── NBTTagFloat.java │ │ │ │ ├── NBTTagLong.java │ │ │ │ ├── NBTTagShort.java │ │ │ │ ├── NBTTagByte.java │ │ │ │ ├── NBTTagByteArray.java │ │ │ │ ├── NBTTagIntArray.java │ │ │ │ ├── NBTTagLongArray.java │ │ │ │ ├── NBTTagString.java │ │ │ │ ├── NBTBase.java │ │ │ │ ├── NBTNumber.java │ │ │ │ ├── NBTTagList.java │ │ │ │ └── NBTType.java │ │ │ ├── UtilComponent.java │ │ │ ├── NetworkUtil.java │ │ │ └── BlockUtil.java │ │ ├── inventory │ │ │ ├── gui │ │ │ │ ├── button │ │ │ │ │ └── ButtonType.java │ │ │ │ ├── ChatInputAction.java │ │ │ │ └── ChatTabComplete.java │ │ │ ├── custom_items │ │ │ │ ├── actions │ │ │ │ │ ├── DataEvent.java │ │ │ │ │ ├── EventPlayer.java │ │ │ │ │ ├── Data.java │ │ │ │ │ ├── DataBlock.java │ │ │ │ │ ├── DataPlayer.java │ │ │ │ │ ├── EventPlayerInteractEntity.java │ │ │ │ │ ├── DataLocation.java │ │ │ │ │ ├── EventPlayerInteractAtEntity.java │ │ │ │ │ ├── DataEntity.java │ │ │ │ │ ├── EventPlayerItemBreak.java │ │ │ │ │ ├── EventPlayerItemHandSwap.java │ │ │ │ │ ├── DataPlayerEvent.java │ │ │ │ │ ├── EventPlayerItemDrop.java │ │ │ │ │ ├── EventPlayerItemHeld.java │ │ │ │ │ ├── EventPlayerItemDamage.java │ │ │ │ │ └── EventPlayerConsumeItem.java │ │ │ │ └── meta │ │ │ │ │ ├── NBTTagMeta.java │ │ │ │ │ ├── FlagsMeta.java │ │ │ │ │ ├── UnbreakableMeta.java │ │ │ │ │ ├── LoreMeta.java │ │ │ │ │ └── PlayerHeadMeta.java │ │ │ └── tags │ │ │ │ └── Tags.java │ │ ├── network │ │ │ └── messages │ │ │ │ └── MessageConsumer.java │ │ └── chat │ │ │ └── ClickAction.java │ │ ├── package-info.java │ │ ├── compatibility │ │ ├── CompatibilityManager.java │ │ ├── plugins │ │ │ ├── ExecutableItemsIntegration.java │ │ │ ├── itemsadder │ │ │ │ ├── CustomBlock.java │ │ │ │ ├── ItemsAdderRef.java │ │ │ │ └── CustomStack.java │ │ │ ├── mmoitems │ │ │ │ └── MMOItemsRef.java │ │ │ ├── magic │ │ │ │ └── MagicRef.java │ │ │ ├── mythicmobs │ │ │ │ └── MythicMobsRef.java │ │ │ ├── oraxen │ │ │ │ └── OraxenRef.java │ │ │ ├── eco │ │ │ │ └── EcoRef.java │ │ │ ├── OraxenIntegration.java │ │ │ ├── MythicMobsIntegration.java │ │ │ └── ExecutableBlocksIntegration.java │ │ ├── PluginAdapter.java │ │ └── CompatibilityManagerBukkit.java │ │ ├── util │ │ ├── eval │ │ │ ├── context │ │ │ │ ├── EvalContextPlayer.java │ │ │ │ └── EvalContext.java │ │ │ ├── value_providers │ │ │ │ ├── RandomProvider.java │ │ │ │ ├── ValueProviderFloat.java │ │ │ │ ├── ValueProviderInteger.java │ │ │ │ ├── ValueProviderIntegerVar.java │ │ │ │ ├── AbstractValueProvider.java │ │ │ │ ├── ValueProviderStringVar.java │ │ │ │ ├── ValueProviderFloatVar.java │ │ │ │ ├── ValueProviderStringConst.java │ │ │ │ ├── ValueProviderIntegerConst.java │ │ │ │ └── ValueProviderVariable.java │ │ │ └── operators │ │ │ │ ├── LogicalOperatorNot.java │ │ │ │ └── LogicalOperator.java │ │ ├── json │ │ │ └── jackson │ │ │ │ ├── annotations │ │ │ │ ├── KeyedBaseType.java │ │ │ │ └── OptionalRegexCreator.java │ │ │ │ ├── ValueSerializer.java │ │ │ │ ├── ValueDeserializer.java │ │ │ │ └── serialization │ │ │ │ └── PotionEffectTypeSerialization.java │ │ ├── math │ │ │ └── Triangle.java │ │ ├── protection │ │ │ └── LWCUtil.java │ │ ├── particles │ │ │ └── pos │ │ │ │ ├── ParticlePos.java │ │ │ │ ├── ParticlePosLocation.java │ │ │ │ ├── ParticlePosEntity.java │ │ │ │ ├── ParticlePosBlock.java │ │ │ │ └── ParticlePosPlayer.java │ │ ├── Keyed.java │ │ ├── inventory │ │ │ └── item_builder │ │ │ │ └── ItemBuilder.java │ │ └── RandomUtils.java │ │ ├── registry │ │ ├── UniqueTypeRegistrySimple.java │ │ ├── Registry.java │ │ ├── TypeRegistrySimple.java │ │ ├── RegistryParticleEffect.java │ │ ├── RegistryParticleAnimation.java │ │ └── RegistrySimple.java │ │ ├── messages │ │ ├── Messages.java │ │ ├── InputButtonMessage.java │ │ └── MessageFactory.java │ │ └── annotations │ │ └── WUPluginIntegration.java └── build.gradle.kts ├── gradle └── wrapper │ └── gradle-wrapper.properties ├── settings.gradle.kts ├── plugin-compatibility ├── build.gradle.kts └── src │ └── main │ └── java │ └── me │ └── wolfyscript │ └── utilities │ └── compatibility │ └── plugins │ ├── fancybags │ └── FancyBagsImpl.java │ ├── denizen │ └── DenizenIntegrationImpl.java │ └── placeholderapi │ └── value_providers │ └── ValueProviderStringPAPI.java └── .github └── workflows ├── create_release.yml └── publish_release.yml /src/main/resources/lang/en_US.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | group=com.wolfyscript.wolfyutils.spigot 2 | version=4.19.1.2 3 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/Copyable.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities; 2 | 3 | public interface Copyable { 4 | 5 | T copy(); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/verification/ObjectVerifier.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.verification; 2 | 3 | public interface ObjectVerifier extends Verifier { 4 | } 5 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains the implementation and other files that are dependent on Spigot. 3 | */ 4 | package com.wolfyscript.utilities.bukkit; -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/nms/inventory/generated/PermissionReference.java: -------------------------------------------------------------------------------- 1 | package me.wolfyscript.utilities.api.nms.inventory.generated; 2 | 3 | public interface PermissionReference { 4 | } 5 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This package contains all the files that are required to keep 3 | * backwards compatibility. 4 | * New file should be created in {@link com.wolfyscript.utilities} 5 | */ 6 | package me.wolfyscript.utilities; -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This package may only include sub-packages and files that are server-platform independent and are not 3 | * implemented by other platform implementations. For example utils 4 | */ 5 | package com.wolfyscript.utilities; -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/compatibility/CompatibilityManager.java: -------------------------------------------------------------------------------- 1 | package me.wolfyscript.utilities.compatibility; 2 | 3 | public interface CompatibilityManager { 4 | 5 | void init(); 6 | 7 | boolean has1_20Features(); 8 | 9 | Plugins getPlugins(); 10 | } 11 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/verification/CollectionVerifier.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.verification; 2 | 3 | import java.util.Collection; 4 | 5 | public interface CollectionVerifier extends Verifier> { 6 | 7 | Verifier getElementVerifier(); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/events/persistent/BlockStorageEvent.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.events.persistent; 2 | 3 | import com.wolfyscript.utilities.bukkit.persistent.world.BlockStorage; 4 | 5 | public interface BlockStorageEvent { 6 | 7 | BlockStorage getStorage(); 8 | } 9 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/adapters/PlayerImpl.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.adapters; 2 | 3 | import org.bukkit.entity.Player; 4 | 5 | public class PlayerImpl extends EntityImpl { 6 | 7 | public PlayerImpl(Player player) { 8 | super(player); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Jan 20 20:02:26 CET 2025 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip 5 | networkTimeout=10000 6 | validateDistributionUrl=true 7 | zipStoreBase=GRADLE_USER_HOME 8 | zipStorePath=wrapper/dists 9 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/adapters/BukkitRefAdapter.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.adapters; 2 | 3 | public abstract class BukkitRefAdapter { 4 | 5 | protected final T bukkitRef; 6 | 7 | protected BukkitRefAdapter(T bukkitRef) { 8 | this.bukkitRef = bukkitRef; 9 | } 10 | 11 | public T getBukkitRef() { 12 | return bukkitRef; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/adapters/LocationImpl.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.adapters; 2 | 3 | import com.wolfyscript.utilities.common.adapters.Location; 4 | 5 | public class LocationImpl extends BukkitRefAdapter implements Location { 6 | 7 | public LocationImpl(org.bukkit.Location bukkitRef) { 8 | super(bukkitRef); 9 | } 10 | 11 | 12 | } 13 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/util/eval/context/EvalContextPlayer.java: -------------------------------------------------------------------------------- 1 | package me.wolfyscript.utilities.util.eval.context; 2 | 3 | import org.bukkit.entity.Player; 4 | 5 | public class EvalContextPlayer extends EvalContext { 6 | 7 | private final Player player; 8 | 9 | public EvalContextPlayer(Player player) { 10 | this.player = player; 11 | } 12 | 13 | public Player getPlayer() { 14 | return player; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.name = "wolfyutils-spigot" 2 | 3 | pluginManagement { 4 | repositories { 5 | // mavenLocal() 6 | mavenCentral() 7 | gradlePluginPortal() 8 | maven("https://artifacts.wolfyscript.com/artifactory/gradle-dev") 9 | } 10 | } 11 | 12 | sequenceOf( 13 | "core", 14 | "plugin-compatibility" 15 | ).forEach { 16 | include(":${it}") 17 | project(":${it}").projectDir = file(it.replace(":", "/")) 18 | } 19 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/dependency/Dependency.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.dependency; 2 | 3 | /** 4 | * Represents a Dependency of a type/instance. 5 | * This interface may be implemented and then provided via a custom {@link DependencyResolver} implementation. 6 | */ 7 | public interface Dependency { 8 | 9 | /** 10 | * Checks if the dependency is loaded and available. 11 | * 12 | * @return true when available; false otherwise 13 | */ 14 | boolean isAvailable(); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/json/jackson/MissingDependencyException.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.json.jackson; 2 | 3 | public class MissingDependencyException extends RuntimeException { 4 | 5 | public MissingDependencyException(String message) { 6 | super(message); 7 | } 8 | 9 | public MissingDependencyException(String message, Throwable cause) { 10 | super(message, cause); 11 | } 12 | 13 | public MissingDependencyException(Throwable cause) { 14 | super(cause); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/json/jackson/MissingImplementationException.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.json.jackson; 2 | 3 | public class MissingImplementationException extends RuntimeException { 4 | 5 | public MissingImplementationException(String message) { 6 | super(message); 7 | } 8 | 9 | public MissingImplementationException(String message, Throwable cause) { 10 | super(message, cause); 11 | } 12 | 13 | public MissingImplementationException(Throwable cause) { 14 | super(cause); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/nms/inventory/NMSInventoryUtils.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.nms.inventory; 2 | 3 | import me.wolfyscript.utilities.util.NamespacedKey; 4 | import me.wolfyscript.utilities.util.version.MinecraftVersions; 5 | import me.wolfyscript.utilities.util.version.ServerVersion; 6 | import org.bukkit.inventory.Inventory; 7 | 8 | public class NMSInventoryUtils { 9 | 10 | @Deprecated(forRemoval = true, since = "4.17") 11 | public static void setCurrentRecipe(Inventory inventory, NamespacedKey recipeId) { 12 | // skip on latest versions 13 | } 14 | 15 | 16 | } 17 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/world/items/reference/LegacyParser.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.world.items.reference; 2 | 3 | import com.fasterxml.jackson.databind.JsonNode; 4 | 5 | import java.util.Optional; 6 | 7 | /** 8 | * Marks a legacy StackIdentifier Parser, that parses the StackIdentifier from the old {@link me.wolfyscript.utilities.api.inventory.custom_items.references.APIReference} data "format". 9 | * 10 | * @param The type of the StackIdentifier 11 | */ 12 | public interface LegacyParser { 13 | 14 | Optional from(JsonNode legacyData); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/resources/config.yml: -------------------------------------------------------------------------------- 1 | stack_identifiers: 2 | priorities: 3 | "wolfyutilities:mmoitems": 2000 4 | "wolfyutilities:oraxen": 1900 5 | "wolfyutilities:executableitems": 1800 6 | "wolfyutilities:executableblocks": 1700 7 | "wolfyutilities:mythicmobs": 1600 8 | "wolfyutilities:itemsadder": 1500 9 | "wolfyutilities:magic": 600 10 | "wolfyutilities:eco": 100 11 | "wolfyutilities:fancybags": 0 12 | "wolfyutilities:denizen": 0 13 | "wolfyutilities:wolfyutils": 0 14 | # Make sure the bukkit identifier has the lowest priority at all times! This will otherwise overwrite everything 15 | "wolfyutilities:bukkit": -4096 16 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/dependency/PluginIntegrationDependencyResolverSettings.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.dependency; 2 | 3 | import me.wolfyscript.utilities.compatibility.PluginIntegration; 4 | 5 | import java.lang.annotation.ElementType; 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.RetentionPolicy; 8 | import java.lang.annotation.Target; 9 | 10 | @Retention(RetentionPolicy.RUNTIME) 11 | @Target(ElementType.TYPE) 12 | public @interface PluginIntegrationDependencyResolverSettings { 13 | 14 | String pluginName(); 15 | 16 | Class integration(); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/adapters/BukkitWrapper.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.adapters; 2 | 3 | import com.wolfyscript.utilities.common.adapters.Entity; 4 | import com.wolfyscript.utilities.common.adapters.Location; 5 | import com.wolfyscript.utilities.common.adapters.World; 6 | 7 | public class BukkitWrapper { 8 | 9 | public static Location adapt(org.bukkit.Location bukkitLoc) { 10 | return new LocationImpl(bukkitLoc); 11 | } 12 | 13 | public static Entity adapt(org.bukkit.entity.Entity bukkitEntity) { 14 | return new EntityImpl<>(bukkitEntity); 15 | } 16 | 17 | public static World adapt(org.bukkit.World world) { 18 | return new WorldImpl(world); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/registry/UniqueTypeRegistrySimple.java: -------------------------------------------------------------------------------- 1 | package me.wolfyscript.utilities.registry; 2 | 3 | import com.google.common.collect.BiMap; 4 | import com.google.common.collect.HashBiMap; 5 | import me.wolfyscript.utilities.util.Keyed; 6 | import me.wolfyscript.utilities.util.NamespacedKey; 7 | 8 | public class UniqueTypeRegistrySimple extends AbstractTypeRegistry>, V> { 9 | 10 | public UniqueTypeRegistrySimple(NamespacedKey key, Registries registries) { 11 | super(key, HashBiMap.create(), registries); 12 | } 13 | 14 | public NamespacedKey getKey(Class value) { 15 | return map.inverse().get(value); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/paper/WolfyUtilsBootstrap.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.paper; 2 | 3 | import io.papermc.paper.plugin.bootstrap.BootstrapContext; 4 | import io.papermc.paper.plugin.bootstrap.PluginBootstrap; 5 | import io.papermc.paper.plugin.bootstrap.PluginProviderContext; 6 | import org.bukkit.plugin.java.JavaPlugin; 7 | import org.jetbrains.annotations.NotNull; 8 | 9 | public class WolfyUtilsBootstrap implements PluginBootstrap { 10 | 11 | @Override 12 | public void bootstrap(@NotNull BootstrapContext context) { 13 | 14 | } 15 | 16 | @Override 17 | public @NotNull JavaPlugin createPlugin(@NotNull PluginProviderContext context) { 18 | return PluginBootstrap.super.createPlugin(context); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/adapters/WorldImpl.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.adapters; 2 | 3 | import com.wolfyscript.utilities.common.adapters.Block; 4 | import com.wolfyscript.utilities.common.adapters.Location; 5 | import com.wolfyscript.utilities.common.adapters.World; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | public class WorldImpl extends BukkitRefAdapter implements World { 9 | 10 | WorldImpl(org.bukkit.World bukkitRef) { 11 | super(bukkitRef); 12 | } 13 | 14 | @Override 15 | public @NotNull Block getBlockAt(int i, int i1, int i2) { 16 | return null; 17 | } 18 | 19 | @Override 20 | public Block getBlockAt(Location location) { 21 | return null; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/nms/ServerProperties.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.nms; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.FileReader; 5 | import java.io.IOException; 6 | import java.util.Properties; 7 | 8 | public class ServerProperties { 9 | 10 | private static Properties properties = null; 11 | 12 | public static Properties get() { 13 | if (properties == null) { 14 | properties = new Properties(); 15 | try (BufferedReader is = new BufferedReader(new FileReader("server.properties"))) { 16 | properties.load(is); 17 | } catch (IOException e) { 18 | throw new RuntimeException(e); 19 | } 20 | } 21 | return properties; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/compatibility/plugins/ExecutableItemsIntegration.java: -------------------------------------------------------------------------------- 1 | package me.wolfyscript.utilities.compatibility.plugins; 2 | 3 | import me.wolfyscript.utilities.compatibility.PluginIntegration; 4 | 5 | import java.util.List; 6 | 7 | public interface ExecutableItemsIntegration extends PluginIntegration { 8 | 9 | String PLUGIN_NAME = "ExecutableItems"; 10 | 11 | 12 | /** 13 | * Verify if id is a valid ExecutableItem ID 14 | * 15 | * @param id The ID to verify 16 | * @return true if it is a valid ID, false otherwise 17 | **/ 18 | boolean isValidID(String id); 19 | 20 | /** 21 | * Get all ExecutableItems Ids 22 | * 23 | * @return All ExecutableItems ids 24 | **/ 25 | List getExecutableItemIdsList(); 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/nms/fallback/FallbackBlockUtilImpl.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.nms.fallback; 2 | 3 | import me.wolfyscript.utilities.api.nms.BlockUtil; 4 | import me.wolfyscript.utilities.api.nms.NMSUtil; 5 | import me.wolfyscript.utilities.api.nms.block.NMSBrewingStand; 6 | import me.wolfyscript.utilities.util.version.ServerVersion; 7 | import org.apache.commons.lang3.NotImplementedException; 8 | import org.bukkit.block.BrewingStand; 9 | 10 | public class FallbackBlockUtilImpl extends BlockUtil { 11 | 12 | FallbackBlockUtilImpl(NMSUtil nmsUtil) { 13 | super(nmsUtil); 14 | } 15 | 16 | @Override 17 | public NMSBrewingStand getNmsBrewingStand(BrewingStand brewingStand) { 18 | throw new NotImplementedException("NMS Brewing Stand is not yet implement for " + ServerVersion.getVersion()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/resources/plugin.yml: -------------------------------------------------------------------------------- 1 | name: WolfyUtilities 2 | version: '${project.version}' 3 | main: com.wolfyscript.utilities.bukkit.WolfyCoreBukkit 4 | api-version: 1.21.4 5 | authors: [ WolfyScript ] 6 | load: STARTUP 7 | depend: 8 | - NBTAPI 9 | 10 | libraries: 11 | - "com.google.inject:guice:5.1.0" 12 | - "org.apache.commons:commons-lang3:3.12.0" 13 | - "it.unimi.dsi:fastutil:8.5.6" 14 | 15 | loadbefore: 16 | - ChatColor 17 | - ChatColor2 18 | - StackableItems 19 | - DiSky 20 | - EpicWorldGenerator 21 | 22 | softdepend: 23 | - Magic 24 | - LWC 25 | - PlotSquared 26 | - WorldGuard 27 | - MythicMobs 28 | - MMOItems 29 | - BungeeChat 30 | - mcMMO 31 | - Oraxen 32 | - ItemsAdder 33 | - PlaceholderAPI 34 | - eco 35 | - zAuctionHouseV3 36 | - SCore 37 | 38 | permissions: 39 | wolfyutilities.command.query_debug: 40 | default: op 41 | description: "Command to debug NBT querries on the item in the hand" -------------------------------------------------------------------------------- /plugin-compatibility/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("com.wolfyscript.wolfyutils.spigot.java-conventions") 3 | } 4 | 5 | dependencies { 6 | compileOnly("com.ssomar.executableblocks:ExecutableBlocks:4.24.4.15") 7 | compileOnly("com.ssomar.score:SCore:4.24.4.15") 8 | compileOnly("com.denizenscript:denizen:1.2.5-SNAPSHOT") 9 | compileOnly("me.clip:placeholderapi:2.11.6") 10 | compileOnly("com.willfp:eco:6.75.1") 11 | compileOnly("dev.lone:api-itemsadder:4.0.2-beta-release-11") 12 | compileOnly("com.elmakers.mine.bukkit:MagicAPI:10.2") 13 | /* compileOnly("com.github.AlessioGr:FancyBags:2.7.0")*/ 14 | compileOnly("io.th0rgal:oraxen:1.163.0") 15 | compileOnly("io.lumine:MythicLib:1.1.5") 16 | compileOnly("net.Indyuce:MMOItems-API:6.9.2-SNAPSHOT") 17 | compileOnly("io.lumine:Mythic-Dist:5.6.1") 18 | compileOnly("com.google.inject:guice:5.1.0") 19 | compileOnly(project(":core")) 20 | } 21 | 22 | description = "plugin-compatibility" -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/nms/fallback/FallbackInventoryUtilImpl.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.nms.fallback; 2 | 3 | import me.wolfyscript.utilities.api.nms.InventoryUtil; 4 | import me.wolfyscript.utilities.api.nms.NMSUtil; 5 | import me.wolfyscript.utilities.util.inventory.CreativeModeTab; 6 | import org.bukkit.Material; 7 | 8 | public class FallbackInventoryUtilImpl extends InventoryUtil { 9 | 10 | public FallbackInventoryUtilImpl(NMSUtil nmsUtil) { 11 | super(nmsUtil); 12 | } 13 | 14 | @Override 15 | public void initItemCategories() { 16 | // Since 1.19.3 the server has no info about the Creative menu categories anymore! 17 | // Future versions might sort the items manually, but maybe not... 18 | for (Material material : Material.values()) { 19 | CreativeModeTab.of("building_blocks").ifPresent(creativeModeTab -> creativeModeTab.registerMaterial(material)); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/nbt/QueryNodeListLong.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.nbt; 2 | 3 | import com.fasterxml.jackson.annotation.JacksonInject; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import de.tr7zw.nbtapi.NBTType; 6 | import me.wolfyscript.utilities.util.NamespacedKey; 7 | 8 | import java.util.List; 9 | 10 | public class QueryNodeListLong extends QueryNodeList { 11 | 12 | public static final NamespacedKey TYPE = NamespacedKey.wolfyutilties("list/long"); 13 | 14 | public QueryNodeListLong(@JsonProperty("elements") List> elements, @JacksonInject("key") String key, @JacksonInject("parent_path") String path) { 15 | super(TYPE, elements, key, path, NBTType.NBTTagByte, Long.class); 16 | } 17 | 18 | public QueryNodeListLong(QueryNodeList other) { 19 | super(other); 20 | } 21 | 22 | @Override 23 | public QueryNodeListLong copy() { 24 | return new QueryNodeListLong(this); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/nbt/QueryNodeListInt.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.nbt; 2 | 3 | import com.fasterxml.jackson.annotation.JacksonInject; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import de.tr7zw.nbtapi.NBTType; 6 | import me.wolfyscript.utilities.util.NamespacedKey; 7 | 8 | import java.util.List; 9 | 10 | public class QueryNodeListInt extends QueryNodeList { 11 | 12 | public static final NamespacedKey TYPE = NamespacedKey.wolfyutilties("list/int"); 13 | 14 | public QueryNodeListInt(@JsonProperty("elements") List> elements, @JacksonInject("key") String key, @JacksonInject("parent_path") String path) { 15 | super(TYPE, elements, key, path, NBTType.NBTTagByte, Integer.class); 16 | } 17 | 18 | public QueryNodeListInt(QueryNodeList other) { 19 | super(other); 20 | } 21 | 22 | @Override 23 | public QueryNodeListInt copy() { 24 | return new QueryNodeListInt(this); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/nbt/QueryNodeListFloat.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.nbt; 2 | 3 | import com.fasterxml.jackson.annotation.JacksonInject; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import de.tr7zw.nbtapi.NBTType; 6 | import me.wolfyscript.utilities.util.NamespacedKey; 7 | 8 | import java.util.List; 9 | 10 | public class QueryNodeListFloat extends QueryNodeList { 11 | 12 | public static final NamespacedKey TYPE = NamespacedKey.wolfyutilties("list/float"); 13 | 14 | public QueryNodeListFloat(@JsonProperty("elements") List> elements, @JacksonInject("key") String key, @JacksonInject("parent_path") String path) { 15 | super(TYPE, elements, key, path, NBTType.NBTTagByte, Float.class); 16 | } 17 | 18 | public QueryNodeListFloat(QueryNodeList other) { 19 | super(other); 20 | } 21 | 22 | @Override 23 | public QueryNodeListFloat copy() { 24 | return new QueryNodeListFloat(this); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/nbt/QueryNodeListDouble.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.nbt; 2 | 3 | import com.fasterxml.jackson.annotation.JacksonInject; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import de.tr7zw.nbtapi.NBTType; 6 | import me.wolfyscript.utilities.util.NamespacedKey; 7 | 8 | import java.util.List; 9 | 10 | public class QueryNodeListDouble extends QueryNodeList { 11 | 12 | public static final NamespacedKey TYPE = NamespacedKey.wolfyutilties("list/double"); 13 | 14 | public QueryNodeListDouble(@JsonProperty("elements") List> elements, @JacksonInject("key") String key, @JacksonInject("parent_path") String path) { 15 | super(TYPE, elements, key, path, NBTType.NBTTagByte, Double.class); 16 | } 17 | 18 | public QueryNodeListDouble(QueryNodeList other) { 19 | super(other); 20 | } 21 | 22 | @Override 23 | public QueryNodeListDouble copy() { 24 | return new QueryNodeListDouble(this); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/nbt/QueryNodeListString.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.nbt; 2 | 3 | import com.fasterxml.jackson.annotation.JacksonInject; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import de.tr7zw.nbtapi.NBTType; 6 | import me.wolfyscript.utilities.util.NamespacedKey; 7 | 8 | import java.util.List; 9 | 10 | public class QueryNodeListString extends QueryNodeList { 11 | 12 | public static final NamespacedKey TYPE = NamespacedKey.wolfyutilties("list/string"); 13 | 14 | public QueryNodeListString(@JsonProperty("elements") List> elements, @JacksonInject("key") String key, @JacksonInject("parent_path") String path) { 15 | super(TYPE, elements, key, path, NBTType.NBTTagByte, String.class); 16 | } 17 | 18 | public QueryNodeListString(QueryNodeList other) { 19 | super(other); 20 | } 21 | 22 | @Override 23 | public QueryNodeListString copy() { 24 | return new QueryNodeListString(this); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/dependency/DependencySource.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.dependency; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Marks a field as a source of possible dependencies, that should be crawled when resolving dependencies. 10 | * 11 | */ 12 | @Retention(RetentionPolicy.RUNTIME) 13 | @Target({ElementType.FIELD}) 14 | public @interface DependencySource { 15 | 16 | /** 17 | * Specifies if this field should be iterated when it is {@link Iterable}. 18 | *

19 | * When true it iterates over the values and crawls each value (& its type).
20 | * When false it treats the field and crawls the types fields instead. 21 | *

22 | * 23 | * @return true if the resolver should iterate the values of this field; false when to treat this as a normal type 24 | */ 25 | boolean flattenIterable() default true; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/compatibility/plugins/itemsadder/CustomBlock.java: -------------------------------------------------------------------------------- 1 | package me.wolfyscript.utilities.compatibility.plugins.itemsadder; 2 | 3 | import org.bukkit.Location; 4 | import org.bukkit.block.Block; 5 | import org.bukkit.block.data.BlockData; 6 | import org.bukkit.inventory.ItemStack; 7 | 8 | import java.util.List; 9 | import java.util.Optional; 10 | 11 | public interface CustomBlock { 12 | 13 | Optional place(Location location); 14 | 15 | boolean remove(); 16 | 17 | BlockData getBaseBlockData(); 18 | 19 | Block getBlock(); 20 | 21 | boolean isPlaced(); 22 | 23 | List getLoot(boolean includeSelfBlock); 24 | 25 | List getLoot(); 26 | 27 | List getLoot(ItemStack tool, boolean includeSelfBlock); 28 | 29 | int getOriginalLightLevel(); 30 | 31 | void setCurrentLightLevel(int level); 32 | 33 | boolean playBreakEffect(); 34 | 35 | boolean playBreakParticles(); 36 | 37 | boolean playBreakSound(); 38 | 39 | boolean playPlaceSound(); 40 | } 41 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/compatibility/plugins/mmoitems/MMOItemsRef.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.compatibility.plugins.mmoitems; 20 | 21 | public interface MMOItemsRef { 22 | } 23 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/compatibility/plugins/magic/MagicRef.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.compatibility.plugins.magic; 20 | 21 | public interface MagicRef { 22 | 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/compatibility/plugins/mythicmobs/MythicMobsRef.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.compatibility.plugins.mythicmobs; 20 | 21 | public interface MythicMobsRef { 22 | } 23 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/nms/nbt/NBTTagEnd.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.nms.nbt; 20 | 21 | @Deprecated(since = "4.16.2.0") 22 | public interface NBTTagEnd extends NBTBase { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/nms/nbt/NBTTagInt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.nms.nbt; 20 | 21 | @Deprecated(since = "4.16.2.0") 22 | public interface NBTTagInt extends NBTNumber { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/nms/nbt/NBTTagDouble.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.nms.nbt; 20 | 21 | @Deprecated(since = "4.16.2.0") 22 | public interface NBTTagDouble extends NBTNumber { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/nms/nbt/NBTTagFloat.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.nms.nbt; 20 | 21 | @Deprecated(since = "4.16.2.0") 22 | public interface NBTTagFloat extends NBTNumber { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/nms/nbt/NBTTagLong.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.nms.nbt; 20 | 21 | @Deprecated(since = "4.16.2.0") 22 | public interface NBTTagLong extends NBTNumber { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/nms/nbt/NBTTagShort.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.nms.nbt; 20 | 21 | @Deprecated(since = "4.16.2.0") 22 | public interface NBTTagShort extends NBTNumber { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/nbt/QueryNodeListCompound.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.nbt; 2 | 3 | import com.fasterxml.jackson.annotation.JacksonInject; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import de.tr7zw.nbtapi.NBTCompound; 6 | import de.tr7zw.nbtapi.NBTType; 7 | import me.wolfyscript.utilities.util.NamespacedKey; 8 | 9 | import java.util.List; 10 | 11 | public class QueryNodeListCompound extends QueryNodeList { 12 | 13 | public static final NamespacedKey TYPE = NamespacedKey.wolfyutilties("list/compound"); 14 | 15 | public QueryNodeListCompound(@JsonProperty("elements") List> elements, @JacksonInject("key") String key, @JacksonInject("parent_path") String path) { 16 | super(TYPE, elements, key, path, NBTType.NBTTagCompound, NBTCompound.class); 17 | } 18 | 19 | private QueryNodeListCompound(QueryNodeListCompound other) { 20 | super(other); 21 | } 22 | 23 | @Override 24 | public QueryNodeListCompound copy() { 25 | return new QueryNodeListCompound(this); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/nms/nbt/NBTTagByte.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.nms.nbt; 20 | 21 | @Deprecated(since = "4.16.2.0") 22 | public interface NBTTagByte extends NBTNumber { 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/nms/nbt/NBTTagByteArray.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.nms.nbt; 20 | 21 | @Deprecated(since = "4.16.2.0") 22 | public interface NBTTagByteArray extends NBTBase { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/nms/nbt/NBTTagIntArray.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.nms.nbt; 20 | 21 | @Deprecated(since = "4.16.2.0") 22 | public interface NBTTagIntArray extends NBTBase { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/nms/nbt/NBTTagLongArray.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.nms.nbt; 20 | 21 | @Deprecated(since = "4.16.2.0") 22 | public interface NBTTagLongArray extends NBTBase { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/compatibility/plugins/oraxen/OraxenRef.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.compatibility.plugins.oraxen; 20 | 21 | public interface OraxenRef { 22 | 23 | String getItemID(); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/compatibility/plugins/itemsadder/ItemsAdderRef.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.compatibility.plugins.itemsadder; 20 | 21 | public interface ItemsAdderRef { 22 | 23 | String getItemID(); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/nms/nbt/NBTTagString.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.nms.nbt; 20 | 21 | @Deprecated(since = "4.16.2.0") 22 | public interface NBTTagString extends NBTBase { 23 | 24 | String asString(); 25 | } 26 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/nms/nbt/NBTBase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.nms.nbt; 20 | 21 | @Deprecated(since = "4.16.2.0") 22 | public interface NBTBase { 23 | 24 | byte getTypeId(); 25 | 26 | NBTTagType getType(); 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/compatibility/plugins/eco/EcoRef.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.compatibility.plugins.eco; 20 | 21 | import org.bukkit.NamespacedKey; 22 | 23 | public interface EcoRef { 24 | 25 | NamespacedKey getKey(); 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/events/persistent/BlockStorageExpEvent.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.events.persistent; 2 | 3 | import com.wolfyscript.utilities.bukkit.persistent.world.BlockStorage; 4 | import org.bukkit.block.Block; 5 | import org.bukkit.event.HandlerList; 6 | import org.bukkit.event.block.BlockExpEvent; 7 | import org.jetbrains.annotations.NotNull; 8 | 9 | public class BlockStorageExpEvent extends BlockExpEvent implements BlockStorageEvent { 10 | 11 | private static final HandlerList handlers = new HandlerList(); 12 | 13 | protected BlockStorage blockStorage; 14 | 15 | public BlockStorageExpEvent(@NotNull Block block, BlockStorage blockStorage, int exp) { 16 | super(block, exp); 17 | this.blockStorage = blockStorage; 18 | } 19 | 20 | 21 | @NotNull 22 | @Override 23 | public HandlerList getHandlers() { 24 | return handlers; 25 | } 26 | 27 | public static HandlerList getHandlerList() { 28 | return handlers; 29 | } 30 | 31 | @Override 32 | public BlockStorage getStorage() { 33 | return blockStorage; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /.github/workflows/create_release.yml: -------------------------------------------------------------------------------- 1 | name: create_release.yml 2 | on: 3 | push: 4 | tags: 5 | - "v-**" 6 | 7 | permissions: 8 | contents: write 9 | pull-requests: read 10 | 11 | jobs: 12 | release: 13 | if: ${{ startsWith(github.ref, 'refs/tags/') }} 14 | runs-on: ubuntu-latest 15 | steps: 16 | - name: Checkout project sources 17 | uses: actions/checkout@v4 18 | 19 | - name: Get actual Version 20 | id: get_version 21 | run: | 22 | version=$(echo ${{github.ref_name}} | cut -d- -f2) 23 | echo "::set-output name=version::$version" 24 | 25 | - name: Build Changelog 26 | id: github_release 27 | uses: mikepenz/release-changelog-builder-action@v5 28 | env: 29 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 30 | with: 31 | mode: HYBRID 32 | configuration: .github/release_config.json 33 | 34 | - name: Create Release 35 | uses: softprops/action-gh-release@v2 36 | with: 37 | draft: true 38 | name: ${{steps.get_version.outputs.version}} 39 | body: ${{steps.github_release.outputs.changelog}} -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/inventory/gui/button/ButtonType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.inventory.gui.button; 20 | 21 | public enum ButtonType { 22 | 23 | DUMMY, 24 | TOGGLE, 25 | NORMAL, 26 | CHOICES, 27 | ITEM_SLOT 28 | 29 | } 30 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/inventory/custom_items/actions/DataEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.inventory.custom_items.actions; 20 | 21 | import org.bukkit.event.Event; 22 | 23 | public interface DataEvent { 24 | 25 | T getEvent(); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/util/eval/value_providers/RandomProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.util.eval.value_providers; 20 | 21 | import java.util.Random; 22 | 23 | public interface RandomProvider extends ValueProvider { 24 | 25 | V sample(Random random); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /core/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar 2 | 3 | plugins { 4 | id("com.wolfyscript.wolfyutils.spigot.java-conventions") 5 | alias(libs.plugins.goooler.shadow) 6 | } 7 | 8 | dependencies { 9 | compileOnly(group = "de.iani.cubeside", name = "LWC", version = "5.0.16-SNAPSHOT") 10 | compileOnly(group = "com.sk89q.worldedit", name = "worldedit-bukkit", version = "7.3.10") 11 | compileOnly(group = "com.sk89q.worldguard", name = "worldguard-bukkit", version = "7.0.13") 12 | compileOnly(group = "com.plotsquared", name = "PlotSquared-Core", version = "6.4.0") 13 | compileOnly(group = "com.plotsquared", name = "PlotSquared-Bukkit", version = "6.4.0") 14 | compileOnly(group = "com.gmail.nossr50.mcMMO", name = "mcMMO", version = "2.2.030") 15 | compileOnly(libs.inject.guice) 16 | compileOnly(libs.reflections) 17 | compileOnly(libs.javassist) 18 | compileOnly(libs.adventure.api) 19 | compileOnly(libs.adventure.platform.bukkit) 20 | compileOnly(libs.adventure.minimessage) 21 | } 22 | 23 | description = "core" 24 | 25 | 26 | tasks.named("shadowJar") { 27 | dependencies { 28 | include(libs.wolfyutils.toString()) 29 | } 30 | } -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/nms/fallback/FallbackNMSEntry.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.nms.fallback; 2 | 3 | import me.wolfyscript.utilities.api.WolfyUtilities; 4 | import me.wolfyscript.utilities.api.nms.ItemUtil; 5 | import me.wolfyscript.utilities.api.nms.NBTUtil; 6 | import me.wolfyscript.utilities.api.nms.NMSUtil; 7 | import me.wolfyscript.utilities.api.nms.NetworkUtil; 8 | 9 | /** 10 | * Used when no NMSUtil is available for the server Minecraft version. 11 | */ 12 | public class FallbackNMSEntry extends NMSUtil { 13 | 14 | /** 15 | * The class that implements this NMSUtil needs to have a constructor with just the WolfyUtilities parameter. 16 | * 17 | * @param wolfyUtilities 18 | */ 19 | public FallbackNMSEntry(WolfyUtilities wolfyUtilities) { 20 | super(wolfyUtilities); 21 | this.inventoryUtil = new FallbackInventoryUtilImpl(this); 22 | this.blockUtil = new FallbackBlockUtilImpl(this); 23 | this.itemUtil = new ItemUtil(this) { }; 24 | this.nbtUtil = new NBTUtil(this) { }; 25 | this.recipeUtil = new FallbackRecipeUtilImpl(this); 26 | this.networkUtil = new NetworkUtil(this) { }; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/compatibility/plugins/OraxenIntegration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.compatibility.plugins; 20 | 21 | import me.wolfyscript.utilities.compatibility.PluginIntegration; 22 | 23 | public interface OraxenIntegration extends PluginIntegration { 24 | 25 | String KEY = "Oraxen"; 26 | 27 | 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/util/eval/value_providers/ValueProviderFloat.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.util.eval.value_providers; 20 | 21 | import me.wolfyscript.utilities.util.eval.context.EvalContext; 22 | 23 | public interface ValueProviderFloat extends ValueProvider { 24 | 25 | Float getValue(EvalContext context); 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/util/eval/value_providers/ValueProviderInteger.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.util.eval.value_providers; 20 | 21 | import me.wolfyscript.utilities.util.eval.context.EvalContext; 22 | 23 | public interface ValueProviderInteger extends ValueProvider { 24 | 25 | @Override 26 | Integer getValue(EvalContext context); 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/nms/nbt/NBTNumber.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.nms.nbt; 20 | 21 | @Deprecated(since = "4.16.2.0") 22 | public interface NBTNumber extends NBTBase { 23 | 24 | long asLong(); 25 | 26 | int asInt(); 27 | 28 | short asShort(); 29 | 30 | byte asByte(); 31 | 32 | double asDouble(); 33 | 34 | float asFloat(); 35 | } 36 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/inventory/gui/ChatInputAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.inventory.gui; 20 | 21 | import me.wolfyscript.utilities.api.inventory.gui.cache.CustomCache; 22 | import org.bukkit.entity.Player; 23 | 24 | public interface ChatInputAction { 25 | 26 | boolean onChat(GuiHandler guiHandler, Player player, String msg, String[] args); 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/messages/Messages.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.messages; 20 | 21 | import me.wolfyscript.utilities.util.NamespacedKey; 22 | 23 | public interface Messages { 24 | 25 | String KEY = "wolfyutils"; 26 | NamespacedKey CONNECT_REQUEST = new NamespacedKey(KEY, "connection/request"); 27 | NamespacedKey CONNECT_INFO = new NamespacedKey(KEY, "connection/info"); 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/dependency/DependencyResolverSettings.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.dependency; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Used to specify the {@link DependencyResolver} for the annotated type. 10 | *

11 | * This is used for classes & values that may depend on something on their own. 12 | * Dependencies are resolved by crawling over the tree of classes & values, that are annotated with {@link DependencyResolverSettings} and {@link DependencySource}. 13 | *

14 | *

15 | * This annotation is only necessary when the annotated type (or its instances) provide a list of their own dependencies. 16 | * If you are looking for propagating dependencies from the fields use {@link DependencySource} to annotate the fields instead! 17 | *

18 | */ 19 | @Retention(RetentionPolicy.RUNTIME) 20 | @Target(ElementType.TYPE) 21 | public @interface DependencyResolverSettings { 22 | 23 | /** 24 | * Specifies the type of the {@link DependencyResolver} 25 | * 26 | * @return The type of the {@link DependencyResolver} to use 27 | */ 28 | Class value(); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/network/messages/MessageConsumer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.network.messages; 20 | 21 | import me.wolfyscript.utilities.api.WolfyUtilities; 22 | import me.wolfyscript.utilities.api.nms.network.MCByteBuf; 23 | import org.bukkit.entity.Player; 24 | 25 | public interface MessageConsumer { 26 | 27 | void accept(Player player, WolfyUtilities wolfyUtils, MCByteBuf buf); 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/listeners/PlayerListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package com.wolfyscript.utilities.bukkit.listeners; 20 | 21 | import org.bukkit.event.EventHandler; 22 | import org.bukkit.event.Listener; 23 | import org.bukkit.event.player.PlayerJoinEvent; 24 | 25 | public class PlayerListener implements Listener { 26 | 27 | @EventHandler 28 | public void onJoin(PlayerJoinEvent event) { 29 | 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/inventory/custom_items/actions/EventPlayer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.inventory.custom_items.actions; 20 | 21 | import me.wolfyscript.utilities.util.NamespacedKey; 22 | 23 | public abstract class EventPlayer extends Event { 24 | 25 | protected EventPlayer(NamespacedKey key, Class dataType) { 26 | super(key, dataType); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/nms/UtilComponent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.nms; 20 | 21 | abstract class UtilComponent { 22 | 23 | private final NMSUtil nmsUtil; 24 | 25 | protected UtilComponent(NMSUtil nmsUtil) { 26 | this.nmsUtil = nmsUtil; 27 | } 28 | 29 | /** 30 | * @return The current NMSUtil 31 | */ 32 | public NMSUtil getNmsUtil() { 33 | return nmsUtil; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/compatibility/plugins/MythicMobsIntegration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.compatibility.plugins; 20 | 21 | import me.wolfyscript.utilities.compatibility.PluginIntegration; 22 | import org.bukkit.Location; 23 | 24 | public interface MythicMobsIntegration extends PluginIntegration { 25 | 26 | String KEY = "MythicMobs"; 27 | 28 | void spawnMob(String mobName, Location location, int mobLevel); 29 | } 30 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/annotations/WUPluginIntegration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.annotations; 20 | 21 | import java.lang.annotation.ElementType; 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | import java.lang.annotation.Target; 25 | 26 | @Retention(RetentionPolicy.RUNTIME) 27 | @Target(ElementType.TYPE) 28 | public @interface WUPluginIntegration { 29 | 30 | String pluginName(); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/items/CustomBlockSettings.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.items; 2 | 3 | import com.wolfyscript.utilities.Copyable; 4 | 5 | import java.util.Objects; 6 | 7 | public class CustomBlockSettings implements Copyable { 8 | 9 | private boolean useCustomDrops; 10 | 11 | public CustomBlockSettings() { 12 | this.useCustomDrops = true; 13 | } 14 | 15 | private CustomBlockSettings(CustomBlockSettings settings) { 16 | this.useCustomDrops = settings.useCustomDrops; 17 | } 18 | 19 | public boolean isUseCustomDrops() { 20 | return useCustomDrops; 21 | } 22 | 23 | public void setUseCustomDrops(boolean useCustomDrops) { 24 | this.useCustomDrops = useCustomDrops; 25 | } 26 | 27 | @Override 28 | public CustomBlockSettings copy() { 29 | return new CustomBlockSettings(this); 30 | } 31 | 32 | @Override 33 | public boolean equals(Object o) { 34 | if (this == o) return true; 35 | if (o == null || getClass() != o.getClass()) return false; 36 | CustomBlockSettings that = (CustomBlockSettings) o; 37 | return useCustomDrops == that.useCustomDrops; 38 | } 39 | 40 | @Override 41 | public int hashCode() { 42 | return Objects.hash(useCustomDrops); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/compatibility/plugins/ExecutableBlocksIntegration.java: -------------------------------------------------------------------------------- 1 | package me.wolfyscript.utilities.compatibility.plugins; 2 | 3 | import me.wolfyscript.utilities.compatibility.PluginIntegration; 4 | import org.bukkit.NamespacedKey; 5 | import org.bukkit.inventory.ItemStack; 6 | 7 | import java.util.List; 8 | import java.util.Locale; 9 | import java.util.Optional; 10 | 11 | public interface ExecutableBlocksIntegration extends PluginIntegration { 12 | 13 | String PLUGIN_NAME = "ExecutableBlocks"; 14 | NamespacedKey BLOCK_ID = new NamespacedKey(PLUGIN_NAME.toLowerCase(Locale.ROOT), "eb-id"); 15 | 16 | /** 17 | * Verify if id is a valid ExecutableBlock ID 18 | * 19 | * @param id The ID to verify 20 | * @return true if it is a valid ID, false otherwise 21 | **/ 22 | boolean isValidID(String id); 23 | 24 | /** 25 | * Get all ExecutableBlock Ids 26 | * 27 | * @return All ExecutableBlock ids 28 | **/ 29 | List getExecutableBlockIdsList(); 30 | 31 | /** 32 | * Gets the ExecutableBlock id that belongs to the specified ItemStack. 33 | * 34 | * @param stack The ItemStack that belongs to an ExecutableBlock 35 | * @return The id of the ExecutableBlock or an empty Optional. 36 | */ 37 | Optional getExecutableBlock(ItemStack stack); 38 | } 39 | -------------------------------------------------------------------------------- /plugin-compatibility/src/main/java/me/wolfyscript/utilities/compatibility/plugins/fancybags/FancyBagsImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | package me.wolfyscript.utilities.compatibility.plugins.fancybags; 3 | 4 | import me.wolfyscript.utilities.annotations.WUPluginIntegration; 5 | import me.wolfyscript.utilities.api.WolfyUtilCore; 6 | import me.wolfyscript.utilities.compatibility.PluginIntegrationAbstract; 7 | import org.bukkit.plugin.Plugin; 8 | 9 | @WUPluginIntegration(pluginName = FancyBagsImpl.KEY) 10 | public class FancyBagsImpl extends PluginIntegrationAbstract { 11 | 12 | public static final String KEY = "FancyBags"; 13 | 14 | */ 15 | /** 16 | * The main constructor that is called whenever the integration is created.
17 | * 18 | * @param core The WolfyUtilCore. 19 | *//* 20 | 21 | protected FancyBagsImpl(WolfyUtilCore core) { 22 | super(core, KEY); 23 | } 24 | 25 | @Override 26 | public void init(Plugin plugin) { 27 | core.registerAPIReference(new FancyBagsItemsRef.Parser()); 28 | core.getRegistries().getStackIdentifierParsers().register(new FancyBagsStackIdentifier.Parser()); 29 | core.getRegistries().getStackIdentifierTypeRegistry().register(FancyBagsStackIdentifier.class); 30 | } 31 | 32 | @Override 33 | public boolean hasAsyncLoading() { 34 | return false; 35 | } 36 | } 37 | */ 38 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/util/json/jackson/annotations/KeyedBaseType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.util.json.jackson.annotations; 20 | 21 | import java.lang.annotation.ElementType; 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | import java.lang.annotation.Target; 25 | 26 | @Retention(RetentionPolicy.RUNTIME) 27 | @Target(ElementType.TYPE) 28 | public @interface KeyedBaseType { 29 | 30 | Class baseType(); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/verification/ObjectVerifierBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ____ _ _ ____ ___ ____ _ _ ____ ____ ____ ____ ___ _ _ _ ____ 3 | * | | | [__ | | | |\/| | |__/ |__| |___ | | |\ | | __ 4 | * |___ |__| ___] | |__| | | |___ | \ | | | | | | \| |__] 5 | * 6 | * CustomCrafting Recipe creation and management tool for Minecraft 7 | * Copyright (C) 2021 WolfyScript 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | package com.wolfyscript.utilities.verification; 24 | 25 | public interface ObjectVerifierBuilder extends VerifierBuilder, ObjectVerifier> { 26 | 27 | 28 | 29 | } 30 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/inventory/custom_items/actions/Data.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.inventory.custom_items.actions; 20 | 21 | import me.wolfyscript.utilities.api.inventory.custom_items.CustomItem; 22 | 23 | public abstract class Data { 24 | 25 | private final CustomItem customItem; 26 | 27 | protected Data(CustomItem customItem) { 28 | this.customItem = customItem; 29 | } 30 | 31 | public CustomItem getCustomItem() { 32 | return customItem; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/registry/Registry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.registry; 20 | 21 | import me.wolfyscript.utilities.util.Keyed; 22 | import me.wolfyscript.utilities.util.NamespacedKey; 23 | 24 | public interface Registry extends IRegistry { 25 | 26 | /** 27 | * Registers a value with its contained {@link NamespacedKey} it gets via the {@link V#getNamespacedKey()} method. 28 | * @param value The value to register. 29 | */ 30 | void register(V value); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/chat/ClickAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.chat; 20 | 21 | import com.wolfyscript.utilities.common.WolfyUtils; 22 | import me.wolfyscript.utilities.api.WolfyUtilities; 23 | import org.bukkit.entity.Player; 24 | 25 | public interface ClickAction extends ClickActionCallback { 26 | 27 | void run(WolfyUtilities api, Player player); 28 | 29 | @Override 30 | default void run(WolfyUtils wolfyUtils, com.wolfyscript.utilities.common.adapters.Player player) { 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/dependency/PluginIntegrationDependency.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.dependency; 2 | 3 | import com.wolfyscript.utilities.dependency.Dependency; 4 | import me.wolfyscript.utilities.compatibility.PluginIntegration; 5 | 6 | import java.util.Objects; 7 | 8 | public class PluginIntegrationDependency implements Dependency { 9 | 10 | private final PluginIntegration pluginIntegration; 11 | 12 | public PluginIntegrationDependency(PluginIntegration pluginIntegration) { 13 | this.pluginIntegration = pluginIntegration; 14 | } 15 | 16 | @Override 17 | public boolean isAvailable() { 18 | return pluginIntegration.isDoneLoading(); 19 | } 20 | 21 | public PluginIntegration getPluginIntegration() { 22 | return pluginIntegration; 23 | } 24 | 25 | @Override 26 | public String toString() { 27 | return pluginIntegration.getAssociatedPlugin(); 28 | } 29 | 30 | @Override 31 | public boolean equals(Object o) { 32 | if (this == o) return true; 33 | if (o == null || getClass() != o.getClass()) return false; 34 | PluginIntegrationDependency that = (PluginIntegrationDependency) o; 35 | return Objects.equals(pluginIntegration, that.pluginIntegration); 36 | } 37 | 38 | @Override 39 | public int hashCode() { 40 | return Objects.hashCode(pluginIntegration); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/events/persistent/BlockStorageMoveEvent.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.events.persistent; 2 | 3 | import com.wolfyscript.utilities.bukkit.persistent.world.BlockStorage; 4 | import org.bukkit.event.Event; 5 | import org.bukkit.event.HandlerList; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.jetbrains.annotations.Nullable; 8 | 9 | import java.util.Optional; 10 | 11 | public class BlockStorageMoveEvent extends Event implements BlockStorageEvent { 12 | 13 | private static final HandlerList handlers = new HandlerList(); 14 | 15 | private final BlockStorage blockStorage; 16 | private final BlockStorage previousBlockStorage; 17 | 18 | public BlockStorageMoveEvent(BlockStorage blockStorage, @Nullable BlockStorage previousBlockStorage) { 19 | this.blockStorage = blockStorage; 20 | this.previousBlockStorage = previousBlockStorage; 21 | } 22 | 23 | 24 | @NotNull 25 | @Override 26 | public BlockStorage getStorage() { 27 | return blockStorage; 28 | } 29 | 30 | public Optional getPreviousStore() { 31 | return Optional.ofNullable(previousBlockStorage); 32 | } 33 | 34 | @NotNull 35 | @Override 36 | public HandlerList getHandlers() { 37 | return handlers; 38 | } 39 | 40 | public static HandlerList getHandlerList() { 41 | return handlers; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/dependency/PluginIntegrationDependencyResolver.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.dependency; 2 | 3 | import com.wolfyscript.utilities.dependency.Dependency; 4 | import com.wolfyscript.utilities.dependency.DependencyResolver; 5 | import com.wolfyscript.utilities.json.jackson.MissingDependencyException; 6 | import me.wolfyscript.utilities.api.WolfyUtilCore; 7 | 8 | import java.util.Collection; 9 | import java.util.Set; 10 | 11 | public class PluginIntegrationDependencyResolver implements DependencyResolver { 12 | 13 | @Override 14 | public Collection resolve(Object value, Class type) { 15 | var pluginsCompat = WolfyUtilCore.getInstance().getCompatibilityManager().getPlugins(); 16 | 17 | if (type.isAnnotationPresent(PluginIntegrationDependencyResolverSettings.class)) { 18 | var annotation = type.getAnnotation(PluginIntegrationDependencyResolverSettings.class); 19 | var integration = pluginsCompat.getIntegration(annotation.pluginName(), annotation.integration()); 20 | if (integration == null) { 21 | throw new MissingDependencyException("Declared integration dependency '" + annotation.pluginName() + "' not found for type '" + type.getName() + "'!"); 22 | } 23 | return Set.of(new PluginIntegrationDependency(integration)); 24 | } 25 | 26 | return Set.of(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/messages/InputButtonMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.messages; 20 | 21 | public class InputButtonMessage { 22 | 23 | private final String buttonID; 24 | private final String message; 25 | 26 | public InputButtonMessage(String buttonID, String message) { 27 | this.buttonID = buttonID; 28 | this.message = message; 29 | } 30 | 31 | public String getMessage() { 32 | return message; 33 | } 34 | 35 | public String getButtonID() { 36 | return buttonID; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/items/CustomItemData.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.items; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnore; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 6 | import com.fasterxml.jackson.annotation.JsonTypeInfo; 7 | import com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver; 8 | import com.fasterxml.jackson.databind.annotation.JsonTypeResolver; 9 | import com.wolfyscript.utilities.Copyable; 10 | import me.wolfyscript.utilities.util.Keyed; 11 | import me.wolfyscript.utilities.util.NamespacedKey; 12 | import me.wolfyscript.utilities.util.json.jackson.KeyedTypeIdResolver; 13 | import me.wolfyscript.utilities.util.json.jackson.KeyedTypeResolver; 14 | 15 | /** 16 | * 17 | */ 18 | @JsonTypeResolver(KeyedTypeResolver.class) 19 | @JsonTypeIdResolver(KeyedTypeIdResolver.class) 20 | @JsonTypeInfo(use = JsonTypeInfo.Id.CUSTOM, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "id") 21 | @JsonPropertyOrder(value = {"id"}) 22 | public abstract class CustomItemData implements Keyed, Copyable { 23 | 24 | @JsonProperty("id") 25 | private final NamespacedKey id; 26 | 27 | protected CustomItemData(NamespacedKey id) { 28 | this.id = id; 29 | } 30 | 31 | @JsonIgnore 32 | @Override 33 | public NamespacedKey getNamespacedKey() { 34 | return id; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/registry/TypeRegistrySimple.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.registry; 20 | 21 | import me.wolfyscript.utilities.util.Keyed; 22 | import me.wolfyscript.utilities.util.NamespacedKey; 23 | 24 | import java.util.HashMap; 25 | import java.util.Map; 26 | 27 | public class TypeRegistrySimple extends AbstractTypeRegistry>, V> { 28 | 29 | public TypeRegistrySimple(NamespacedKey key, Registries registries) { 30 | super(key, new HashMap<>(), registries); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/inventory/gui/ChatTabComplete.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.inventory.gui; 20 | 21 | import me.wolfyscript.utilities.api.inventory.gui.cache.CustomCache; 22 | import org.bukkit.entity.Player; 23 | import org.jetbrains.annotations.NotNull; 24 | import org.jetbrains.annotations.Nullable; 25 | 26 | import java.util.List; 27 | 28 | public interface ChatTabComplete { 29 | 30 | @Nullable 31 | List onTabComplete(GuiHandler guiHandler, @NotNull Player sender, @NotNull String[] args); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/nms/inventory/RecipeType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.nms.inventory; 20 | 21 | public enum RecipeType { 22 | 23 | CRAFTING("crafting"), 24 | SMELTING("smelting"), 25 | BLASTING("blasting"), 26 | SMOKING("smoking"), 27 | CAMPFIRE_COOKING("campfire_cooking"), 28 | STONECUTTING("stonecutting"), 29 | SMITHING("smithing"); 30 | 31 | private final String id; 32 | 33 | RecipeType(String id) { 34 | this.id = id; 35 | } 36 | 37 | public String getId() { 38 | return id; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/inventory/custom_items/actions/DataBlock.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.inventory.custom_items.actions; 20 | 21 | import me.wolfyscript.utilities.api.inventory.custom_items.CustomItem; 22 | import org.bukkit.block.Block; 23 | 24 | public class DataBlock extends DataLocation { 25 | 26 | private final Block block; 27 | 28 | public DataBlock(Block block, CustomItem customItem) { 29 | super(block.getLocation(), customItem); 30 | this.block = block; 31 | } 32 | 33 | public Block getBlock() { 34 | return block; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/inventory/custom_items/actions/DataPlayer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.inventory.custom_items.actions; 20 | 21 | import me.wolfyscript.utilities.api.inventory.custom_items.CustomItem; 22 | import org.bukkit.entity.Player; 23 | 24 | public class DataPlayer extends DataEntity { 25 | 26 | private final Player player; 27 | 28 | public DataPlayer(Player player, CustomItem customItem) { 29 | super(player, customItem); 30 | this.player = player; 31 | } 32 | 33 | public Player getPlayer() { 34 | return player; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/inventory/custom_items/actions/EventPlayerInteractEntity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.inventory.custom_items.actions; 20 | 21 | import me.wolfyscript.utilities.util.NamespacedKey; 22 | import org.bukkit.event.player.PlayerInteractAtEntityEvent; 23 | 24 | public class EventPlayerInteractEntity extends EventPlayerInteractEntityAbstract { 25 | 26 | public static final NamespacedKey KEY = NamespacedKey.wolfyutilties("player/interact_entity"); 27 | 28 | public EventPlayerInteractEntity() { 29 | super(KEY); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/inventory/custom_items/actions/DataLocation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.inventory.custom_items.actions; 20 | 21 | import me.wolfyscript.utilities.api.inventory.custom_items.CustomItem; 22 | import org.bukkit.Location; 23 | 24 | public class DataLocation extends Data { 25 | 26 | private final Location location; 27 | 28 | public DataLocation(Location location, CustomItem customItem) { 29 | super(customItem); 30 | this.location = location; 31 | } 32 | 33 | public Location getLocation() { 34 | return location; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/inventory/custom_items/actions/EventPlayerInteractAtEntity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.inventory.custom_items.actions; 20 | 21 | import me.wolfyscript.utilities.util.NamespacedKey; 22 | import org.bukkit.event.player.PlayerInteractAtEntityEvent; 23 | 24 | public class EventPlayerInteractAtEntity extends EventPlayerInteractEntityAbstract { 25 | 26 | public static final NamespacedKey KEY = NamespacedKey.wolfyutilties("player/interact_at_entity"); 27 | 28 | public EventPlayerInteractAtEntity() { 29 | super(KEY); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/util/eval/context/EvalContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.util.eval.context; 20 | 21 | import java.util.HashMap; 22 | import java.util.Map; 23 | 24 | public class EvalContext { 25 | 26 | private final Map variables; 27 | 28 | public EvalContext() { 29 | this.variables = new HashMap<>(); 30 | } 31 | 32 | public Object getVariable(String variableName) { 33 | return variables.get(variableName); 34 | } 35 | 36 | public void setVariable(String name, Object value) { 37 | variables.put(name, value); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/inventory/custom_items/actions/DataEntity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.inventory.custom_items.actions; 20 | 21 | import me.wolfyscript.utilities.api.inventory.custom_items.CustomItem; 22 | import org.bukkit.entity.Entity; 23 | 24 | public class DataEntity extends DataLocation { 25 | 26 | private final Entity entity; 27 | 28 | public DataEntity(Entity entity, CustomItem customItem) { 29 | super(entity.getLocation(), customItem); 30 | this.entity = entity; 31 | } 32 | 33 | public Entity getEntity() { 34 | return entity; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/util/eval/value_providers/ValueProviderIntegerVar.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.util.eval.value_providers; 20 | 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | import me.wolfyscript.utilities.util.NamespacedKey; 23 | 24 | public class ValueProviderIntegerVar extends ValueProviderVariable implements ValueProviderInteger { 25 | 26 | public static final NamespacedKey KEY = NamespacedKey.wolfyutilties("int/var"); 27 | 28 | public ValueProviderIntegerVar(@JsonProperty("var") String variable) { 29 | super(KEY, Integer.class, variable); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/verification/Verifier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ____ _ _ ____ ___ ____ _ _ ____ ____ ____ ____ ___ _ _ _ ____ 3 | * | | | [__ | | | |\/| | |__/ |__| |___ | | |\ | | __ 4 | * |___ |__| ___] | |__| | | |___ | \ | | | | | | \| |__] 5 | * 6 | * CustomCrafting Recipe creation and management tool for Minecraft 7 | * Copyright (C) 2021 WolfyScript 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | package com.wolfyscript.utilities.verification; 24 | 25 | import me.wolfyscript.utilities.util.Keyed; 26 | 27 | public interface Verifier extends Keyed { 28 | 29 | VerificationResult validate(T_VALUE value); 30 | 31 | boolean optional(); 32 | 33 | String getNameFor(VerificationResult container); 34 | } 35 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/util/eval/value_providers/AbstractValueProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.util.eval.value_providers; 20 | 21 | import com.fasterxml.jackson.annotation.JsonIgnore; 22 | import me.wolfyscript.utilities.util.NamespacedKey; 23 | 24 | public abstract class AbstractValueProvider implements ValueProvider { 25 | 26 | protected final NamespacedKey key; 27 | 28 | protected AbstractValueProvider(NamespacedKey key) { 29 | this.key = key; 30 | } 31 | 32 | @JsonIgnore 33 | @Override 34 | public NamespacedKey getNamespacedKey() { 35 | return key; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /.github/workflows/publish_release.yml: -------------------------------------------------------------------------------- 1 | name: publish_release.yml 2 | on: 3 | release: 4 | types: [ published ] 5 | workflow_dispatch: 6 | 7 | jobs: 8 | publish-gradle: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: Checkout project sources 12 | uses: actions/checkout@v4 13 | 14 | - name: Setup Java 15 | uses: actions/setup-java@v4 16 | with: 17 | java-version: 21 18 | distribution: temurin 19 | 20 | - name: Setup Gradle 21 | uses: gradle/actions/setup-gradle@v4 22 | with: 23 | gradle-version: '8.13' 24 | 25 | - name: Execute Gradle build 26 | run: gradle build shadowJar artifactoryPublish 27 | env: 28 | ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} 29 | ARTIFACTORY_TOKEN: ${{ secrets.ARTIFACTORY_TOKEN }} 30 | publish-modrinth: 31 | runs-on: ubuntu-latest 32 | steps: 33 | - name: Checkout project sources 34 | uses: actions/checkout@v4 35 | 36 | - name: Setup Java 37 | uses: actions/setup-java@v4 38 | with: 39 | java-version: 21 40 | distribution: temurin 41 | 42 | - name: Setup Gradle 43 | uses: gradle/actions/setup-gradle@v4 44 | with: 45 | gradle-version: '8.13' 46 | 47 | - name: Execute Gradle build 48 | run: gradle build shadowJar modrinth 49 | env: 50 | MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} 51 | CHANGELOG: ${{ github.event.release.body }} -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/inventory/custom_items/actions/EventPlayerItemBreak.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.inventory.custom_items.actions; 20 | 21 | import me.wolfyscript.utilities.util.NamespacedKey; 22 | import org.bukkit.event.player.PlayerItemBreakEvent; 23 | 24 | public class EventPlayerItemBreak extends EventPlayer> { 25 | 26 | public static final NamespacedKey KEY = NamespacedKey.wolfyutilties("player/item_break"); 27 | 28 | protected EventPlayerItemBreak() { 29 | super(KEY, (Class>)(Object) DataPlayerEvent.class); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/util/eval/value_providers/ValueProviderStringVar.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.util.eval.value_providers; 20 | 21 | import com.fasterxml.jackson.annotation.JsonCreator; 22 | import com.fasterxml.jackson.annotation.JsonProperty; 23 | import me.wolfyscript.utilities.util.NamespacedKey; 24 | 25 | public class ValueProviderStringVar extends ValueProviderVariable { 26 | 27 | public static final NamespacedKey KEY = NamespacedKey.wolfyutilties("string/var"); 28 | 29 | @JsonCreator 30 | public ValueProviderStringVar(@JsonProperty("var") String name) { 31 | super(KEY, String.class, name); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/inventory/custom_items/actions/EventPlayerItemHandSwap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.inventory.custom_items.actions; 20 | 21 | import me.wolfyscript.utilities.util.NamespacedKey; 22 | import org.bukkit.event.player.PlayerSwapHandItemsEvent; 23 | 24 | public class EventPlayerItemHandSwap extends EventPlayer> { 25 | 26 | public static final NamespacedKey KEY = NamespacedKey.wolfyutilties("player/item_swap_hand"); 27 | 28 | protected EventPlayerItemHandSwap() { 29 | super(KEY, (Class>)(Object) DataPlayerEvent.class); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/util/eval/value_providers/ValueProviderFloatVar.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.util.eval.value_providers; 20 | 21 | import com.fasterxml.jackson.annotation.JsonCreator; 22 | import com.fasterxml.jackson.annotation.JsonProperty; 23 | import me.wolfyscript.utilities.util.NamespacedKey; 24 | 25 | public class ValueProviderFloatVar extends ValueProviderVariable implements ValueProviderFloat { 26 | 27 | public static final NamespacedKey KEY = NamespacedKey.wolfyutilties("float/var"); 28 | 29 | @JsonCreator 30 | public ValueProviderFloatVar(@JsonProperty("var") String name) { 31 | super(KEY, Float.class, name); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/nbt/QueryNodeIntArray.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.nbt; 2 | 3 | import com.fasterxml.jackson.annotation.JacksonInject; 4 | import com.fasterxml.jackson.annotation.JsonCreator; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import de.tr7zw.nbtapi.NBTCompound; 7 | import de.tr7zw.nbtapi.NBTType; 8 | import me.wolfyscript.utilities.util.NamespacedKey; 9 | 10 | import java.util.Optional; 11 | 12 | public class QueryNodeIntArray extends QueryNodePrimitive { 13 | 14 | public static final NamespacedKey TYPE = NamespacedKey.wolfyutilties("int_array"); 15 | 16 | @JsonCreator 17 | public QueryNodeIntArray(@JsonProperty("value") int[] value, @JacksonInject("key") String key, @JacksonInject("parent_path") String parentPath) { 18 | super(TYPE, value, key, parentPath); 19 | this.nbtType = NBTType.NBTTagByteArray; 20 | } 21 | 22 | public QueryNodeIntArray(QueryNodeIntArray other) { 23 | super(TYPE, other.value.clone(), other.key, other.parentPath); 24 | } 25 | 26 | @Override 27 | protected Optional readValue(String path, String key, NBTCompound parent) { 28 | return Optional.ofNullable(parent.getIntArray(key)); 29 | } 30 | 31 | @Override 32 | protected void applyValue(String path, String key, int[] value, NBTCompound resultContainer) { 33 | resultContainer.setIntArray(key, value); 34 | } 35 | 36 | @Override 37 | public QueryNodeIntArray copy() { 38 | return new QueryNodeIntArray(this); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/util/json/jackson/ValueSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.util.json.jackson; 20 | 21 | import com.fasterxml.jackson.core.JsonGenerator; 22 | import com.fasterxml.jackson.databind.SerializerProvider; 23 | 24 | import java.io.IOException; 25 | 26 | public abstract class ValueSerializer { 27 | 28 | protected Class type; 29 | 30 | protected ValueSerializer(Class type) { 31 | this.type = type; 32 | } 33 | 34 | public abstract boolean serialize(T targetObject, JsonGenerator generator, SerializerProvider provider) throws IOException; 35 | 36 | public Class getType() { 37 | return type; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/world/items/reference/StackIdentifierParser.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.world.items.reference; 2 | 3 | import me.wolfyscript.utilities.util.Keyed; 4 | import net.kyori.adventure.text.Component; 5 | import org.bukkit.Material; 6 | import org.bukkit.inventory.ItemStack; 7 | import org.jetbrains.annotations.NotNull; 8 | 9 | import java.util.Optional; 10 | 11 | public interface StackIdentifierParser extends Keyed, Comparable> { 12 | 13 | int priority(); 14 | 15 | default DisplayConfiguration displayConfig() { 16 | return new DisplayConfiguration.SimpleDisplayConfig( 17 | Component.text(getNamespacedKey().toString()), 18 | new DisplayConfiguration.MaterialIconSettings(Material.WRITABLE_BOOK) 19 | ); 20 | } 21 | 22 | Optional from(ItemStack itemStack); 23 | 24 | @Override 25 | default int compareTo(@NotNull StackIdentifierParser that) { 26 | return Integer.compare(that.priority(), this.priority()); 27 | } 28 | 29 | interface DisplayConfiguration { 30 | 31 | Component name(); 32 | 33 | IconSettings icon(); 34 | 35 | interface IconSettings { } 36 | 37 | record StackIconSettings(ItemStack stack) implements IconSettings { } 38 | 39 | record MaterialIconSettings(Material material) implements IconSettings { } 40 | 41 | record SimpleDisplayConfig(Component name, IconSettings icon) implements DisplayConfiguration { } 42 | 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/compatibility/PluginAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.compatibility; 20 | 21 | import me.wolfyscript.utilities.util.NamespacedKey; 22 | 23 | /** 24 | * These adapters are used for easier management of plugin dependent classes.
25 | * e.g. If you have a soft-depend and need to only register an object when it is available. 26 | * 27 | */ 28 | public abstract class PluginAdapter { 29 | 30 | private final NamespacedKey key; 31 | 32 | protected PluginAdapter(NamespacedKey namespacedKey) { 33 | this.key = namespacedKey; 34 | } 35 | 36 | public final NamespacedKey getNamespacedKey() { 37 | return key; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/nbt/QueryNodeByteArray.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.nbt; 2 | 3 | import com.fasterxml.jackson.annotation.JacksonInject; 4 | import com.fasterxml.jackson.annotation.JsonCreator; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import de.tr7zw.nbtapi.NBTCompound; 7 | import de.tr7zw.nbtapi.NBTType; 8 | import me.wolfyscript.utilities.util.NamespacedKey; 9 | 10 | import java.util.Optional; 11 | 12 | public class QueryNodeByteArray extends QueryNodePrimitive { 13 | 14 | public static final NamespacedKey TYPE = NamespacedKey.wolfyutilties("byte_array"); 15 | 16 | @JsonCreator 17 | public QueryNodeByteArray(@JsonProperty("value") byte[] value, @JacksonInject("key") String key, @JacksonInject("parent_path") String parentPath) { 18 | super(TYPE, value, key, parentPath); 19 | this.nbtType = NBTType.NBTTagByteArray; 20 | } 21 | 22 | private QueryNodeByteArray(QueryNodeByteArray other) { 23 | super(TYPE, other.value.clone(), other.key, other.parentPath); 24 | } 25 | 26 | @Override 27 | protected Optional readValue(String path, String key, NBTCompound parent) { 28 | return Optional.ofNullable(parent.getByteArray(key)); 29 | } 30 | 31 | @Override 32 | protected void applyValue(String path, String key, byte[] value, NBTCompound resultContainer) { 33 | resultContainer.setByteArray(key, value); 34 | } 35 | 36 | @Override 37 | public QueryNodeByteArray copy() { 38 | return new QueryNodeByteArray(this); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/nbt/QueryNodeString.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.nbt; 2 | 3 | import com.fasterxml.jackson.annotation.JacksonInject; 4 | import com.fasterxml.jackson.annotation.JsonCreator; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.databind.JsonNode; 7 | import de.tr7zw.nbtapi.NBTCompound; 8 | import de.tr7zw.nbtapi.NBTType; 9 | import me.wolfyscript.utilities.util.NamespacedKey; 10 | 11 | import java.util.Optional; 12 | 13 | public class QueryNodeString extends QueryNodePrimitive { 14 | 15 | public static final NamespacedKey TYPE = NamespacedKey.wolfyutilties("string"); 16 | 17 | @JsonCreator 18 | public QueryNodeString(@JsonProperty("value") JsonNode valueNode, @JacksonInject("key") String key, @JacksonInject("parent_path") String parentPath) { 19 | super(TYPE, valueNode.asText(), key, parentPath); 20 | this.nbtType = NBTType.NBTTagString; 21 | } 22 | 23 | public QueryNodeString(QueryNodePrimitive other) { 24 | super(other); 25 | } 26 | 27 | @Override 28 | protected Optional readValue(String path, String key, NBTCompound parent) { 29 | return Optional.ofNullable(parent.getString(key)); 30 | } 31 | 32 | @Override 33 | protected void applyValue(String path, String key, String value, NBTCompound resultContainer) { 34 | resultContainer.setString(key, value); 35 | } 36 | 37 | @Override 38 | public QueryNodeString copy() { 39 | return new QueryNodeString(this); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/inventory/custom_items/actions/DataPlayerEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.inventory.custom_items.actions; 20 | 21 | import me.wolfyscript.utilities.api.inventory.custom_items.CustomItem; 22 | import org.bukkit.entity.Player; 23 | import org.bukkit.event.player.PlayerEvent; 24 | 25 | public class DataPlayerEvent extends DataPlayer implements DataEvent { 26 | 27 | private final T event; 28 | 29 | public DataPlayerEvent(T event, Player player, CustomItem customItem) { 30 | super(player, customItem); 31 | this.event = event; 32 | } 33 | 34 | @Override 35 | public T getEvent() { 36 | return event; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/util/math/Triangle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.util.math; 20 | 21 | import org.bukkit.util.Vector; 22 | 23 | public class Triangle { 24 | 25 | private final Vector point1; 26 | private final Vector point2; 27 | private final Vector point3; 28 | 29 | public Triangle(Vector point1, Vector point2, Vector point3) { 30 | this.point1 = point1; 31 | this.point2 = point2; 32 | this.point3 = point3; 33 | } 34 | 35 | public Vector getPoint1() { 36 | return point1; 37 | } 38 | 39 | public Vector getPoint2() { 40 | return point2; 41 | } 42 | 43 | public Vector getPoint3() { 44 | return point3; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/inventory/custom_items/meta/NBTTagMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.inventory.custom_items.meta; 20 | 21 | import me.wolfyscript.utilities.api.inventory.custom_items.CustomItem; 22 | import me.wolfyscript.utilities.util.NamespacedKey; 23 | import me.wolfyscript.utilities.util.inventory.item_builder.ItemBuilder; 24 | 25 | public class NBTTagMeta extends Meta { 26 | 27 | public static final NamespacedKey KEY = NamespacedKey.wolfyutilties("player_head"); 28 | 29 | public NBTTagMeta() { 30 | super(KEY); 31 | } 32 | 33 | @Override 34 | public boolean check(CustomItem item, ItemBuilder itemOther) { 35 | //TODO 36 | return true; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/registry/RegistryParticleEffect.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.registry; 20 | 21 | import me.wolfyscript.utilities.util.NamespacedKey; 22 | import me.wolfyscript.utilities.util.particles.ParticleEffect; 23 | 24 | public class RegistryParticleEffect extends RegistrySimple { 25 | 26 | RegistryParticleEffect(Registries registries) { 27 | super(new NamespacedKey(registries.getCore(), "particle_effects"), registries, ParticleEffect.class); 28 | } 29 | 30 | @Override 31 | public void register(NamespacedKey namespacedKey, ParticleEffect value) { 32 | super.register(namespacedKey, value); 33 | value.setKey(namespacedKey); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /plugin-compatibility/src/main/java/me/wolfyscript/utilities/compatibility/plugins/denizen/DenizenIntegrationImpl.java: -------------------------------------------------------------------------------- 1 | package me.wolfyscript.utilities.compatibility.plugins.denizen; 2 | 3 | import me.wolfyscript.utilities.annotations.WUPluginIntegration; 4 | import me.wolfyscript.utilities.api.WolfyUtilCore; 5 | import me.wolfyscript.utilities.api.inventory.custom_items.references.APIReference; 6 | import me.wolfyscript.utilities.compatibility.PluginIntegrationAbstract; 7 | import org.bukkit.plugin.Plugin; 8 | 9 | @WUPluginIntegration(pluginName = DenizenIntegrationImpl.PLUGIN_NAME) 10 | public class DenizenIntegrationImpl extends PluginIntegrationAbstract { 11 | 12 | public static final String PLUGIN_NAME = "Denizen"; 13 | 14 | /** 15 | * The main constructor that is called whenever the integration is created.
16 | * 17 | * @param core The WolfyUtilCore. 18 | */ 19 | protected DenizenIntegrationImpl(WolfyUtilCore core) { 20 | super(core, PLUGIN_NAME); 21 | } 22 | 23 | @Override 24 | public boolean isAPIReferenceIncluded(APIReference reference) { 25 | return reference instanceof DenizenRefImpl; 26 | } 27 | 28 | @Override 29 | public void init(Plugin plugin) { 30 | core.registerAPIReference(new DenizenRefImpl.Parser()); 31 | core.getRegistries().getStackIdentifierParsers().register(new DenizenStackIdentifier.Parser()); 32 | core.getRegistries().getStackIdentifierTypeRegistry().register(DenizenStackIdentifier.class); 33 | } 34 | 35 | @Override 36 | public boolean hasAsyncLoading() { 37 | return false; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/registry/RegistryParticleAnimation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.registry; 20 | 21 | import me.wolfyscript.utilities.util.NamespacedKey; 22 | import me.wolfyscript.utilities.util.particles.ParticleAnimation; 23 | 24 | public class RegistryParticleAnimation extends RegistrySimple { 25 | 26 | RegistryParticleAnimation(Registries registries) { 27 | super(new NamespacedKey(registries.getCore(), "particle_animations"), registries, ParticleAnimation.class); 28 | } 29 | 30 | @Override 31 | public void register(NamespacedKey namespacedKey, ParticleAnimation value) { 32 | super.register(namespacedKey, value); 33 | value.setKey(namespacedKey); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/util/json/jackson/ValueDeserializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.util.json.jackson; 20 | 21 | import com.fasterxml.jackson.core.JsonParser; 22 | import com.fasterxml.jackson.core.JsonProcessingException; 23 | import com.fasterxml.jackson.databind.DeserializationContext; 24 | 25 | import java.io.IOException; 26 | 27 | public abstract class ValueDeserializer { 28 | 29 | protected Class type; 30 | 31 | protected ValueDeserializer(Class type) { 32 | this.type = type; 33 | } 34 | 35 | public abstract T deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException; 36 | 37 | public Class getType() { 38 | return type; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/inventory/custom_items/actions/EventPlayerItemDrop.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.inventory.custom_items.actions; 20 | 21 | import me.wolfyscript.utilities.util.NamespacedKey; 22 | import org.bukkit.event.player.PlayerDropItemEvent; 23 | 24 | public class EventPlayerItemDrop extends EventPlayer> { 25 | 26 | public static final NamespacedKey KEY = NamespacedKey.wolfyutilties("player/item_drop"); 27 | 28 | protected EventPlayerItemDrop() { 29 | super(KEY, (Class>)(Object) DataPlayerEvent.class); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/inventory/custom_items/actions/EventPlayerItemHeld.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.inventory.custom_items.actions; 20 | 21 | import me.wolfyscript.utilities.util.NamespacedKey; 22 | import org.bukkit.event.player.PlayerItemHeldEvent; 23 | 24 | public class EventPlayerItemHeld extends EventPlayer> { 25 | 26 | public static final NamespacedKey KEY = NamespacedKey.wolfyutilties("player/item_held"); 27 | 28 | protected EventPlayerItemHeld() { 29 | super(KEY, (Class>)(Object) DataPlayerEvent.class); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/nbt/QueryNodeByte.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.nbt; 2 | 3 | import com.fasterxml.jackson.annotation.JacksonInject; 4 | import com.fasterxml.jackson.annotation.JsonCreator; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.databind.JsonNode; 7 | import de.tr7zw.nbtapi.NBTCompound; 8 | import de.tr7zw.nbtapi.NBTType; 9 | import me.wolfyscript.utilities.util.NamespacedKey; 10 | 11 | import java.util.Optional; 12 | 13 | public class QueryNodeByte extends QueryNodePrimitive { 14 | 15 | public static final NamespacedKey TYPE = NamespacedKey.wolfyutilties("byte"); 16 | 17 | @JsonCreator 18 | public QueryNodeByte(@JsonProperty("value") JsonNode valueNode, @JacksonInject("key") String key, @JacksonInject("parent_path") String parentPath) { 19 | super(TYPE, valueNode.isTextual() ? Byte.parseByte(valueNode.asText().replaceAll("[bB]", "")) : valueNode.numberValue().byteValue(), key, parentPath); 20 | this.nbtType = NBTType.NBTTagByte; 21 | } 22 | 23 | private QueryNodeByte(QueryNodeByte other) { 24 | super(other); 25 | } 26 | 27 | @Override 28 | protected Optional readValue(String path, String key, NBTCompound parent) { 29 | return Optional.ofNullable(parent.getByte(key)); 30 | } 31 | 32 | @Override 33 | protected void applyValue(String path, String key, Byte value, NBTCompound resultContainer) { 34 | resultContainer.setByte(key, value); 35 | } 36 | 37 | @Override 38 | public QueryNodeByte copy() { 39 | return new QueryNodeByte(this); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/nms/NetworkUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.nms; 20 | 21 | import io.netty.buffer.ByteBuf; 22 | import me.wolfyscript.utilities.api.nms.network.MCByteBuf; 23 | import org.apache.commons.lang3.NotImplementedException; 24 | 25 | @Deprecated(since = "4.17", forRemoval = true) 26 | public abstract class NetworkUtil extends UtilComponent { 27 | 28 | protected NetworkUtil(NMSUtil nmsUtil) { 29 | super(nmsUtil); 30 | } 31 | 32 | public MCByteBuf buffer(ByteBuf byteBuf) { 33 | throw new NotImplementedException("No longer supported in 1.20.5+"); 34 | } 35 | 36 | public MCByteBuf buffer() { 37 | throw new NotImplementedException("No longer supported in 1.20.5+"); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/util/protection/LWCUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.util.protection; 20 | 21 | import com.griefcraft.lwc.LWC; 22 | import org.bukkit.block.Block; 23 | import org.bukkit.entity.Entity; 24 | import org.bukkit.entity.Player; 25 | 26 | public class LWCUtil { 27 | 28 | //LWC Utils! Only tested for the LWC fork by Brokkonaut! 29 | 30 | private static final LWC lwc = LWC.getInstance(); 31 | 32 | public static boolean hasPermToInteract(Player player, Entity entity) { 33 | return lwc.canAccessProtection(player, entity.getLocation().getBlock()); 34 | } 35 | 36 | public static boolean canAccessprotection(Player player, Block block) { 37 | return lwc.canAccessProtection(player, block); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/nbt/QueryNodeLong.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.nbt; 2 | 3 | import com.fasterxml.jackson.annotation.JacksonInject; 4 | import com.fasterxml.jackson.annotation.JsonCreator; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.databind.JsonNode; 7 | import de.tr7zw.nbtapi.NBTCompound; 8 | import de.tr7zw.nbtapi.NBTType; 9 | import me.wolfyscript.utilities.util.NamespacedKey; 10 | 11 | import java.util.Optional; 12 | 13 | public class QueryNodeLong extends QueryNodePrimitive { 14 | 15 | public static final NamespacedKey TYPE = NamespacedKey.wolfyutilties("long"); 16 | 17 | @JsonCreator 18 | public QueryNodeLong(@JsonProperty("value") JsonNode valueNode, @JacksonInject("key") String key, @JacksonInject("parent_path") String parentPath) { 19 | super(TYPE, valueNode.isTextual() ? Long.parseLong(valueNode.asText().replaceAll("[lL]", "")) : valueNode.numberValue().longValue(), key, parentPath); 20 | this.nbtType = NBTType.NBTTagLong; 21 | } 22 | 23 | public QueryNodeLong(QueryNodePrimitive other) { 24 | super(other); 25 | } 26 | 27 | @Override 28 | protected Optional readValue(String path, String key, NBTCompound parent) { 29 | return Optional.ofNullable(parent.getLong(key)); 30 | } 31 | 32 | @Override 33 | protected void applyValue(String path, String key, Long value, NBTCompound resultContainer) { 34 | resultContainer.setLong(key, value); 35 | } 36 | 37 | @Override 38 | public QueryNodeLong copy() { 39 | return new QueryNodeLong(this); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/inventory/custom_items/actions/EventPlayerItemDamage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.inventory.custom_items.actions; 20 | 21 | import me.wolfyscript.utilities.util.NamespacedKey; 22 | import org.bukkit.event.player.PlayerItemDamageEvent; 23 | 24 | public class EventPlayerItemDamage extends EventPlayer> { 25 | 26 | public static final NamespacedKey KEY = NamespacedKey.wolfyutilties("player/item_damage"); 27 | 28 | protected EventPlayerItemDamage() { 29 | super(KEY, (Class>)(Object) DataPlayerEvent.class); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/inventory/custom_items/meta/FlagsMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.inventory.custom_items.meta; 20 | 21 | import me.wolfyscript.utilities.api.inventory.custom_items.CustomItem; 22 | import me.wolfyscript.utilities.util.NamespacedKey; 23 | import me.wolfyscript.utilities.util.inventory.item_builder.ItemBuilder; 24 | 25 | public class FlagsMeta extends Meta { 26 | 27 | public static final NamespacedKey KEY = NamespacedKey.wolfyutilties("flags"); 28 | 29 | public FlagsMeta() { 30 | super(KEY); 31 | } 32 | 33 | @Override 34 | public boolean check(CustomItem item, ItemBuilder itemOther) { 35 | return itemOther.getItemMeta().getItemFlags().containsAll(item.getItemMeta().getItemFlags()); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/nbt/QueryNodeFloat.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.nbt; 2 | 3 | import com.fasterxml.jackson.annotation.JacksonInject; 4 | import com.fasterxml.jackson.annotation.JsonCreator; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.databind.JsonNode; 7 | import de.tr7zw.nbtapi.NBTCompound; 8 | import de.tr7zw.nbtapi.NBTType; 9 | import me.wolfyscript.utilities.util.NamespacedKey; 10 | 11 | import java.util.Optional; 12 | 13 | public class QueryNodeFloat extends QueryNodePrimitive { 14 | 15 | public static final NamespacedKey TYPE = NamespacedKey.wolfyutilties("float"); 16 | 17 | @JsonCreator 18 | public QueryNodeFloat(@JsonProperty("value") JsonNode valueNode, @JacksonInject("key") String key, @JacksonInject("parent_path") String parentPath) { 19 | super(TYPE, valueNode.isTextual() ? Float.parseFloat(valueNode.asText().replaceAll("[dD]", "")) : valueNode.numberValue().floatValue(), key, parentPath); 20 | this.nbtType = NBTType.NBTTagFloat; 21 | } 22 | 23 | private QueryNodeFloat(QueryNodeFloat other) { 24 | super(other); 25 | } 26 | 27 | @Override 28 | protected Optional readValue(String path, String key, NBTCompound parent) { 29 | return Optional.ofNullable(parent.getFloat(key)); 30 | } 31 | 32 | @Override 33 | protected void applyValue(String path, String key, Float value, NBTCompound resultContainer) { 34 | resultContainer.setFloat(key, value); 35 | } 36 | 37 | @Override 38 | public QueryNodeFloat copy() { 39 | return new QueryNodeFloat(this); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/util/particles/pos/ParticlePos.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.util.particles.pos; 20 | 21 | import org.bukkit.Location; 22 | import org.bukkit.util.Vector; 23 | 24 | public abstract class ParticlePos { 25 | 26 | private Vector offset; 27 | 28 | protected ParticlePos() { 29 | this.offset = new Vector(); 30 | } 31 | 32 | protected ParticlePos(ParticlePos pos) { 33 | this.offset = new Vector().copy(pos.offset); 34 | } 35 | 36 | public abstract Location getLocation(); 37 | 38 | public Vector getOffset() { 39 | return offset; 40 | } 41 | 42 | public void setOffset(Vector offset) { 43 | this.offset = offset; 44 | } 45 | 46 | public abstract ParticlePos shallowCopy(); 47 | } 48 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/inventory/custom_items/actions/EventPlayerConsumeItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.inventory.custom_items.actions; 20 | 21 | import me.wolfyscript.utilities.util.NamespacedKey; 22 | import org.bukkit.event.player.PlayerItemConsumeEvent; 23 | 24 | public class EventPlayerConsumeItem extends EventPlayer> { 25 | 26 | public static final NamespacedKey KEY = NamespacedKey.wolfyutilties("player/consume_item"); 27 | 28 | protected EventPlayerConsumeItem() { 29 | super(KEY, (Class>)(Object) DataPlayerEvent.class); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/nms/BlockUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.nms; 20 | 21 | import me.wolfyscript.utilities.api.nms.block.NMSBrewingStand; 22 | import org.bukkit.block.BrewingStand; 23 | 24 | @Deprecated(forRemoval = true, since = "4.17") 25 | public abstract class BlockUtil extends UtilComponent { 26 | 27 | protected BlockUtil(NMSUtil nmsUtil) { 28 | super(nmsUtil); 29 | } 30 | 31 | /** 32 | * Get a more detailed API to edit the NMS BrewingStand values 33 | * 34 | * @param brewingStand The Bukkit BrewingStand Block 35 | * @return The NMSBrewingStand API 36 | */ 37 | @Deprecated(forRemoval = true, since = "4.17") 38 | public abstract NMSBrewingStand getNmsBrewingStand(BrewingStand brewingStand); 39 | 40 | } 41 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/nbt/QueryNodeInt.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.nbt; 2 | 3 | import com.fasterxml.jackson.annotation.JacksonInject; 4 | import com.fasterxml.jackson.annotation.JsonCreator; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.databind.JsonNode; 7 | import de.tr7zw.nbtapi.NBTCompound; 8 | import de.tr7zw.nbtapi.NBTType; 9 | import me.wolfyscript.utilities.util.NamespacedKey; 10 | 11 | import java.util.Optional; 12 | 13 | public class QueryNodeInt extends QueryNodePrimitive { 14 | 15 | public static final NamespacedKey TYPE = NamespacedKey.wolfyutilties("int"); 16 | 17 | @JsonCreator 18 | public QueryNodeInt(@JsonProperty("value") JsonNode valueNode, @JacksonInject("key") String key, @JacksonInject("parent_path") String parentPath) { 19 | super(TYPE, valueNode.isTextual() ? Integer.parseInt(valueNode.asText().replaceAll("[iI]", "")) : valueNode.numberValue().intValue(), key, parentPath); 20 | this.nbtType = NBTType.NBTTagInt; 21 | } 22 | 23 | public QueryNodeInt(QueryNodePrimitive other) { 24 | super(other); 25 | } 26 | 27 | @Override 28 | protected Optional readValue(String path, String key, NBTCompound parent) { 29 | return Optional.ofNullable(parent.getInteger(key)); 30 | } 31 | 32 | @Override 33 | protected void applyValue(String path, String key, Integer value, NBTCompound resultContainer) { 34 | resultContainer.setInteger(key, value); 35 | } 36 | 37 | @Override 38 | public QueryNode copy() { 39 | return new QueryNodeInt(this); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/nbt/QueryNodeShort.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.nbt; 2 | 3 | import com.fasterxml.jackson.annotation.JacksonInject; 4 | import com.fasterxml.jackson.annotation.JsonCreator; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.databind.JsonNode; 7 | import de.tr7zw.nbtapi.NBTCompound; 8 | import de.tr7zw.nbtapi.NBTType; 9 | import me.wolfyscript.utilities.util.NamespacedKey; 10 | 11 | import java.util.Optional; 12 | 13 | public class QueryNodeShort extends QueryNodePrimitive { 14 | 15 | public static final NamespacedKey TYPE = NamespacedKey.wolfyutilties("short"); 16 | 17 | @JsonCreator 18 | public QueryNodeShort(@JsonProperty("value") JsonNode valueNode, @JacksonInject("key") String key, @JacksonInject("parent_path") String parentPath) { 19 | super(TYPE, valueNode.isTextual() ? Short.parseShort(valueNode.asText().replaceAll("[sS]", "")) : valueNode.numberValue().shortValue(), key, parentPath); 20 | this.nbtType = NBTType.NBTTagShort; 21 | } 22 | 23 | public QueryNodeShort(QueryNodePrimitive other) { 24 | super(other); 25 | } 26 | 27 | @Override 28 | protected Optional readValue(String path, String key, NBTCompound parent) { 29 | return Optional.ofNullable(parent.getShort(key)); 30 | } 31 | 32 | @Override 33 | protected void applyValue(String path, String key, Short value, NBTCompound resultContainer) { 34 | resultContainer.setShort(key, value); 35 | } 36 | 37 | @Override 38 | public QueryNodeShort copy() { 39 | return new QueryNodeShort(this); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/inventory/custom_items/meta/UnbreakableMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.inventory.custom_items.meta; 20 | 21 | import me.wolfyscript.utilities.api.inventory.custom_items.CustomItem; 22 | import me.wolfyscript.utilities.util.NamespacedKey; 23 | import me.wolfyscript.utilities.util.inventory.item_builder.ItemBuilder; 24 | 25 | public class UnbreakableMeta extends Meta { 26 | 27 | public static final NamespacedKey KEY = NamespacedKey.wolfyutilties("unbreakable"); 28 | 29 | public UnbreakableMeta() { 30 | super(KEY); 31 | } 32 | 33 | @Override 34 | public boolean check(CustomItem item, ItemBuilder itemOther) { 35 | return item.getItemMeta().isUnbreakable() == itemOther.getItemMeta().isUnbreakable(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/nms/nbt/NBTTagList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.nms.nbt; 20 | 21 | @Deprecated(since = "4.16.2.0") 22 | public interface NBTTagList extends NBTBase { 23 | 24 | NBTCompound getCompound(int index); 25 | 26 | NBTTagList getTagList(int index); 27 | 28 | NBTBase getTag(int index); 29 | 30 | NBTBase remove(int index); 31 | 32 | short getShort(int index); 33 | 34 | int getInt(int index); 35 | 36 | int[] getIntArray(int index); 37 | 38 | double getDouble(int index); 39 | 40 | float getFloat(int index); 41 | 42 | String getString(int index); 43 | 44 | int size(); 45 | 46 | NBTBase set(int index, NBTBase value); 47 | 48 | void add(int index, NBTBase value); 49 | 50 | void clear(); 51 | 52 | } 53 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/nbt/QueryNodeDouble.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.nbt; 2 | 3 | import com.fasterxml.jackson.annotation.JacksonInject; 4 | import com.fasterxml.jackson.annotation.JsonCreator; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.databind.JsonNode; 7 | import de.tr7zw.nbtapi.NBTCompound; 8 | import de.tr7zw.nbtapi.NBTType; 9 | import me.wolfyscript.utilities.util.NamespacedKey; 10 | 11 | import java.util.Optional; 12 | 13 | public class QueryNodeDouble extends QueryNodePrimitive { 14 | 15 | public static final NamespacedKey TYPE = NamespacedKey.wolfyutilties("double"); 16 | 17 | @JsonCreator 18 | public QueryNodeDouble(@JsonProperty("value") JsonNode valueNode, @JacksonInject("key") String key, @JacksonInject("parent_path") String parentPath) { 19 | super(TYPE, valueNode.isTextual() ? Double.parseDouble(valueNode.asText().replaceAll("[dD]", "")) : valueNode.numberValue().doubleValue(), key, parentPath); 20 | this.nbtType = NBTType.NBTTagDouble; 21 | } 22 | 23 | private QueryNodeDouble(QueryNodeDouble other) { 24 | super(other); 25 | } 26 | 27 | @Override 28 | protected Optional readValue(String path, String key, NBTCompound parent) { 29 | return Optional.ofNullable(parent.getDouble(key)); 30 | } 31 | 32 | @Override 33 | protected void applyValue(String path, String key, Double value, NBTCompound resultContainer) { 34 | resultContainer.setDouble(key, value); 35 | } 36 | 37 | @Override 38 | public QueryNodeDouble copy() { 39 | return new QueryNodeDouble(this); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/inventory/custom_items/meta/LoreMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.inventory.custom_items.meta; 20 | 21 | 22 | import me.wolfyscript.utilities.api.inventory.custom_items.CustomItem; 23 | import me.wolfyscript.utilities.util.NamespacedKey; 24 | import me.wolfyscript.utilities.util.inventory.item_builder.ItemBuilder; 25 | 26 | import java.util.Objects; 27 | 28 | public class LoreMeta extends Meta { 29 | 30 | public static final NamespacedKey KEY = NamespacedKey.wolfyutilties("lore"); 31 | 32 | public LoreMeta() { 33 | super(KEY); 34 | } 35 | 36 | @Override 37 | public boolean check(CustomItem item, ItemBuilder itemOther) { 38 | return Objects.equals(item.getItemMeta().getLore(), itemOther.getItemMeta().getLore()); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/nms/nbt/NBTType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.nms.nbt; 20 | 21 | public enum NBTType { 22 | 23 | TAG_END, 24 | BYTE, 25 | SHORT, 26 | INT, 27 | LONG, 28 | FLOAT, 29 | DOUBLE, 30 | BYTE_ARRAY, 31 | STRING, 32 | LIST, 33 | COMPOUND, 34 | INT_ARRAY, 35 | LONG_ARRAY; 36 | 37 | public static NBTType of(int typeId) { 38 | if (typeId >= 0 && typeId < values().length) { 39 | return NBTType.values()[typeId]; 40 | } 41 | throw new IllegalArgumentException("Invalid tag id: " + typeId); 42 | } 43 | 44 | public boolean is(int typeId) { 45 | return this.ordinal() == typeId; 46 | } 47 | 48 | public int getTypeId() { 49 | return this.ordinal(); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/bukkit/world/items/reference/LegacyStackReference.java: -------------------------------------------------------------------------------- 1 | package com.wolfyscript.utilities.bukkit.world.items.reference; 2 | 3 | import com.fasterxml.jackson.databind.JsonNode; 4 | import me.wolfyscript.utilities.api.WolfyUtilCore; 5 | import me.wolfyscript.utilities.util.NamespacedKey; 6 | import org.bukkit.inventory.ItemStack; 7 | 8 | /** 9 | * Used to keep track of old {@link me.wolfyscript.utilities.api.inventory.custom_items.references.APIReference} data from the config. 10 | * Because APIReferences did not store the original ItemStack in the config, the StackIdentifiers need to be parsed from the old data instead. 11 | */ 12 | public class LegacyStackReference extends StackReference { 13 | 14 | private final JsonNode data; 15 | 16 | public LegacyStackReference(WolfyUtilCore core, NamespacedKey parserKey, double weight, int amount, JsonNode data) { 17 | super(core, amount, weight, parserKey, null); 18 | this.data = data; 19 | } 20 | 21 | public JsonNode data() { 22 | return data; 23 | } 24 | 25 | @Override 26 | public ItemStack originalStack() { 27 | if (stack == null) { 28 | stack = identifier().map(stackIdentifier -> stackIdentifier.stack(ItemCreateContext.empty(amount()))).orElse(null); 29 | } 30 | return super.originalStack(); 31 | } 32 | 33 | @Override 34 | protected StackIdentifier getOrParseIdentifier() { 35 | if (identifier != null) return identifier; 36 | if (parser() instanceof LegacyParser legacyParser) { 37 | return legacyParser.from(data).orElse(null); 38 | } 39 | return super.getOrParseIdentifier(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/util/particles/pos/ParticlePosLocation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.util.particles.pos; 20 | 21 | import org.bukkit.Location; 22 | 23 | public class ParticlePosLocation extends ParticlePos { 24 | 25 | private final Location location; 26 | 27 | public ParticlePosLocation(Location location) { 28 | super(); 29 | this.location = location; 30 | } 31 | 32 | public ParticlePosLocation(ParticlePosLocation pos) { 33 | super(pos); 34 | this.location = pos.location; 35 | } 36 | 37 | @Override 38 | public Location getLocation() { 39 | return location.clone().add(getOffset()); 40 | } 41 | 42 | @Override 43 | public ParticlePosLocation shallowCopy() { 44 | return new ParticlePosLocation(this); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/util/eval/operators/LogicalOperatorNot.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.util.eval.operators; 20 | 21 | import com.fasterxml.jackson.annotation.JsonCreator; 22 | import com.fasterxml.jackson.annotation.JsonProperty; 23 | import me.wolfyscript.utilities.util.NamespacedKey; 24 | import me.wolfyscript.utilities.util.eval.context.EvalContext; 25 | 26 | public class LogicalOperatorNot extends LogicalOperator { 27 | 28 | public static final NamespacedKey KEY = NamespacedKey.wolfyutilties("not"); 29 | 30 | @JsonCreator 31 | public LogicalOperatorNot(@JsonProperty("this") BoolOperator thisValue) { 32 | super(KEY, thisValue); 33 | } 34 | 35 | @Override 36 | public boolean evaluate(EvalContext context) { 37 | return !thisValue.evaluate(context); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/verification/VerifierEntry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ____ _ _ ____ ___ ____ _ _ ____ ____ ____ ____ ___ _ _ _ ____ 3 | * | | | [__ | | | |\/| | |__/ |__| |___ | | |\ | | __ 4 | * |___ |__| ___] | |__| | | |___ | \ | | | | | | \| |__] 5 | * 6 | * CustomCrafting Recipe creation and management tool for Minecraft 7 | * Copyright (C) 2021 WolfyScript 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | package com.wolfyscript.utilities.verification; 24 | 25 | import java.util.function.Function; 26 | 27 | public record VerifierEntry(Verifier verifier, Function valueGetter) { 28 | 29 | public VerificationResult applyNestedValidator(S source) { 30 | return verifier().validate(valueGetter().apply(source)); 31 | } 32 | 33 | @Override 34 | public String toString() { 35 | return "ValidatorEntry{" + 36 | "validator=" + verifier + 37 | '}'; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/util/particles/pos/ParticlePosEntity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.util.particles.pos; 20 | 21 | import org.bukkit.Location; 22 | import org.bukkit.entity.Entity; 23 | 24 | public class ParticlePosEntity extends ParticlePos { 25 | 26 | private final Entity entity; 27 | 28 | public ParticlePosEntity(Entity entity) { 29 | super(); 30 | this.entity = entity; 31 | } 32 | 33 | public ParticlePosEntity(ParticlePosEntity pos) { 34 | super(pos); 35 | this.entity = pos.entity; 36 | } 37 | 38 | @Override 39 | public Location getLocation() { 40 | return entity.getLocation().add(getOffset()); 41 | } 42 | 43 | @Override 44 | public ParticlePosEntity shallowCopy() { 45 | return new ParticlePosEntity(this); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/util/Keyed.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.util; 20 | 21 | /** 22 | * Objects that implement this interface are bound to a {@link NamespacedKey} and can be uniquely identified.
23 | * This interface may only be used for registrable resources and/or uniquely identifiably public resources! 24 | * This interface may not be used for internal plugin resources!
25 | * Usually this interface is implemented to register data into a kind of {@link me.wolfyscript.utilities.registry.Registry}, 26 | * and allowing third-party plugins to register custom derivations too. 27 | */ 28 | public interface Keyed { 29 | 30 | /** 31 | * The unique NamespacedKey of the object. 32 | * 33 | * @return The NamespacedKey of the object. 34 | */ 35 | NamespacedKey getNamespacedKey(); 36 | } 37 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/registry/RegistrySimple.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.registry; 20 | 21 | import me.wolfyscript.utilities.util.Keyed; 22 | import me.wolfyscript.utilities.util.NamespacedKey; 23 | 24 | import java.util.HashMap; 25 | import java.util.Map; 26 | 27 | /** 28 | * A simple registry, used for basic use cases. 29 | * 30 | * @param The type of the value. 31 | */ 32 | public class RegistrySimple extends AbstractRegistry, V> { 33 | 34 | public RegistrySimple(NamespacedKey namespacedKey, Registries registries) { 35 | super(namespacedKey, new HashMap<>(), registries); 36 | } 37 | 38 | public RegistrySimple(NamespacedKey namespacedKey, Registries registries, Class type) { 39 | super(namespacedKey, new HashMap<>(), registries, type); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/inventory/custom_items/meta/PlayerHeadMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.inventory.custom_items.meta; 20 | 21 | 22 | import me.wolfyscript.utilities.api.inventory.custom_items.CustomItem; 23 | import me.wolfyscript.utilities.util.NamespacedKey; 24 | import me.wolfyscript.utilities.util.inventory.item_builder.ItemBuilder; 25 | 26 | public class PlayerHeadMeta extends Meta { 27 | 28 | public static final NamespacedKey KEY = NamespacedKey.wolfyutilties("player_head"); 29 | 30 | public PlayerHeadMeta() { 31 | super(KEY); 32 | } 33 | 34 | @Override 35 | public boolean check(CustomItem item, ItemBuilder itemOther) { 36 | String valueOther = itemOther.getPlayerHeadValue(); 37 | String value = item.getPlayerHeadValue(); 38 | return valueOther.equals(value); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/util/inventory/item_builder/ItemBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.util.inventory.item_builder; 20 | 21 | import org.bukkit.Material; 22 | import org.bukkit.inventory.ItemStack; 23 | 24 | public class ItemBuilder extends AbstractItemBuilder { 25 | 26 | private final ItemStack itemStack; 27 | 28 | public ItemBuilder(ItemStack itemStack){ 29 | super(ItemBuilder.class); 30 | this.itemStack = itemStack; 31 | } 32 | 33 | public ItemBuilder(Material material){ 34 | super(ItemBuilder.class); 35 | this.itemStack = new ItemStack(material); 36 | } 37 | 38 | @Override 39 | protected ItemStack getItemStack() { 40 | return itemStack; 41 | } 42 | 43 | @Override 44 | public ItemStack create() { 45 | return itemStack; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/compatibility/plugins/itemsadder/CustomStack.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.compatibility.plugins.itemsadder; 20 | 21 | import org.bukkit.inventory.ItemStack; 22 | 23 | public interface CustomStack { 24 | 25 | ItemStack getItemStack(); 26 | 27 | String getNamespace(); 28 | 29 | String getId(); 30 | 31 | String getNamespacedID(); 32 | 33 | String getPermission(); 34 | 35 | boolean hasPermission(); 36 | 37 | boolean isBlock(); 38 | 39 | boolean isBlockAllEnchants(); 40 | 41 | boolean hasUsagesAttribute(); 42 | 43 | void setUsages(int amount); 44 | 45 | void reduceUsages(int amount); 46 | 47 | int getUsages(); 48 | 49 | boolean hasCustomDurability(); 50 | 51 | int getDurability(); 52 | 53 | void setDurability(int durability); 54 | 55 | int getMaxDurability(); 56 | 57 | } 58 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/util/RandomUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.util; 20 | 21 | 22 | import org.bukkit.util.Vector; 23 | 24 | import java.util.Random; 25 | 26 | public class RandomUtils { 27 | 28 | private RandomUtils() { 29 | } 30 | 31 | public static final Random random = new Random(System.currentTimeMillis()); 32 | 33 | public static Vector getRandomVector() { 34 | double x = random.nextDouble() * 2 - 1; 35 | double y = random.nextDouble() * 2 - 1; 36 | double z = random.nextDouble() * 2 - 1; 37 | return (new Vector(x, y, z)).normalize(); 38 | } 39 | 40 | public static Vector getRandomCircleVector() { 41 | double rnd = random.nextDouble() * 2.0D * Math.PI; 42 | double x = Math.cos(rnd); 43 | double z = Math.sin(rnd); 44 | return new Vector(x, 0.0D, z); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/util/particles/pos/ParticlePosBlock.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.util.particles.pos; 20 | 21 | import org.bukkit.Location; 22 | import org.bukkit.block.Block; 23 | 24 | public class ParticlePosBlock extends ParticlePos { 25 | 26 | private final Block block; 27 | 28 | public ParticlePosBlock(Block block) { 29 | super(); 30 | this.block = block; 31 | } 32 | 33 | public ParticlePosBlock(ParticlePosBlock pos) { 34 | super(pos); 35 | this.block = pos.block; 36 | } 37 | 38 | public Block getBlock() { 39 | return block; 40 | } 41 | 42 | @Override 43 | public Location getLocation() { 44 | return block.getLocation().add(getOffset()); 45 | } 46 | 47 | @Override 48 | public ParticlePosBlock shallowCopy() { 49 | return new ParticlePosBlock(this); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/util/json/jackson/serialization/PotionEffectTypeSerialization.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.util.json.jackson.serialization; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | import com.fasterxml.jackson.databind.module.SimpleModule; 23 | import me.wolfyscript.utilities.util.json.jackson.JacksonUtil; 24 | import org.bukkit.potion.PotionEffectType; 25 | 26 | public class PotionEffectTypeSerialization { 27 | 28 | public static void create(SimpleModule module) { 29 | JacksonUtil.addSerializerAndDeserializer(module, PotionEffectType.class, (potionEffectType, gen, serializerProvider) -> { 30 | gen.writeString(potionEffectType.getName()); 31 | }, (p, deserializationContext) -> { 32 | JsonNode node = p.readValueAsTree(); 33 | return PotionEffectType.getByName(node.asText()); 34 | }); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/util/particles/pos/ParticlePosPlayer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.util.particles.pos; 20 | 21 | import org.bukkit.Location; 22 | import org.bukkit.entity.Player; 23 | 24 | public class ParticlePosPlayer extends ParticlePos { 25 | 26 | private final Player player; 27 | 28 | public ParticlePosPlayer(Player player) { 29 | super(); 30 | this.player = player; 31 | } 32 | 33 | public ParticlePosPlayer(ParticlePosPlayer pos) { 34 | super(pos); 35 | this.player = pos.player; 36 | } 37 | 38 | @Override 39 | public Location getLocation() { 40 | return player.getLocation().add(getOffset()); 41 | } 42 | 43 | @Override 44 | public ParticlePos shallowCopy() { 45 | return new ParticlePosPlayer(this); 46 | } 47 | 48 | public Player getPlayer() { 49 | return player; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/util/eval/value_providers/ValueProviderStringConst.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.util.eval.value_providers; 20 | 21 | import com.fasterxml.jackson.annotation.JsonCreator; 22 | import com.fasterxml.jackson.annotation.JsonProperty; 23 | import me.wolfyscript.utilities.util.NamespacedKey; 24 | import me.wolfyscript.utilities.util.eval.context.EvalContext; 25 | 26 | public class ValueProviderStringConst extends AbstractValueProvider { 27 | 28 | public static final NamespacedKey KEY = NamespacedKey.wolfyutilties("string/const"); 29 | 30 | private final String value; 31 | 32 | @JsonCreator 33 | public ValueProviderStringConst(@JsonProperty("value") String value) { 34 | super(KEY); 35 | this.value = value; 36 | } 37 | 38 | @Override 39 | public String getValue(EvalContext context) { 40 | return value; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/util/eval/value_providers/ValueProviderIntegerConst.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.util.eval.value_providers; 20 | 21 | import com.fasterxml.jackson.annotation.JsonCreator; 22 | import com.fasterxml.jackson.annotation.JsonProperty; 23 | import me.wolfyscript.utilities.util.NamespacedKey; 24 | import me.wolfyscript.utilities.util.eval.context.EvalContext; 25 | 26 | public class ValueProviderIntegerConst extends AbstractValueProvider implements ValueProviderInteger { 27 | 28 | public static final NamespacedKey KEY = NamespacedKey.wolfyutilties("int/const"); 29 | 30 | private final int value; 31 | 32 | @JsonCreator 33 | public ValueProviderIntegerConst(@JsonProperty("value") int value) { 34 | super(KEY); 35 | this.value = value; 36 | } 37 | 38 | @Override 39 | public Integer getValue(EvalContext context) { 40 | return value; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/util/json/jackson/annotations/OptionalRegexCreator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.util.json.jackson.annotations; 20 | 21 | import java.lang.annotation.ElementType; 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | import java.lang.annotation.Target; 25 | import java.util.regex.Matcher; 26 | 27 | @Retention(RetentionPolicy.RUNTIME) 28 | @Target(ElementType.TYPE) 29 | public @interface OptionalRegexCreator { 30 | 31 | String regex(); 32 | 33 | Class> creator(); 34 | 35 | abstract class RegexCreator { 36 | 37 | protected Class type; 38 | 39 | protected RegexCreator(Class type) { 40 | this.type = type; 41 | } 42 | 43 | public abstract T create(Matcher matcher); 44 | 45 | public Class getType() { 46 | return type; 47 | } 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /plugin-compatibility/src/main/java/me/wolfyscript/utilities/compatibility/plugins/placeholderapi/value_providers/ValueProviderStringPAPI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.compatibility.plugins.placeholderapi.value_providers; 20 | 21 | import com.fasterxml.jackson.annotation.JsonCreator; 22 | import com.fasterxml.jackson.annotation.JsonProperty; 23 | import me.wolfyscript.utilities.util.NamespacedKey; 24 | import me.wolfyscript.utilities.util.eval.context.EvalContext; 25 | 26 | public class ValueProviderStringPAPI extends ValueProviderPlaceholderAPI { 27 | 28 | public static final NamespacedKey KEY = NamespacedKey.wolfyutilties("string/papi"); 29 | 30 | @JsonCreator 31 | protected ValueProviderStringPAPI(@JsonProperty("value") String value) { 32 | super(KEY, value); 33 | } 34 | 35 | @Override 36 | public String getValue(EvalContext context) { 37 | return getPlaceholderValue(context); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/compatibility/CompatibilityManagerBukkit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.compatibility; 20 | 21 | import me.wolfyscript.utilities.api.WolfyUtilCore; 22 | 23 | public final class CompatibilityManagerBukkit implements CompatibilityManager { 24 | 25 | private final WolfyUtilCore core; 26 | private final PluginsBukkit pluginsBukkit; 27 | 28 | public CompatibilityManagerBukkit(WolfyUtilCore core) { 29 | this.core = core; 30 | this.pluginsBukkit = new PluginsBukkit(core); 31 | } 32 | 33 | public void init() { 34 | pluginsBukkit.init(); 35 | } 36 | 37 | /** 38 | * @deprecated wolfyutils only supports the latest mc version. So this always returns true! 39 | */ 40 | @Deprecated(forRemoval = true) 41 | public boolean has1_20Features() { 42 | return true; 43 | } 44 | 45 | public Plugins getPlugins() { 46 | return pluginsBukkit; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/messages/MessageFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.messages; 20 | 21 | import com.wolfyscript.utilities.bukkit.WolfyUtilsBukkit; 22 | import me.wolfyscript.utilities.api.WolfyUtilCore; 23 | import me.wolfyscript.utilities.api.nms.network.MCByteBuf; 24 | import org.bukkit.entity.Player; 25 | 26 | public class MessageFactory { 27 | 28 | private final WolfyUtilCore plugin; 29 | private final WolfyUtilsBukkit wolfyUtils; 30 | 31 | public MessageFactory(WolfyUtilCore wuPlugin) { 32 | this.plugin = wuPlugin; 33 | this.wolfyUtils = wuPlugin.getWolfyUtils(); 34 | } 35 | 36 | public void sendWolfyUtilsInfo(Player player) { 37 | MCByteBuf buf = wolfyUtils.getNmsUtil().getNetworkUtil().buffer(); 38 | buf.writeBoolean(true); 39 | buf.writeUtf(plugin.getDescription().getVersion()); 40 | wolfyUtils.getMessageAPI().send(Messages.CONNECT_INFO, player, buf); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/util/eval/operators/LogicalOperator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.util.eval.operators; 20 | 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | import me.wolfyscript.utilities.util.NamespacedKey; 23 | 24 | /** 25 | * An Operator that represents logical operators like and (&&), or (||), not (!).
26 | * They evaluate at least one inner {@link BoolOperator}, which then results in a booleanish output. 27 | * 28 | *
    29 | *
  • {@link LogicalOperatorAnd}
  • 30 | *
  • {@link LogicalOperatorOr}
  • 31 | *
  • {@link LogicalOperatorNot}
  • 32 | *
33 | * 34 | */ 35 | public abstract class LogicalOperator extends BoolOperator { 36 | 37 | @JsonProperty("this") 38 | protected final BoolOperator thisValue; 39 | 40 | public LogicalOperator(NamespacedKey namespacedKey, BoolOperator thisValue) { 41 | super(namespacedKey); 42 | this.thisValue = thisValue; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/util/eval/value_providers/ValueProviderVariable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.util.eval.value_providers; 20 | 21 | import com.fasterxml.jackson.annotation.JsonIgnore; 22 | import com.fasterxml.jackson.annotation.JsonProperty; 23 | import me.wolfyscript.utilities.util.NamespacedKey; 24 | import me.wolfyscript.utilities.util.eval.context.EvalContext; 25 | 26 | public abstract class ValueProviderVariable extends AbstractValueProvider { 27 | 28 | @JsonProperty("var") 29 | private final String variable; 30 | @JsonIgnore 31 | private final Class typeClass; 32 | 33 | protected ValueProviderVariable(NamespacedKey key, Class typeClass, String variable) { 34 | super(key); 35 | this.typeClass = typeClass; 36 | this.variable = variable; 37 | } 38 | 39 | @Override 40 | public V getValue(EvalContext context) { 41 | return typeClass.cast(context.getVariable(variable)); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /core/src/main/java/com/wolfyscript/utilities/verification/CollectionVerifierBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ____ _ _ ____ ___ ____ _ _ ____ ____ ____ ____ ___ _ _ _ ____ 3 | * | | | [__ | | | |\/| | |__/ |__| |___ | | |\ | | __ 4 | * |___ |__| ___] | |__| | | |___ | \ | | | | | | \| |__] 5 | * 6 | * CustomCrafting Recipe creation and management tool for Minecraft 7 | * Copyright (C) 2021 WolfyScript 8 | * 9 | * This program is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program. If not, see . 21 | */ 22 | 23 | package com.wolfyscript.utilities.verification; 24 | 25 | import java.util.Collection; 26 | import java.util.function.Consumer; 27 | 28 | public interface CollectionVerifierBuilder extends VerifierBuilder, CollectionVerifierBuilder, CollectionVerifier> { 29 | 30 | /** 31 | * Specifies the validator that is used to validate each element in the collection. 32 | * 33 | * @param childBuilder The element validator builder 34 | * @return This build instance for chaining 35 | */ 36 | CollectionVerifierBuilder forEach(Consumer> childBuilder); 37 | 38 | CollectionVerifierBuilder forEach(Verifier existing); 39 | } 40 | -------------------------------------------------------------------------------- /core/src/main/java/me/wolfyscript/utilities/api/inventory/tags/Tags.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WolfyUtilities, APIs and Utilities for Minecraft Spigot plugins 3 | * Copyright (C) 2021 WolfyScript 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.wolfyscript.utilities.api.inventory.tags; 20 | 21 | import me.wolfyscript.utilities.api.WolfyUtilCore; 22 | import me.wolfyscript.utilities.registry.Registries; 23 | import me.wolfyscript.utilities.registry.RegistrySimple; 24 | import me.wolfyscript.utilities.util.Keyed; 25 | import me.wolfyscript.utilities.util.NamespacedKey; 26 | import org.jetbrains.annotations.Nullable; 27 | 28 | public class Tags extends RegistrySimple> { 29 | 30 | @Deprecated 31 | public Tags() { 32 | super(new NamespacedKey(WolfyUtilCore.getInstance(), "custom_tags"), WolfyUtilCore.getInstance().getRegistries()); 33 | } 34 | 35 | public Tags(Registries registries) { 36 | super(new NamespacedKey(registries.getCore(), "custom_tags"), registries); 37 | } 38 | 39 | @Nullable 40 | public CustomTag getTag(NamespacedKey namespacedKey) { 41 | return get(namespacedKey); 42 | } 43 | 44 | } 45 | --------------------------------------------------------------------------------