├── Hooks ├── build.gradle ├── Vault │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── hooks │ │ └── EconomyProvider_Vault.java ├── Lands │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── hooks │ │ └── ClaimsProvider_Lands.java ├── McMMO1 │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── hooks │ │ └── DropsProvider_mcMMO1.java ├── Towny │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── hooks │ │ └── ClaimsProvider_Towny.java ├── McMMO2 │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── hooks │ │ └── DropsProvider_mcMMO2.java ├── Residence │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── hooks │ │ └── ClaimsProvider_Residence.java ├── Villagers │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── hooks │ │ └── ClaimsProvider_Villages.java ├── ChunkHoppers │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── hooks │ │ └── DropsProvider_ChunkHoppers.java ├── RoseStacker │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── hooks │ │ └── DropsProvider_RoseStacker.java ├── WildChests │ └── build.gradle ├── SuperMobCoins │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── hooks │ │ └── SuperMobCoinsHook.java ├── WildStacker │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── hooks │ │ ├── StackedItemProvider_WildStacker.java │ │ └── DropsProvider_WildStacker.java ├── FactionsUUID │ └── build.gradle ├── MergedSpawner │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── hooks │ │ └── DropsProvider_MergedSpawner.java ├── ChunkCollectors │ └── build.gradle ├── GriefPrevention │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── hooks │ │ └── ClaimsProvider_GriefPrevention.java ├── SavageFactions │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── hooks │ │ └── FactionsProvider_SavageFactions.java ├── SilkSpawners_Timbru5 │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── hooks │ │ └── DropsProvider_SilkSpawners_Timbru5.java ├── SilkSpawners_Timbru6 │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── hooks │ │ └── DropsProvider_SilkSpawners_Timbru6.java ├── FactionsX │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── hooks │ │ ├── ClaimsProvider_FactionsX.java │ │ └── FactionsProvider_FactionsX.java ├── MassiveFactions │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── hooks │ │ └── ClaimsProvider_MassiveFactions.java ├── Folia │ └── build.gradle └── SilkSpawners_CandC2 │ ├── build.gradle │ └── src │ └── main │ └── java │ └── com │ └── bgsoftware │ └── wildtools │ └── hooks │ └── DropsProvider_SilkSpawners_CandC2.java ├── .github ├── FUNDING.yml └── ISSUE_TEMPLATE │ └── config.yml ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── API ├── src │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── api │ │ ├── objects │ │ ├── tools │ │ │ ├── SellTool.java │ │ │ ├── SortTool.java │ │ │ ├── PillarTool.java │ │ │ ├── LightningTool.java │ │ │ ├── CrowbarTool.java │ │ │ ├── BuilderTool.java │ │ │ ├── CuboidTool.java │ │ │ ├── DrainTool.java │ │ │ ├── IceTool.java │ │ │ ├── MagnetTool.java │ │ │ ├── CannonTool.java │ │ │ ├── CraftingTool.java │ │ │ └── HarvesterTool.java │ │ ├── ToolMode.java │ │ └── Selection.java │ │ ├── hooks │ │ ├── PricesProvider.java │ │ ├── ClaimsProvider.java │ │ ├── SoldItem.java │ │ ├── SellInfo.java │ │ ├── DropsProvider.java │ │ └── ContainerProvider.java │ │ ├── WildTools.java │ │ ├── events │ │ ├── ToolUseEvent.java │ │ ├── MagnetWandUseEvent.java │ │ ├── SortWandUseEvent.java │ │ ├── CannonWandUseEvent.java │ │ ├── CraftingWandUseEvent.java │ │ ├── LightningWandUseEvent.java │ │ ├── CrowbarWandUseEvent.java │ │ ├── CuboidWandUseEvent.java │ │ ├── DrainWandUseEvent.java │ │ ├── IceWandUseEvent.java │ │ ├── PillarWandUseEvent.java │ │ ├── BuilderWandUseEvent.java │ │ └── HarvesterHoeUseEvent.java │ │ └── handlers │ │ └── ProvidersManager.java └── build.gradle ├── .gitattributes ├── NMS ├── Spigot │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── nms │ │ ├── alogrithms │ │ └── SpigotGlowEnchantment.java │ │ └── recipe │ │ └── AdvancedRecipeClassImpl.java ├── v1_21_4 │ ├── properties │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── bgsoftware │ │ │ └── wildtools │ │ │ └── nms │ │ │ └── v1_21_4 │ │ │ ├── NMSAdapterImpl.java │ │ │ ├── NMSWorldImpl.java │ │ │ └── tool │ │ │ └── ToolItemStackImpl.java │ └── build.gradle ├── v1_21_5 │ ├── properties │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── bgsoftware │ │ │ └── wildtools │ │ │ └── nms │ │ │ └── v1_21_5 │ │ │ ├── NMSAdapterImpl.java │ │ │ ├── NMSWorldImpl.java │ │ │ └── tool │ │ │ └── ToolItemStackImpl.java │ └── build.gradle ├── v1_21_7 │ ├── properties │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── bgsoftware │ │ │ └── wildtools │ │ │ └── nms │ │ │ └── v1_21_7 │ │ │ ├── NMSAdapterImpl.java │ │ │ ├── NMSWorldImpl.java │ │ │ └── tool │ │ │ └── ToolItemStackImpl.java │ └── build.gradle ├── v1_21_9 │ ├── properties │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── bgsoftware │ │ │ └── wildtools │ │ │ └── nms │ │ │ └── v1_21_9 │ │ │ ├── NMSAdapterImpl.java │ │ │ └── NMSWorldImpl.java │ └── build.gradle ├── v1_17 │ ├── properties │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── nms │ │ └── v1_17 │ │ ├── NMSWorldImpl.java │ │ ├── tool │ │ └── ToolItemStackImpl.java │ │ └── NMSAdapterImpl.java ├── v1_18 │ ├── properties │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── nms │ │ └── v1_18 │ │ ├── NMSWorldImpl.java │ │ ├── tool │ │ └── ToolItemStackImpl.java │ │ └── NMSAdapterImpl.java ├── v1_19 │ ├── properties │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── nms │ │ └── v1_19 │ │ ├── NMSWorldImpl.java │ │ ├── tool │ │ └── ToolItemStackImpl.java │ │ └── NMSAdapterImpl.java ├── v1_21 │ ├── properties │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── bgsoftware │ │ │ └── wildtools │ │ │ └── nms │ │ │ └── v1_21 │ │ │ ├── NMSAdapterImpl.java │ │ │ ├── NMSWorldImpl.java │ │ │ └── tool │ │ │ └── ToolItemStackImpl.java │ └── build.gradle ├── v1_21_10 │ ├── properties │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── nms │ │ └── v1_21_10 │ │ ├── NMSAdapterImpl.java │ │ └── NMSWorldImpl.java ├── v1_20_4 │ ├── properties │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── bgsoftware │ │ │ └── wildtools │ │ │ └── nms │ │ │ └── v1_20_4 │ │ │ ├── NMSAdapterImpl.java │ │ │ ├── NMSWorldImpl.java │ │ │ └── tool │ │ │ └── ToolItemStackImpl.java │ └── build.gradle ├── v1_21_3 │ ├── properties │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── bgsoftware │ │ │ └── wildtools │ │ │ └── nms │ │ │ └── v1_21_3 │ │ │ ├── NMSAdapterImpl.java │ │ │ ├── NMSWorldImpl.java │ │ │ └── tool │ │ │ └── ToolItemStackImpl.java │ └── build.gradle ├── Spigot-1_20_3 │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── nms │ │ └── v1_20_3 │ │ ├── alogrithms │ │ └── SpigotGlowEnchantment.java │ │ └── recipe │ │ └── AdvancedRecipeClassImpl.java ├── v1_20_3 │ ├── properties │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── nms │ │ └── v1_20_3 │ │ ├── NMSWorldImpl.java │ │ ├── tool │ │ └── ToolItemStackImpl.java │ │ └── NMSAdapterImpl.java ├── Paper │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── nms │ │ └── alogrithms │ │ └── PaperGlowEnchantment.java ├── v1_7_R4 │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── nms │ │ └── v1_7_R4 │ │ ├── world │ │ └── FakeCraftBlock.java │ │ └── NMSUtils.java ├── v1_8_R3 │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── nms │ │ └── v1_8_R3 │ │ ├── world │ │ └── FakeCraftBlock.java │ │ └── NMSUtils.java ├── v1_12_R1 │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── nms │ │ └── v1_12_R1 │ │ ├── world │ │ └── FakeCraftBlock.java │ │ └── NMSUtils.java ├── Paper-1_20_3 │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── nms │ │ └── v1_20_3 │ │ └── alogrithms │ │ └── PaperGlowEnchantment.java ├── v1_16_R3 │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ └── nms │ │ └── v1_16_R3 │ │ ├── NMSUtils.java │ │ └── world │ │ └── FakeCraftBlock.java ├── build.gradle └── src │ └── main │ └── templates │ └── tool │ └── AbstractToolItemStack.java.template ├── src └── main │ ├── java │ └── com │ │ └── bgsoftware │ │ └── wildtools │ │ ├── scheduler │ │ ├── ScheduledTask.java │ │ ├── ISchedulerImplementation.java │ │ └── BukkitSchedulerImplementation.java │ │ ├── utils │ │ ├── items │ │ │ ├── DestroySpeedCategory.java │ │ │ └── ItemStackMap.java │ │ ├── Counter.java │ │ ├── Pair.java │ │ ├── math │ │ │ ├── NumberUtils.java │ │ │ ├── Vector2.java │ │ │ └── Vector3.java │ │ ├── inventory │ │ │ └── InventoryUtils.java │ │ └── ServerVersion.java │ │ ├── hooks │ │ ├── EconomyProvider.java │ │ ├── FactionsProvider.java │ │ ├── EconomyProvider_Default.java │ │ ├── listener │ │ │ └── IToolBlockListener.java │ │ ├── StackedItemProvider.java │ │ ├── ExtendedContainerProvider.java │ │ ├── FactionsProvider_Default.java │ │ ├── StackedItemProvider_Default.java │ │ ├── PricesProvider_Default.java │ │ ├── PricesProvider_ShopsBridgeWrapper.java │ │ └── DropsProviders_Default.java │ │ ├── recipes │ │ ├── AdvancedShapedRecipe.java │ │ ├── RecipeChoice.java │ │ └── MaterialChoice.java │ │ ├── command │ │ ├── ICommand.java │ │ └── commands │ │ │ ├── CommandSettings.java │ │ │ └── CommandReload.java │ │ ├── tools │ │ └── ToolBreaksTracker.java │ │ ├── nms │ │ └── NMSWorld.java │ │ └── SellWandLogger.java │ └── resources │ ├── plugin.yml │ └── recipes.yml ├── .gitignore ├── gradle.properties └── settings.gradle /Hooks/build.gradle: -------------------------------------------------------------------------------- 1 | group 'Hooks' -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | custom: https://bg-software.com/patreon 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BG-Software-LLC/WildTools/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/objects/tools/SellTool.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.objects.tools; 2 | 3 | public interface SellTool extends Tool { 4 | } 5 | -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/objects/tools/SortTool.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.objects.tools; 2 | 3 | public interface SortTool extends Tool { 4 | } 5 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # https://help.github.com/articles/dealing-with-line-endings/ 3 | # 4 | # These are explicitly windows files and should use crlf 5 | *.bat text eol=crlf 6 | 7 | -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/objects/tools/PillarTool.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.objects.tools; 2 | 3 | public interface PillarTool extends Tool { 4 | } 5 | -------------------------------------------------------------------------------- /NMS/Spigot/build.gradle: -------------------------------------------------------------------------------- 1 | group 'NMS:Spigot' 2 | 3 | dependencies { 4 | compileOnly "org.spigotmc:v1_16_R3:latest" 5 | compileOnly project(":API") 6 | compileOnly rootProject 7 | } -------------------------------------------------------------------------------- /NMS/v1_21_4/properties: -------------------------------------------------------------------------------- 1 | NMS_VERSION=v1_21_4 2 | CRAFTBUKKIT_PACKAGE=org.bukkit.craftbukkit 3 | COMMON_NMS_PACKAGE=com.bgsoftware.wildtools.nms.v1_20_3 4 | PAPER_PACKAGE=io.papermc.paper.antixray -------------------------------------------------------------------------------- /NMS/v1_21_5/properties: -------------------------------------------------------------------------------- 1 | NMS_VERSION=v1_21_5 2 | CRAFTBUKKIT_PACKAGE=org.bukkit.craftbukkit 3 | COMMON_NMS_PACKAGE=com.bgsoftware.wildtools.nms.v1_20_3 4 | PAPER_PACKAGE=io.papermc.paper.antixray -------------------------------------------------------------------------------- /NMS/v1_21_7/properties: -------------------------------------------------------------------------------- 1 | NMS_VERSION=v1_21_7 2 | CRAFTBUKKIT_PACKAGE=org.bukkit.craftbukkit 3 | COMMON_NMS_PACKAGE=com.bgsoftware.wildtools.nms.v1_20_3 4 | PAPER_PACKAGE=io.papermc.paper.antixray -------------------------------------------------------------------------------- /NMS/v1_21_9/properties: -------------------------------------------------------------------------------- 1 | NMS_VERSION=v1_21_9 2 | CRAFTBUKKIT_PACKAGE=org.bukkit.craftbukkit 3 | COMMON_NMS_PACKAGE=com.bgsoftware.wildtools.nms.v1_20_3 4 | PAPER_PACKAGE=io.papermc.paper.antixray -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/objects/tools/LightningTool.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.objects.tools; 2 | 3 | public interface LightningTool extends Tool{ 4 | } 5 | -------------------------------------------------------------------------------- /NMS/v1_17/properties: -------------------------------------------------------------------------------- 1 | NMS_VERSION=v1_17 2 | CRAFTBUKKIT_PACKAGE=org.bukkit.craftbukkit.v1_17_R1 3 | COMMON_NMS_PACKAGE=com.bgsoftware.wildtools.nms 4 | PAPER_PACKAGE=com.destroystokyo.paper.antixray -------------------------------------------------------------------------------- /NMS/v1_18/properties: -------------------------------------------------------------------------------- 1 | NMS_VERSION=v1_18 2 | CRAFTBUKKIT_PACKAGE=org.bukkit.craftbukkit.v1_18_R2 3 | COMMON_NMS_PACKAGE=com.bgsoftware.wildtools.nms 4 | PAPER_PACKAGE=com.destroystokyo.paper.antixray -------------------------------------------------------------------------------- /NMS/v1_19/properties: -------------------------------------------------------------------------------- 1 | NMS_VERSION=v1_19 2 | CRAFTBUKKIT_PACKAGE=org.bukkit.craftbukkit.v1_19_R3 3 | COMMON_NMS_PACKAGE=com.bgsoftware.wildtools.nms 4 | PAPER_PACKAGE=com.destroystokyo.paper.antixray -------------------------------------------------------------------------------- /NMS/v1_21/properties: -------------------------------------------------------------------------------- 1 | NMS_VERSION=v1_21 2 | CRAFTBUKKIT_PACKAGE=org.bukkit.craftbukkit 3 | COMMON_NMS_PACKAGE=com.bgsoftware.wildtools.nms.v1_20_3 4 | PAPER_PACKAGE=com.destroystokyo.paper.antixray -------------------------------------------------------------------------------- /NMS/v1_21_10/properties: -------------------------------------------------------------------------------- 1 | NMS_VERSION=v1_21_10 2 | CRAFTBUKKIT_PACKAGE=org.bukkit.craftbukkit 3 | COMMON_NMS_PACKAGE=com.bgsoftware.wildtools.nms.v1_20_3 4 | PAPER_PACKAGE=io.papermc.paper.antixray -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/scheduler/ScheduledTask.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.scheduler; 2 | 3 | public interface ScheduledTask { 4 | 5 | void cancel(); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /NMS/v1_20_4/properties: -------------------------------------------------------------------------------- 1 | NMS_VERSION=v1_20_4 2 | CRAFTBUKKIT_PACKAGE=org.bukkit.craftbukkit 3 | COMMON_NMS_PACKAGE=com.bgsoftware.wildtools.nms.v1_20_3 4 | PAPER_PACKAGE=com.destroystokyo.paper.antixray -------------------------------------------------------------------------------- /NMS/v1_21_3/properties: -------------------------------------------------------------------------------- 1 | NMS_VERSION=v1_21_3 2 | CRAFTBUKKIT_PACKAGE=org.bukkit.craftbukkit 3 | COMMON_NMS_PACKAGE=com.bgsoftware.wildtools.nms.v1_20_3 4 | PAPER_PACKAGE=com.destroystokyo.paper.antixray -------------------------------------------------------------------------------- /NMS/Spigot-1_20_3/build.gradle: -------------------------------------------------------------------------------- 1 | group 'NMS:Spigot-1_20_R3' 2 | 3 | dependencies { 4 | compileOnly "org.spigotmc:v1_20_R3:b3973-3" 5 | compileOnly project(":API") 6 | compileOnly rootProject 7 | } -------------------------------------------------------------------------------- /NMS/v1_20_3/properties: -------------------------------------------------------------------------------- 1 | NMS_VERSION=v1_20_3 2 | CRAFTBUKKIT_PACKAGE=org.bukkit.craftbukkit.v1_20_R3 3 | COMMON_NMS_PACKAGE=com.bgsoftware.wildtools.nms.v1_20_3 4 | PAPER_PACKAGE=com.destroystokyo.paper.antixray -------------------------------------------------------------------------------- /NMS/Paper/build.gradle: -------------------------------------------------------------------------------- 1 | group 'NMS:Paper' 2 | 3 | dependencies { 4 | compileOnly "org.spigotmc:v1_16_R3-Tuinity:latest" 5 | compileOnly project(":NMS:Spigot") 6 | compileOnly project(":API") 7 | compileOnly rootProject 8 | } -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/utils/items/DestroySpeedCategory.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.utils.items; 2 | 3 | public enum DestroySpeedCategory { 4 | 5 | AXE, 6 | SHOVEL, 7 | PICKAXE 8 | 9 | } 10 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Feature Requests 4 | url: https://github.com/OmerBenGera/WildTools/discussions 5 | about: Create feature requests, any posted in issue tracker will be removed. 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore Gradle project-specific cache directory 2 | .gradle 3 | gradle.properties 4 | 5 | # Ignore Gradle build output directory 6 | build 7 | 8 | # Ignore intellij files 9 | .idea 10 | *.iml 11 | 12 | # Ignore output generated files 13 | target 14 | out -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/objects/tools/CrowbarTool.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.objects.tools; 2 | 3 | import java.util.List; 4 | 5 | public interface CrowbarTool extends Tool { 6 | 7 | List getCommandsOnUse(); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/hooks/EconomyProvider.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import org.bukkit.entity.Player; 4 | 5 | public interface EconomyProvider { 6 | 7 | void depositPlayer(Player player, double price); 8 | 9 | 10 | 11 | } 12 | -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/objects/tools/BuilderTool.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.objects.tools; 2 | 3 | public interface BuilderTool extends Tool { 4 | 5 | /** 6 | * Get the length of the wand. 7 | */ 8 | int getLength(); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/objects/tools/CuboidTool.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.objects.tools; 2 | 3 | public interface CuboidTool extends Tool { 4 | 5 | /** 6 | * Get the break level of the wand. 7 | */ 8 | int getBreakLevel(); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/objects/tools/DrainTool.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.objects.tools; 2 | 3 | public interface DrainTool extends Tool { 4 | 5 | /** 6 | * Get the draining radius of the wand. 7 | */ 8 | int getRadius(); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/objects/tools/IceTool.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.objects.tools; 2 | 3 | public interface IceTool extends Tool { 4 | 5 | /** 6 | * Get the radius of turning water into ice of the wand. 7 | */ 8 | int getRadius(); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/objects/tools/MagnetTool.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.objects.tools; 2 | 3 | public interface MagnetTool extends Tool { 4 | 5 | /** 6 | * Get the radius of items that will be magnet of the wand. 7 | */ 8 | int getRadius(); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/objects/tools/CannonTool.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.objects.tools; 2 | 3 | public interface CannonTool extends Tool{ 4 | 5 | /** 6 | * Get the maximum amount of tnt to be deposited by the wand. 7 | */ 8 | int getTNTAmount(); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/hooks/PricesProvider.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.hooks; 2 | 3 | import org.bukkit.entity.Player; 4 | import org.bukkit.inventory.ItemStack; 5 | 6 | public interface PricesProvider { 7 | 8 | double getPrice(Player player, ItemStack itemStack); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/hooks/FactionsProvider.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import org.bukkit.entity.Player; 4 | 5 | public interface FactionsProvider { 6 | 7 | int getTNTAmountFromBank(Player player); 8 | 9 | void takeTNTFromBank(Player player, int amount); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/hooks/EconomyProvider_Default.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import org.bukkit.entity.Player; 4 | 5 | public class EconomyProvider_Default implements EconomyProvider { 6 | 7 | @Override 8 | public void depositPlayer(Player player, double price) { 9 | 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/objects/ToolMode.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.objects; 2 | 3 | public enum ToolMode { 4 | 5 | BUILDER, 6 | CANNON, 7 | CRAFTING, 8 | CROWBAR, 9 | CUBOID, 10 | DRAIN, 11 | HARVESTER, 12 | ICE, 13 | LIGHTNING, 14 | MAGNET, 15 | PILLAR, 16 | SELL, 17 | SORT 18 | 19 | } -------------------------------------------------------------------------------- /NMS/v1_7_R4/build.gradle: -------------------------------------------------------------------------------- 1 | group 'NMS:v1_7_R4' 2 | 3 | dependencies { 4 | compileOnly "org.spigotmc:v1_7_R4:latest" 5 | compileOnly project(":API") 6 | compileOnly rootProject 7 | } 8 | 9 | if (project.hasProperty('nms.compile_v1_7') && !Boolean.valueOf(project.findProperty("nms.compile_v1_7").toString())) { 10 | project.tasks.all { task -> task.enabled = false } 11 | } -------------------------------------------------------------------------------- /NMS/v1_8_R3/build.gradle: -------------------------------------------------------------------------------- 1 | group 'NMS:v1_8_R3' 2 | 3 | dependencies { 4 | compileOnly "org.spigotmc:v1_8_R3:latest" 5 | compileOnly project(":API") 6 | compileOnly rootProject 7 | } 8 | 9 | if (project.hasProperty('nms.compile_v1_8') && !Boolean.valueOf(project.findProperty("nms.compile_v1_8").toString())) { 10 | project.tasks.all { task -> task.enabled = false } 11 | } -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/objects/tools/CraftingTool.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.objects.tools; 2 | 3 | import org.bukkit.inventory.Recipe; 4 | 5 | import java.util.Iterator; 6 | 7 | public interface CraftingTool extends Tool { 8 | 9 | /** 10 | * Get all the crafting recipes this wand can craft. 11 | */ 12 | Iterator getCraftings(); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/utils/Counter.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.utils; 2 | 3 | public class Counter { 4 | 5 | private int counter = 0; 6 | 7 | public void increase() { 8 | increase(1); 9 | } 10 | 11 | public void increase(int delta) { 12 | this.counter += delta; 13 | } 14 | 15 | public int get() { 16 | return counter; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/utils/Pair.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.utils; 2 | 3 | public class Pair { 4 | 5 | private final X x; 6 | private final Y y; 7 | 8 | public Pair(X x, Y y){ 9 | this.x = x; 10 | this.y = y; 11 | } 12 | 13 | public X getX() { 14 | return x; 15 | } 16 | 17 | public Y getY() { 18 | return y; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /NMS/v1_12_R1/build.gradle: -------------------------------------------------------------------------------- 1 | group 'NMS:v1_12_R1' 2 | 3 | dependencies { 4 | compileOnly "org.spigotmc:v1_12_R1-Paper:latest" 5 | compileOnly project(":NMS:Spigot") 6 | compileOnly project(":API") 7 | compileOnly rootProject 8 | } 9 | 10 | if (project.hasProperty('nms.compile_v1_12') && !Boolean.valueOf(project.findProperty("nms.compile_v1_12").toString())) { 11 | project.tasks.all { task -> task.enabled = false } 12 | } -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/recipes/AdvancedShapedRecipe.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.recipes; 2 | 3 | import org.bukkit.inventory.ItemStack; 4 | import org.bukkit.inventory.ShapedRecipe; 5 | 6 | public interface AdvancedShapedRecipe { 7 | 8 | AdvancedShapedRecipe setIngredient(char key, ItemStack itemStack); 9 | 10 | AdvancedShapedRecipe shape(String... shape); 11 | 12 | ShapedRecipe toRecipe(); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /Hooks/Vault/build.gradle: -------------------------------------------------------------------------------- 1 | group 'Hooks:Vault' 2 | 3 | dependencies { 4 | compileOnly "net.milkbowl:Vault:1.6.1" 5 | compileOnly "org.spigotmc:v1_8_R3-Taco:latest" 6 | compileOnly project(":API") 7 | compileOnly rootProject 8 | } 9 | 10 | if (project.hasProperty('hook.compile_vault') && 11 | !Boolean.valueOf(project.findProperty("hook.compile_vault").toString())) { 12 | project.tasks.all { task -> task.enabled = false } 13 | } -------------------------------------------------------------------------------- /Hooks/Lands/build.gradle: -------------------------------------------------------------------------------- 1 | group 'Hooks:Lands' 2 | 3 | dependencies { 4 | compileOnly "me.angeschossen:Lands:4.5.2.7" 5 | compileOnly "org.spigotmc:v1_8_R3-Taco:latest" 6 | compileOnly project(":API") 7 | compileOnly rootProject 8 | } 9 | 10 | if (project.hasProperty('hook.compile_lands') && 11 | !Boolean.valueOf(project.findProperty("hook.compile_lands").toString())) { 12 | project.tasks.all { task -> task.enabled = false } 13 | } -------------------------------------------------------------------------------- /Hooks/McMMO1/build.gradle: -------------------------------------------------------------------------------- 1 | group 'Hooks:McMMO1' 2 | 3 | dependencies { 4 | compileOnly "com.gmail.nossr50:mcMMO:1.5" 5 | compileOnly "org.spigotmc:v1_8_R3-Taco:latest" 6 | compileOnly project(":API") 7 | compileOnly rootProject 8 | } 9 | 10 | if (project.hasProperty('hook.compile_mcmmo1') && 11 | !Boolean.valueOf(project.findProperty("hook.compile_mcmmo1").toString())) { 12 | project.tasks.all { task -> task.enabled = false } 13 | } -------------------------------------------------------------------------------- /Hooks/Towny/build.gradle: -------------------------------------------------------------------------------- 1 | group 'Hooks:Towny' 2 | 3 | dependencies { 4 | compileOnly "com.palmergames:Towny:0.96.3.0" 5 | compileOnly "org.spigotmc:v1_8_R3-Taco:latest" 6 | compileOnly project(":API") 7 | compileOnly rootProject 8 | } 9 | 10 | if (project.hasProperty('hook.compile_towny') && 11 | !Boolean.valueOf(project.findProperty("hook.compile_towny").toString())) { 12 | project.tasks.all { task -> task.enabled = false } 13 | } -------------------------------------------------------------------------------- /Hooks/McMMO2/build.gradle: -------------------------------------------------------------------------------- 1 | group 'Hooks:McMMO2' 2 | 3 | dependencies { 4 | compileOnly "com.gmail.nossr50:mcMMO:2.1.202" 5 | compileOnly "org.spigotmc:v1_8_R3-Taco:latest" 6 | compileOnly project(":API") 7 | compileOnly rootProject 8 | } 9 | 10 | if (project.hasProperty('hook.compile_mcmmo2') && 11 | !Boolean.valueOf(project.findProperty("hook.compile_mcmmo2").toString())) { 12 | project.tasks.all { task -> task.enabled = false } 13 | } -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/hooks/listener/IToolBlockListener.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks.listener; 2 | 3 | import com.bgsoftware.wildtools.utils.math.Vector3; 4 | import org.bukkit.World; 5 | 6 | public interface IToolBlockListener { 7 | 8 | void recordBlockChange(World world, Vector3 location, Action action); 9 | 10 | enum Action { 11 | 12 | BLOCK_PLACE, 13 | BLOCK_BREAK 14 | 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /Hooks/Residence/build.gradle: -------------------------------------------------------------------------------- 1 | group 'Hooks:Residence' 2 | 3 | dependencies { 4 | compileOnly "com.zrips:Residence:4.9.0.5" 5 | compileOnly "org.spigotmc:v1_8_R3-Taco:latest" 6 | compileOnly project(":API") 7 | compileOnly rootProject 8 | } 9 | 10 | if (project.hasProperty('hook.compile_residence') && 11 | !Boolean.valueOf(project.findProperty("hook.compile_residence").toString())) { 12 | project.tasks.all { task -> task.enabled = false } 13 | } -------------------------------------------------------------------------------- /NMS/Paper-1_20_3/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("io.papermc.paperweight.userdev") version "2.0.0-beta.17" 3 | } 4 | 5 | group 'NMS:Paper-1_20_3' 6 | 7 | java { 8 | toolchain { 9 | languageVersion.set(JavaLanguageVersion.of(17)) 10 | } 11 | } 12 | 13 | dependencies { 14 | paperweight.paperDevBundle("1.20.4-R0.1-SNAPSHOT") 15 | compileOnly project(":NMS:Spigot-1_20_3") 16 | compileOnly project(":API") 17 | compileOnly rootProject 18 | } -------------------------------------------------------------------------------- /Hooks/Villagers/build.gradle: -------------------------------------------------------------------------------- 1 | group 'Hooks:Villagers' 2 | 3 | dependencies { 4 | compileOnly "com.stefthedev:Villages:0.1.3.2" 5 | compileOnly "org.spigotmc:v1_8_R3-Taco:latest" 6 | compileOnly project(":API") 7 | compileOnly rootProject 8 | } 9 | 10 | if (project.hasProperty('hook.compile_villagers') && 11 | !Boolean.valueOf(project.findProperty("hook.compile_villagers").toString())) { 12 | project.tasks.all { task -> task.enabled = false } 13 | } -------------------------------------------------------------------------------- /Hooks/ChunkHoppers/build.gradle: -------------------------------------------------------------------------------- 1 | group 'Hooks:ChunkHoppers' 2 | 3 | dependencies { 4 | compileOnly "dev.warse:ChunkHoppers:0.1" 5 | compileOnly "org.spigotmc:v1_8_R3-Taco:latest" 6 | compileOnly project(":API") 7 | compileOnly rootProject 8 | } 9 | 10 | if (project.hasProperty('hook.compile_chunkhoppers') && 11 | !Boolean.valueOf(project.findProperty("hook.compile_chunkhoppers").toString())) { 12 | project.tasks.all { task -> task.enabled = false } 13 | } -------------------------------------------------------------------------------- /Hooks/RoseStacker/build.gradle: -------------------------------------------------------------------------------- 1 | group 'Hooks:RoseStacker' 2 | 3 | dependencies { 4 | compileOnly "dev.rosewood:RoseStacker:1.4.1" 5 | compileOnly "org.spigotmc:v1_8_R3-Taco:latest" 6 | compileOnly project(":API") 7 | compileOnly rootProject 8 | } 9 | 10 | if (project.hasProperty('hook.compile_rosestacker') && 11 | !Boolean.valueOf(project.findProperty("hook.compile_rosestacker").toString())) { 12 | project.tasks.all { task -> task.enabled = false } 13 | } -------------------------------------------------------------------------------- /Hooks/WildChests/build.gradle: -------------------------------------------------------------------------------- 1 | group 'Hooks:WildChests' 2 | 3 | dependencies { 4 | compileOnly "com.bgsoftware:WildChestsAPI:2.2.1" 5 | compileOnly "org.spigotmc:v1_8_R3-Taco:latest" 6 | compileOnly project(":API") 7 | compileOnly rootProject 8 | } 9 | 10 | if (project.hasProperty('hook.compile_wildchests') && 11 | !Boolean.valueOf(project.findProperty("hook.compile_wildchests").toString())) { 12 | project.tasks.all { task -> task.enabled = false } 13 | } -------------------------------------------------------------------------------- /NMS/v1_16_R3/build.gradle: -------------------------------------------------------------------------------- 1 | group 'NMS:v1_16_R3' 2 | 3 | dependencies { 4 | compileOnly "org.spigotmc:v1_16_R3-Tuinity:latest" 5 | compileOnly project(":NMS:Spigot") 6 | compileOnly project(":NMS:Paper") 7 | compileOnly project(":API") 8 | compileOnly rootProject 9 | } 10 | 11 | if (project.hasProperty('nms.compile_v1_16') && !Boolean.valueOf(project.findProperty("nms.compile_v1_16").toString())) { 12 | project.tasks.all { task -> task.enabled = false } 13 | } -------------------------------------------------------------------------------- /Hooks/SuperMobCoins/build.gradle: -------------------------------------------------------------------------------- 1 | group 'Hooks:SuperMobCoins' 2 | 3 | dependencies { 4 | compileOnly "me.swanis:SuperMobCoins:2.1" 5 | compileOnly "org.spigotmc:v1_8_R3-Taco:latest" 6 | compileOnly project(":API") 7 | compileOnly rootProject 8 | } 9 | 10 | if (project.hasProperty('hook.compile_supermobcoins') && 11 | !Boolean.valueOf(project.findProperty("hook.compile_supermobcoins").toString())) { 12 | project.tasks.all { task -> task.enabled = false } 13 | } -------------------------------------------------------------------------------- /Hooks/WildStacker/build.gradle: -------------------------------------------------------------------------------- 1 | group 'Hooks:WildStacker' 2 | 3 | dependencies { 4 | compileOnly "com.bgsoftware:WildStackerAPI:3.6.1" 5 | compileOnly "org.spigotmc:v1_8_R3-Taco:latest" 6 | compileOnly project(":API") 7 | compileOnly rootProject 8 | } 9 | 10 | if (project.hasProperty('hook.compile_wildstacker') && 11 | !Boolean.valueOf(project.findProperty("hook.compile_wildstacker").toString())) { 12 | project.tasks.all { task -> task.enabled = false } 13 | } -------------------------------------------------------------------------------- /Hooks/FactionsUUID/build.gradle: -------------------------------------------------------------------------------- 1 | group 'Hooks:FactionsUUID' 2 | 3 | dependencies { 4 | compileOnly "com.drtshock:Factions:1.6.9.5-U0.5.9" 5 | compileOnly "org.spigotmc:v1_8_R3-Taco:latest" 6 | compileOnly project(":API") 7 | compileOnly rootProject 8 | } 9 | 10 | if (project.hasProperty('hook.compile_factionsuuid') && 11 | !Boolean.valueOf(project.findProperty("hook.compile_factionsuuid").toString())) { 12 | project.tasks.all { task -> task.enabled = false } 13 | } -------------------------------------------------------------------------------- /Hooks/MergedSpawner/build.gradle: -------------------------------------------------------------------------------- 1 | group 'Hooks:MergedSpawner' 2 | 3 | dependencies { 4 | compileOnly "com.vk2gpz:MergedSpawnerAPI:13" 5 | compileOnly "org.spigotmc:v1_8_R3-Taco:latest" 6 | compileOnly project(":API") 7 | compileOnly rootProject 8 | } 9 | 10 | if (project.hasProperty('hook.compile_mergedspawner') && 11 | !Boolean.valueOf(project.findProperty("hook.compile_mergedspawner").toString())) { 12 | project.tasks.all { task -> task.enabled = false } 13 | } -------------------------------------------------------------------------------- /Hooks/ChunkCollectors/build.gradle: -------------------------------------------------------------------------------- 1 | group 'Hooks:ChunkCollectors' 2 | 3 | dependencies { 4 | compileOnly "com.cloth:ChunkCollectors:2.9.0" 5 | compileOnly "org.spigotmc:v1_8_R3-Taco:latest" 6 | compileOnly project(":API") 7 | compileOnly rootProject 8 | } 9 | 10 | if (project.hasProperty('hook.compile_chunkcollectors') && 11 | !Boolean.valueOf(project.findProperty("hook.compile_chunkcollectors").toString())) { 12 | project.tasks.all { task -> task.enabled = false } 13 | } -------------------------------------------------------------------------------- /Hooks/GriefPrevention/build.gradle: -------------------------------------------------------------------------------- 1 | group 'Hooks:GriefPrevention' 2 | 3 | dependencies { 4 | compileOnly "me.ryanhamshire:GriefPrevention:16.8" 5 | compileOnly "org.spigotmc:v1_8_R3-Taco:latest" 6 | compileOnly project(":API") 7 | compileOnly rootProject 8 | } 9 | 10 | if (project.hasProperty('hook.compile_griefprevention') && 11 | !Boolean.valueOf(project.findProperty("hook.compile_griefprevention").toString())) { 12 | project.tasks.all { task -> task.enabled = false } 13 | } -------------------------------------------------------------------------------- /Hooks/SavageFactions/build.gradle: -------------------------------------------------------------------------------- 1 | group 'Hooks:SavageFactions' 2 | 3 | dependencies { 4 | compileOnly 'net.prosavage:Factions:1.6.9.5-U0.2.1-RC-1.6.2-RC-2.5-RC-9' 5 | compileOnly "org.spigotmc:v1_8_R3-Taco:latest" 6 | compileOnly project(":API") 7 | compileOnly rootProject 8 | } 9 | 10 | if (project.hasProperty('hook.compile_savagefactions') && 11 | !Boolean.valueOf(project.findProperty("hook.compile_savagefactions").toString())) { 12 | project.tasks.all { task -> task.enabled = false } 13 | } -------------------------------------------------------------------------------- /Hooks/SilkSpawners_Timbru5/build.gradle: -------------------------------------------------------------------------------- 1 | group 'Hooks:SilkSpawners_Timbru5' 2 | 3 | dependencies { 4 | compileOnly 'de.dustplanet:SilkSpawners:5.0.2' 5 | compileOnly "org.spigotmc:v1_8_R3-Taco:latest" 6 | compileOnly project(":API") 7 | compileOnly rootProject 8 | } 9 | 10 | if (project.hasProperty('hook.compile_silkspawners_timbru5') && 11 | !Boolean.valueOf(project.findProperty("hook.compile_silkspawners_timbru5").toString())) { 12 | project.tasks.all { task -> task.enabled = false } 13 | } -------------------------------------------------------------------------------- /Hooks/SilkSpawners_Timbru6/build.gradle: -------------------------------------------------------------------------------- 1 | group 'Hooks:SilkSpawners_Timbru6' 2 | 3 | dependencies { 4 | compileOnly "de.dustplanet:SilkSpawners:6.0.0" 5 | compileOnly "org.spigotmc:v1_8_R3-Taco:latest" 6 | compileOnly project(":API") 7 | compileOnly rootProject 8 | } 9 | 10 | if (project.hasProperty('hook.compile_silkspawners_timbru6') && 11 | !Boolean.valueOf(project.findProperty("hook.compile_silkspawners_timbru6").toString())) { 12 | project.tasks.all { task -> task.enabled = false } 13 | } -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/WildTools.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api; 2 | 3 | import com.bgsoftware.wildtools.api.handlers.ProvidersManager; 4 | import com.bgsoftware.wildtools.api.handlers.ToolsManager; 5 | 6 | public interface WildTools { 7 | 8 | /** 9 | * Get the tools manager of the core. 10 | */ 11 | ToolsManager getToolsManager(); 12 | 13 | /** 14 | * Get the providers manager of the core. 15 | */ 16 | ProvidersManager getProviders(); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /Hooks/FactionsX/build.gradle: -------------------------------------------------------------------------------- 1 | group 'Hooks:FactionsX' 2 | 3 | dependencies { 4 | compileOnly "net.prosavage:FactionsX:0.4.2" 5 | compileOnly "net.prosavage:FactionsXTNTAddon:0.4.2" 6 | compileOnly "org.spigotmc:v1_8_R3-Taco:latest" 7 | compileOnly project(":API") 8 | compileOnly rootProject 9 | } 10 | 11 | if (project.hasProperty('hook.compile_factionsx') && 12 | !Boolean.valueOf(project.findProperty("hook.compile_factionsx").toString())) { 13 | project.tasks.all { task -> task.enabled = false } 14 | } -------------------------------------------------------------------------------- /Hooks/MassiveFactions/build.gradle: -------------------------------------------------------------------------------- 1 | group 'Hooks:MassiveFactions' 2 | 3 | dependencies { 4 | compileOnly "com.massivecraft:Factions:2.13.6" 5 | compileOnly "com.massivecraft:MassiveCore:2.13.6" 6 | compileOnly "org.spigotmc:v1_8_R3-Taco:latest" 7 | compileOnly project(":API") 8 | compileOnly rootProject 9 | } 10 | 11 | if (project.hasProperty('hook.compile_massivefactions') && 12 | !Boolean.valueOf(project.findProperty("hook.compile_massivefactions").toString())) { 13 | project.tasks.all { task -> task.enabled = false } 14 | } -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/hooks/ClaimsProvider.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.hooks; 2 | 3 | import org.bukkit.Location; 4 | import org.bukkit.entity.Player; 5 | 6 | public interface ClaimsProvider { 7 | 8 | /** 9 | * Check if a location is inside a claim of the player. 10 | * This is used when having only-inside-claim is enabled. 11 | * @param player The player to check. 12 | * @param location The location to check. 13 | */ 14 | boolean isPlayerClaim(Player player, Location location); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /Hooks/Folia/build.gradle: -------------------------------------------------------------------------------- 1 | group 'Hooks:Folia' 2 | 3 | java { 4 | toolchain { 5 | languageVersion.set(JavaLanguageVersion.of(17)) 6 | } 7 | } 8 | 9 | repositories { 10 | maven { url 'https://repo.papermc.io/repository/maven-public/' } 11 | } 12 | 13 | dependencies { 14 | compileOnly 'dev.folia:folia-api:1.20.1-R0.1-SNAPSHOT' 15 | compileOnly project(":API") 16 | compileOnly rootProject 17 | } 18 | 19 | if (project.hasProperty('hook.compile_folia') && 20 | !Boolean.valueOf(project.findProperty("hook.compile_folia").toString())) { 21 | project.tasks.all { task -> task.enabled = false } 22 | } -------------------------------------------------------------------------------- /Hooks/SilkSpawners_CandC2/build.gradle: -------------------------------------------------------------------------------- 1 | group 'Hooks:SilkSpawners_CandC2' 2 | 3 | java { 4 | toolchain { 5 | languageVersion.set(JavaLanguageVersion.of(16)) 6 | } 7 | } 8 | 9 | dependencies { 10 | compileOnly "de.corneliusmay:SilkSpawners:2.3.2" 11 | compileOnly "org.spigotmc:v1_8_R3-Taco:latest" 12 | compileOnly project(":API") 13 | compileOnly rootProject 14 | } 15 | 16 | if (project.hasProperty('hook.compile_silkspawners_candc2') && 17 | !Boolean.valueOf(project.findProperty("hook.compile_silkspawners_candc2").toString())) { 18 | project.tasks.all { task -> task.enabled = false } 19 | } -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/hooks/StackedItemProvider.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import org.bukkit.Location; 4 | import org.bukkit.entity.Item; 5 | import org.bukkit.inventory.ItemStack; 6 | 7 | public interface StackedItemProvider { 8 | 9 | ItemStack getItemStack(Item item); 10 | 11 | void setItemStack(Item item, ItemStack itemStack); 12 | 13 | void dropItem(Location location, ItemStack itemStack, int count); 14 | 15 | default void dropItem(Location location, ItemStack itemStack) { 16 | dropItem(location, itemStack, itemStack.getAmount()); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/utils/math/NumberUtils.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.utils.math; 2 | 3 | import java.text.DecimalFormat; 4 | 5 | public class NumberUtils { 6 | 7 | private static final DecimalFormat numberFormatter = new DecimalFormat("###,###,###,###,###,###,###,###,###,##0.00"); 8 | 9 | public static String format(double d) { 10 | String s = numberFormatter.format(d); 11 | return s.endsWith(".00") ? s.replace(".00", "") : s; 12 | } 13 | 14 | public static boolean range(int num, int min, int max) { 15 | return num >= min && num <= max; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/hooks/ExtendedContainerProvider.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import com.bgsoftware.wildtools.api.hooks.ContainerProvider; 4 | import org.bukkit.block.BlockState; 5 | import org.bukkit.inventory.Inventory; 6 | import org.bukkit.inventory.ItemStack; 7 | 8 | import java.util.List; 9 | 10 | public interface ExtendedContainerProvider extends ContainerProvider { 11 | 12 | List getAllInventories(BlockState blockState, Inventory chestInventory); 13 | 14 | void addItems(BlockState blockState, Inventory chestInventory, List itemStackList); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/scheduler/ISchedulerImplementation.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.scheduler; 2 | 3 | import org.bukkit.Location; 4 | import org.bukkit.World; 5 | import org.bukkit.entity.Entity; 6 | 7 | public interface ISchedulerImplementation { 8 | 9 | boolean isRegionScheduler(); 10 | 11 | ScheduledTask scheduleTask(World world, int chunkX, int chunkZ, Runnable task, long delay); 12 | 13 | ScheduledTask scheduleTask(Entity entity, Runnable task, long delay); 14 | 15 | ScheduledTask scheduleTask(Runnable task, long delay); 16 | 17 | ScheduledTask scheduleAsyncTask(Runnable task, long delay); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/command/ICommand.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.command; 2 | 3 | import org.bukkit.command.CommandSender; 4 | import com.bgsoftware.wildtools.WildToolsPlugin; 5 | 6 | import java.util.List; 7 | 8 | public interface ICommand { 9 | 10 | String getLabel(); 11 | 12 | String getUsage(); 13 | 14 | String getPermission(); 15 | 16 | String getDescription(); 17 | 18 | int getMinArgs(); 19 | 20 | int getMaxArgs(); 21 | 22 | void run(WildToolsPlugin plugin, CommandSender sender, String[] args); 23 | 24 | List tabComplete(WildToolsPlugin plugin, CommandSender sender, String[] args); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /NMS/v1_21_10/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("io.papermc.paperweight.userdev") version "2.0.0-beta.17" 3 | } 4 | 5 | java { 6 | toolchain { 7 | languageVersion.set(JavaLanguageVersion.of(21)) 8 | } 9 | } 10 | 11 | group 'NMS:v1_21_10' 12 | 13 | dependencies { 14 | paperweight.paperDevBundle("1.21.11-R0.1-SNAPSHOT") 15 | compileOnly project(":NMS:Spigot-1_20_3") 16 | compileOnly project(":NMS:Paper-1_20_3") 17 | compileOnly project(":API") 18 | compileOnly rootProject 19 | } 20 | 21 | if (project.hasProperty('nms.compile_v1_21') && !Boolean.valueOf(project.findProperty("nms.compile_v1_21").toString())) { 22 | project.tasks.all { task -> task.enabled = false } 23 | } -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/hooks/FactionsProvider_Default.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import com.bgsoftware.wildtools.WildToolsPlugin; 4 | import org.bukkit.entity.Player; 5 | 6 | public class FactionsProvider_Default implements FactionsProvider { 7 | 8 | public FactionsProvider_Default(){ 9 | WildToolsPlugin.log(" - Couldn't find any factions providers for tnt banks, using default one."); 10 | } 11 | 12 | @Override 13 | public int getTNTAmountFromBank(Player player) { 14 | return 0; 15 | } 16 | 17 | @Override 18 | public void takeTNTFromBank(Player player, int amount) { 19 | //Nothing to do :> 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Hooks/Villagers/src/main/java/com/bgsoftware/wildtools/hooks/ClaimsProvider_Villages.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import com.bgsoftware.wildtools.api.hooks.ClaimsProvider; 4 | import com.stefthedev.villages.Villages; 5 | import com.stefthedev.villages.villages.Village; 6 | import org.bukkit.Location; 7 | import org.bukkit.entity.Player; 8 | 9 | public class ClaimsProvider_Villages implements ClaimsProvider { 10 | 11 | @Override 12 | public boolean isPlayerClaim(Player player, Location location) { 13 | Village playerVillage = Villages.getInstance().getVillageManager().village(player); 14 | Village locationVillage = Villages.getInstance().getVillageManager().village(location.getChunk()); 15 | return playerVillage != null && playerVillage == locationVillage; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /Hooks/Residence/src/main/java/com/bgsoftware/wildtools/hooks/ClaimsProvider_Residence.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import com.bekvon.bukkit.residence.api.ResidenceApi; 4 | import com.bekvon.bukkit.residence.containers.Flags; 5 | import com.bekvon.bukkit.residence.protection.ClaimedResidence; 6 | import com.bgsoftware.wildtools.api.hooks.ClaimsProvider; 7 | import org.bukkit.Location; 8 | import org.bukkit.entity.Player; 9 | 10 | public class ClaimsProvider_Residence implements ClaimsProvider { 11 | 12 | @Override 13 | public boolean isPlayerClaim(Player player, Location location) { 14 | ClaimedResidence residence = ResidenceApi.getResidenceManager().getByLoc(location); 15 | return residence != null && residence.getPermissions().playerHas(player, Flags.destroy, false); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /NMS/v1_21/src/main/java/com/bgsoftware/wildtools/nms/v1_21/NMSAdapterImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_21; 2 | 3 | import net.minecraft.network.protocol.Packet; 4 | import net.minecraft.network.protocol.game.ClientGamePacketListener; 5 | import net.minecraft.server.level.ServerChunkCache; 6 | import net.minecraft.world.entity.Entity; 7 | import org.bukkit.inventory.meta.ItemMeta; 8 | 9 | public class NMSAdapterImpl extends com.bgsoftware.wildtools.nms.v1_21.AbstractNMSAdapter { 10 | 11 | @Override 12 | protected void sendPacket(ServerChunkCache serverChunkCache, Entity entity, Packet packet) { 13 | serverChunkCache.broadcast(entity, packet); 14 | } 15 | 16 | @Override 17 | public void makeItemGlow(ItemMeta itemMeta) { 18 | itemMeta.setEnchantmentGlintOverride(true); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /NMS/v1_20_4/src/main/java/com/bgsoftware/wildtools/nms/v1_20_4/NMSAdapterImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_20_4; 2 | 3 | import net.minecraft.network.protocol.Packet; 4 | import net.minecraft.network.protocol.game.ClientGamePacketListener; 5 | import net.minecraft.server.level.ServerChunkCache; 6 | import net.minecraft.world.entity.Entity; 7 | import org.bukkit.inventory.meta.ItemMeta; 8 | 9 | public class NMSAdapterImpl extends com.bgsoftware.wildtools.nms.v1_20_4.AbstractNMSAdapter { 10 | 11 | @Override 12 | protected void sendPacket(ServerChunkCache serverChunkCache, Entity entity, Packet packet) { 13 | serverChunkCache.broadcast(entity, packet); 14 | } 15 | 16 | @Override 17 | public void makeItemGlow(ItemMeta itemMeta) { 18 | itemMeta.setEnchantmentGlintOverride(true); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /NMS/v1_21_3/src/main/java/com/bgsoftware/wildtools/nms/v1_21_3/NMSAdapterImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_21_3; 2 | 3 | import net.minecraft.network.protocol.Packet; 4 | import net.minecraft.network.protocol.game.ClientGamePacketListener; 5 | import net.minecraft.server.level.ServerChunkCache; 6 | import net.minecraft.world.entity.Entity; 7 | import org.bukkit.inventory.meta.ItemMeta; 8 | 9 | public class NMSAdapterImpl extends com.bgsoftware.wildtools.nms.v1_21_3.AbstractNMSAdapter { 10 | 11 | @Override 12 | protected void sendPacket(ServerChunkCache serverChunkCache, Entity entity, Packet packet) { 13 | serverChunkCache.broadcast(entity, packet); 14 | } 15 | 16 | @Override 17 | public void makeItemGlow(ItemMeta itemMeta) { 18 | itemMeta.setEnchantmentGlintOverride(true); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /NMS/v1_21_4/src/main/java/com/bgsoftware/wildtools/nms/v1_21_4/NMSAdapterImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_21_4; 2 | 3 | import net.minecraft.network.protocol.Packet; 4 | import net.minecraft.network.protocol.game.ClientGamePacketListener; 5 | import net.minecraft.server.level.ServerChunkCache; 6 | import net.minecraft.world.entity.Entity; 7 | import org.bukkit.inventory.meta.ItemMeta; 8 | 9 | public class NMSAdapterImpl extends com.bgsoftware.wildtools.nms.v1_21_4.AbstractNMSAdapter { 10 | 11 | @Override 12 | protected void sendPacket(ServerChunkCache serverChunkCache, Entity entity, Packet packet) { 13 | serverChunkCache.broadcast(entity, packet); 14 | } 15 | 16 | @Override 17 | public void makeItemGlow(ItemMeta itemMeta) { 18 | itemMeta.setEnchantmentGlintOverride(true); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /NMS/v1_21_5/src/main/java/com/bgsoftware/wildtools/nms/v1_21_5/NMSAdapterImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_21_5; 2 | 3 | import net.minecraft.network.protocol.Packet; 4 | import net.minecraft.network.protocol.game.ClientGamePacketListener; 5 | import net.minecraft.server.level.ServerChunkCache; 6 | import net.minecraft.world.entity.Entity; 7 | import org.bukkit.inventory.meta.ItemMeta; 8 | 9 | public class NMSAdapterImpl extends com.bgsoftware.wildtools.nms.v1_21_5.AbstractNMSAdapter { 10 | 11 | @Override 12 | protected void sendPacket(ServerChunkCache serverChunkCache, Entity entity, Packet packet) { 13 | serverChunkCache.broadcast(entity, packet); 14 | } 15 | 16 | @Override 17 | public void makeItemGlow(ItemMeta itemMeta) { 18 | itemMeta.setEnchantmentGlintOverride(true); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /NMS/v1_21_7/src/main/java/com/bgsoftware/wildtools/nms/v1_21_7/NMSAdapterImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_21_7; 2 | 3 | import net.minecraft.network.protocol.Packet; 4 | import net.minecraft.network.protocol.game.ClientGamePacketListener; 5 | import net.minecraft.server.level.ServerChunkCache; 6 | import net.minecraft.world.entity.Entity; 7 | import org.bukkit.inventory.meta.ItemMeta; 8 | 9 | public class NMSAdapterImpl extends com.bgsoftware.wildtools.nms.v1_21_7.AbstractNMSAdapter { 10 | 11 | @Override 12 | protected void sendPacket(ServerChunkCache serverChunkCache, Entity entity, Packet packet) { 13 | serverChunkCache.broadcast(entity, packet); 14 | } 15 | 16 | @Override 17 | public void makeItemGlow(ItemMeta itemMeta) { 18 | itemMeta.setEnchantmentGlintOverride(true); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/events/ToolUseEvent.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.events; 2 | 3 | import com.bgsoftware.wildtools.api.objects.tools.Tool; 4 | import org.bukkit.entity.Player; 5 | import org.bukkit.event.player.PlayerEvent; 6 | 7 | /** 8 | * ToolUseEvent is called when a wand is used. 9 | */ 10 | public abstract class ToolUseEvent extends PlayerEvent { 11 | 12 | protected final T tool; 13 | 14 | /** 15 | * The constructor of the event. 16 | * @param player The player who used the wand. 17 | * @param tool The wand that was used. 18 | */ 19 | public ToolUseEvent(Player player, T tool) { 20 | super(player); 21 | this.tool = tool; 22 | } 23 | 24 | /** 25 | * Get the tool that was used. 26 | */ 27 | public T getTool() { 28 | return this.tool; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /NMS/v1_21_10/src/main/java/com/bgsoftware/wildtools/nms/v1_21_10/NMSAdapterImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_21_10; 2 | 3 | import net.minecraft.network.protocol.Packet; 4 | import net.minecraft.network.protocol.game.ClientGamePacketListener; 5 | import net.minecraft.server.level.ServerChunkCache; 6 | import net.minecraft.world.entity.Entity; 7 | import org.bukkit.inventory.meta.ItemMeta; 8 | 9 | public class NMSAdapterImpl extends com.bgsoftware.wildtools.nms.v1_21_10.AbstractNMSAdapter { 10 | 11 | @Override 12 | protected void sendPacket(ServerChunkCache serverChunkCache, Entity entity, Packet packet) { 13 | serverChunkCache.sendToTrackingPlayers(entity, packet); 14 | } 15 | 16 | @Override 17 | public void makeItemGlow(ItemMeta itemMeta) { 18 | itemMeta.setEnchantmentGlintOverride(true); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /NMS/v1_21_9/src/main/java/com/bgsoftware/wildtools/nms/v1_21_9/NMSAdapterImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_21_9; 2 | 3 | import net.minecraft.network.protocol.Packet; 4 | import net.minecraft.network.protocol.game.ClientGamePacketListener; 5 | import net.minecraft.server.level.ServerChunkCache; 6 | import net.minecraft.world.entity.Entity; 7 | import org.bukkit.inventory.meta.ItemMeta; 8 | 9 | public class NMSAdapterImpl extends com.bgsoftware.wildtools.nms.v1_21_9.AbstractNMSAdapter { 10 | 11 | @Override 12 | protected void sendPacket(ServerChunkCache serverChunkCache, Entity entity, Packet packet) { 13 | serverChunkCache.sendToTrackingPlayers(entity, packet); 14 | } 15 | 16 | @Override 17 | public void makeItemGlow(ItemMeta itemMeta) { 18 | itemMeta.setEnchantmentGlintOverride(true); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /NMS/v1_7_R4/src/main/java/com/bgsoftware/wildtools/nms/v1_7_R4/world/FakeCraftBlock.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_7_R4.world; 2 | 3 | import org.bukkit.Material; 4 | import org.bukkit.block.Block; 5 | import org.bukkit.craftbukkit.v1_7_R4.CraftChunk; 6 | import org.bukkit.craftbukkit.v1_7_R4.block.CraftBlock; 7 | 8 | public class FakeCraftBlock extends CraftBlock { 9 | 10 | private Material blockType; 11 | 12 | public FakeCraftBlock(Block block, Material material) { 13 | super((CraftChunk) block.getChunk(), block.getX(), block.getY(), block.getZ()); 14 | this.blockType = material; 15 | } 16 | 17 | @Override 18 | public Material getType() { 19 | return blockType; 20 | } 21 | 22 | @Override 23 | public void setType(Material type) { 24 | this.blockType = type; 25 | super.setType(type); 26 | } 27 | 28 | } 29 | 30 | -------------------------------------------------------------------------------- /NMS/v1_8_R3/src/main/java/com/bgsoftware/wildtools/nms/v1_8_R3/world/FakeCraftBlock.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_8_R3.world; 2 | 3 | import org.bukkit.Material; 4 | import org.bukkit.block.Block; 5 | import org.bukkit.craftbukkit.v1_8_R3.CraftChunk; 6 | import org.bukkit.craftbukkit.v1_8_R3.block.CraftBlock; 7 | 8 | public class FakeCraftBlock extends CraftBlock { 9 | 10 | private Material blockType; 11 | 12 | public FakeCraftBlock(Block block, Material material) { 13 | super((CraftChunk) block.getChunk(), block.getX(), block.getY(), block.getZ()); 14 | this.blockType = material; 15 | } 16 | 17 | @Override 18 | public Material getType() { 19 | return blockType; 20 | } 21 | 22 | @Override 23 | public void setType(Material type) { 24 | this.blockType = type; 25 | super.setType(type); 26 | } 27 | 28 | } 29 | 30 | -------------------------------------------------------------------------------- /NMS/v1_12_R1/src/main/java/com/bgsoftware/wildtools/nms/v1_12_R1/world/FakeCraftBlock.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_12_R1.world; 2 | 3 | import org.bukkit.Material; 4 | import org.bukkit.block.Block; 5 | import org.bukkit.craftbukkit.v1_12_R1.CraftChunk; 6 | import org.bukkit.craftbukkit.v1_12_R1.block.CraftBlock; 7 | 8 | public class FakeCraftBlock extends CraftBlock { 9 | 10 | private Material blockType; 11 | 12 | public FakeCraftBlock(Block block, Material material) { 13 | super((CraftChunk) block.getChunk(), block.getX(), block.getY(), block.getZ()); 14 | this.blockType = material; 15 | } 16 | 17 | @Override 18 | public Material getType() { 19 | return blockType; 20 | } 21 | 22 | @Override 23 | public void setType(Material type) { 24 | this.blockType = type; 25 | super.setType(type); 26 | } 27 | 28 | } 29 | 30 | -------------------------------------------------------------------------------- /NMS/v1_7_R4/src/main/java/com/bgsoftware/wildtools/nms/v1_7_R4/NMSUtils.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_7_R4; 2 | 3 | import net.minecraft.server.v1_7_R4.EntityPlayer; 4 | import net.minecraft.server.v1_7_R4.Packet; 5 | import net.minecraft.server.v1_7_R4.PlayerChunkMap; 6 | import net.minecraft.server.v1_7_R4.WorldServer; 7 | 8 | public class NMSUtils { 9 | 10 | private NMSUtils() { 11 | 12 | } 13 | 14 | public static void sendPacketToRelevantPlayers(WorldServer worldServer, int chunkX, int chunkZ, Packet packet) { 15 | PlayerChunkMap playerChunkMap = worldServer.getPlayerChunkMap(); 16 | for (Object entityHuman : worldServer.players) { 17 | if (entityHuman instanceof EntityPlayer && playerChunkMap.a((EntityPlayer) entityHuman, chunkX, chunkZ)) 18 | ((EntityPlayer) entityHuman).playerConnection.sendPacket(packet); 19 | } 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /Hooks/WildStacker/src/main/java/com/bgsoftware/wildtools/hooks/StackedItemProvider_WildStacker.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import com.bgsoftware.wildstacker.api.WildStackerAPI; 4 | import org.bukkit.Location; 5 | import org.bukkit.entity.Item; 6 | import org.bukkit.inventory.ItemStack; 7 | 8 | public class StackedItemProvider_WildStacker implements StackedItemProvider { 9 | 10 | @Override 11 | public ItemStack getItemStack(Item item) { 12 | return WildStackerAPI.getStackedItem(item).getItemStack(); 13 | } 14 | 15 | @Override 16 | public void setItemStack(Item item, ItemStack itemStack) { 17 | WildStackerAPI.getStackedItem(item).setStackAmount(itemStack.getAmount(), true); 18 | } 19 | 20 | @Override 21 | public void dropItem(Location location, ItemStack itemStack, int count) { 22 | WildStackerAPI.getWildStacker().getSystemManager().spawnItemWithAmount(location, itemStack, count); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /NMS/v1_8_R3/src/main/java/com/bgsoftware/wildtools/nms/v1_8_R3/NMSUtils.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_8_R3; 2 | 3 | import net.minecraft.server.v1_8_R3.EntityHuman; 4 | import net.minecraft.server.v1_8_R3.EntityPlayer; 5 | import net.minecraft.server.v1_8_R3.Packet; 6 | import net.minecraft.server.v1_8_R3.PlayerChunkMap; 7 | import net.minecraft.server.v1_8_R3.WorldServer; 8 | 9 | public class NMSUtils { 10 | 11 | private NMSUtils() { 12 | 13 | } 14 | 15 | public static void sendPacketToRelevantPlayers(WorldServer worldServer, int chunkX, int chunkZ, Packet packet) { 16 | PlayerChunkMap playerChunkMap = worldServer.getPlayerChunkMap(); 17 | for (EntityHuman entityHuman : worldServer.players) { 18 | if (entityHuman instanceof EntityPlayer && playerChunkMap.a((EntityPlayer) entityHuman, chunkX, chunkZ)) 19 | ((EntityPlayer) entityHuman).playerConnection.sendPacket(packet); 20 | } 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/recipes/RecipeChoice.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.recipes; 2 | 3 | import org.bukkit.Material; 4 | import org.bukkit.inventory.Inventory; 5 | import org.bukkit.inventory.ItemStack; 6 | 7 | import java.util.Arrays; 8 | import java.util.List; 9 | import java.util.Map; 10 | import java.util.Objects; 11 | import java.util.function.Predicate; 12 | import java.util.stream.Collectors; 13 | 14 | public interface RecipeChoice extends Predicate { 15 | 16 | @Override 17 | boolean test(ItemStack itemStack); 18 | 19 | boolean test(Predicate predicate); 20 | 21 | void setAmount(int amount); 22 | 23 | int getAmount(); 24 | 25 | void remove(Inventory inventory); 26 | 27 | RecipeChoice copy(); 28 | 29 | static RecipeChoice of(ItemStack... itemStacks){ 30 | return itemStacks.length == 1 ? new ExactChoice(itemStacks[0]) : new MaterialChoice(Arrays.asList(itemStacks)); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /NMS/v1_12_R1/src/main/java/com/bgsoftware/wildtools/nms/v1_12_R1/NMSUtils.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_12_R1; 2 | 3 | import net.minecraft.server.v1_12_R1.EntityHuman; 4 | import net.minecraft.server.v1_12_R1.EntityPlayer; 5 | import net.minecraft.server.v1_12_R1.Packet; 6 | import net.minecraft.server.v1_12_R1.PlayerChunkMap; 7 | import net.minecraft.server.v1_12_R1.WorldServer; 8 | 9 | public class NMSUtils { 10 | 11 | private NMSUtils() { 12 | 13 | } 14 | 15 | public static void sendPacketToRelevantPlayers(WorldServer worldServer, int chunkX, int chunkZ, Packet packet) { 16 | PlayerChunkMap playerChunkMap = worldServer.getPlayerChunkMap(); 17 | for (EntityHuman entityHuman : worldServer.players) { 18 | if (entityHuman instanceof EntityPlayer && playerChunkMap.a((EntityPlayer) entityHuman, chunkX, chunkZ)) 19 | ((EntityPlayer) entityHuman).playerConnection.sendPacket(packet); 20 | } 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /API/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'maven-publish' 3 | } 4 | 5 | java { 6 | withSourcesJar() 7 | } 8 | 9 | group 'API' 10 | 11 | dependencies { 12 | compileOnly "org.spigotmc:v1_7_R3:latest" 13 | } 14 | 15 | publishing { 16 | publications { 17 | maven(MavenPublication) { 18 | groupId = 'com.bgsoftware' 19 | artifactId = 'WildToolsAPI' 20 | version = parent.version 21 | 22 | from components.java 23 | } 24 | } 25 | 26 | repositories { 27 | String mavenUsername = System.getenv('mavenUsername'); 28 | String mavenPassword = System.getenv('mavenPassword'); 29 | 30 | if (mavenUsername != null && mavenPassword != null) { 31 | maven { 32 | url 'https://repo.bg-software.com/repository/api/' 33 | credentials { 34 | username mavenUsername 35 | password mavenPassword 36 | } 37 | } 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /NMS/v1_16_R3/src/main/java/com/bgsoftware/wildtools/nms/v1_16_R3/NMSUtils.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_16_R3; 2 | 3 | import com.bgsoftware.common.reflection.ReflectField; 4 | import net.minecraft.server.v1_16_R3.Packet; 5 | import net.minecraft.server.v1_16_R3.PlayerChunkMap; 6 | import net.minecraft.server.v1_16_R3.PlayerMap; 7 | import net.minecraft.server.v1_16_R3.WorldServer; 8 | 9 | public class NMSUtils { 10 | 11 | private static final ReflectField PLAYER_MAP_FIELD = new ReflectField<>(PlayerChunkMap.class, PlayerMap.class, "playerMap"); 12 | 13 | private NMSUtils() { 14 | 15 | } 16 | 17 | public static void sendPacketToRelevantPlayers(WorldServer worldServer, int chunkX, int chunkZ, Packet packet) { 18 | PlayerChunkMap playerChunkMap = worldServer.getChunkProvider().playerChunkMap; 19 | PLAYER_MAP_FIELD.get(playerChunkMap).a(1) 20 | .forEach(entityPlayer -> entityPlayer.playerConnection.sendPacket(packet)); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /Hooks/GriefPrevention/src/main/java/com/bgsoftware/wildtools/hooks/ClaimsProvider_GriefPrevention.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import com.bgsoftware.wildtools.api.hooks.ClaimsProvider; 4 | import me.ryanhamshire.GriefPrevention.Claim; 5 | import me.ryanhamshire.GriefPrevention.DataStore; 6 | import me.ryanhamshire.GriefPrevention.GriefPrevention; 7 | import me.ryanhamshire.GriefPrevention.PlayerData; 8 | import org.bukkit.Location; 9 | import org.bukkit.entity.Player; 10 | 11 | public class ClaimsProvider_GriefPrevention implements ClaimsProvider { 12 | 13 | @Override 14 | public boolean isPlayerClaim(Player player, Location location) { 15 | DataStore dataStore = GriefPrevention.instance.dataStore; 16 | PlayerData playerData = dataStore.getPlayerData(player.getUniqueId()); 17 | Claim claim = dataStore.getClaimAt(location, false, playerData.lastClaim); 18 | return claim != null && claim.allowBreak(player, location.getBlock().getType()) == null; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/hooks/SoldItem.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.hooks; 2 | 3 | import org.bukkit.inventory.ItemStack; 4 | 5 | public class SoldItem { 6 | 7 | private final ItemStack item; 8 | private final double price; 9 | 10 | /** 11 | * Constructor for a sold item. 12 | * 13 | * @param itemStack The item that was sold. 14 | * @param price The price of the item. 15 | */ 16 | public SoldItem(ItemStack itemStack, double price) { 17 | this.item = itemStack; 18 | this.price = price; 19 | } 20 | 21 | /** 22 | * Get the item that was sold. 23 | */ 24 | public ItemStack getItem() { 25 | return item; 26 | } 27 | 28 | /** 29 | * Get the price of this item. 30 | */ 31 | public double getPrice() { 32 | return price; 33 | } 34 | 35 | /** 36 | * Check if this item is sellable. 37 | */ 38 | public boolean isSellable() { 39 | return this.price > 0; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /NMS/v1_17/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("io.papermc.paperweight.userdev") version "2.0.0-beta.17" 3 | } 4 | 5 | java { 6 | toolchain { 7 | languageVersion.set(JavaLanguageVersion.of(17)) 8 | } 9 | } 10 | 11 | group 'NMS:v1_17' 12 | 13 | dependencies { 14 | paperweight.paperDevBundle("1.17.1-R0.1-SNAPSHOT") 15 | compileOnly project(":NMS:Spigot") 16 | compileOnly project(":NMS:Paper") 17 | compileOnly project(":API") 18 | compileOnly rootProject 19 | } 20 | 21 | shadowJar { 22 | archiveFileName = "${project.name}-exclude.jar" 23 | } 24 | 25 | assemble { 26 | dependsOn(reobfJar) 27 | } 28 | 29 | tasks { 30 | reobfJar { 31 | File outputFile = new File(rootProject.archiveFolder, "reobf/${project.name}.jar") 32 | outputJar.set(layout.buildDirectory.file(outputFile.getPath())) 33 | } 34 | } 35 | 36 | if (project.hasProperty('nms.compile_v1_17') && !Boolean.valueOf(project.findProperty("nms.compile_v1_17").toString())) { 37 | project.tasks.all { task -> task.enabled = false } 38 | } -------------------------------------------------------------------------------- /NMS/v1_18/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("io.papermc.paperweight.userdev") version "2.0.0-beta.17" 3 | } 4 | 5 | java { 6 | toolchain { 7 | languageVersion.set(JavaLanguageVersion.of(17)) 8 | } 9 | } 10 | 11 | group 'NMS:v1_18' 12 | 13 | dependencies { 14 | paperweight.paperDevBundle("1.18.2-R0.1-SNAPSHOT") 15 | compileOnly project(":NMS:Spigot") 16 | compileOnly project(":NMS:Paper") 17 | compileOnly project(":API") 18 | compileOnly rootProject 19 | } 20 | 21 | shadowJar { 22 | archiveFileName = "${project.name}-exclude.jar" 23 | } 24 | 25 | assemble { 26 | dependsOn(reobfJar) 27 | } 28 | 29 | tasks { 30 | reobfJar { 31 | File outputFile = new File(rootProject.archiveFolder, "reobf/${project.name}.jar") 32 | outputJar.set(layout.buildDirectory.file(outputFile.getPath())) 33 | } 34 | } 35 | 36 | if (project.hasProperty('nms.compile_v1_18') && !Boolean.valueOf(project.findProperty("nms.compile_v1_18").toString())) { 37 | project.tasks.all { task -> task.enabled = false } 38 | } -------------------------------------------------------------------------------- /NMS/v1_19/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("io.papermc.paperweight.userdev") version "2.0.0-beta.17" 3 | } 4 | 5 | java { 6 | toolchain { 7 | languageVersion.set(JavaLanguageVersion.of(17)) 8 | } 9 | } 10 | 11 | group 'NMS:v1_19' 12 | 13 | dependencies { 14 | paperweight.paperDevBundle("1.19.4-R0.1-SNAPSHOT") 15 | compileOnly project(":NMS:Spigot") 16 | compileOnly project(":NMS:Paper") 17 | compileOnly project(":API") 18 | compileOnly rootProject 19 | } 20 | 21 | shadowJar { 22 | archiveFileName = "${project.name}-exclude.jar" 23 | } 24 | 25 | assemble { 26 | dependsOn(reobfJar) 27 | } 28 | 29 | tasks { 30 | reobfJar { 31 | File outputFile = new File(rootProject.archiveFolder, "reobf/${project.name}.jar") 32 | outputJar.set(layout.buildDirectory.file(outputFile.getPath())) 33 | } 34 | } 35 | 36 | if (project.hasProperty('nms.compile_v1_19') && !Boolean.valueOf(project.findProperty("nms.compile_v1_19").toString())) { 37 | project.tasks.all { task -> task.enabled = false } 38 | } -------------------------------------------------------------------------------- /NMS/v1_21/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("io.papermc.paperweight.userdev") version "2.0.0-beta.17" 3 | } 4 | 5 | java { 6 | toolchain { 7 | languageVersion.set(JavaLanguageVersion.of(21)) 8 | } 9 | } 10 | 11 | group 'NMS:v1_21' 12 | 13 | dependencies { 14 | paperweight.paperDevBundle("1.21.1-R0.1-SNAPSHOT") 15 | compileOnly project(":NMS:Spigot-1_20_3") 16 | compileOnly project(":NMS:Paper-1_20_3") 17 | compileOnly project(":API") 18 | compileOnly rootProject 19 | } 20 | 21 | shadowJar { 22 | archiveFileName = "${project.name}-exclude.jar" 23 | } 24 | 25 | assemble { 26 | dependsOn(reobfJar) 27 | } 28 | 29 | tasks { 30 | reobfJar { 31 | File outputFile = new File(rootProject.archiveFolder, "reobf/${project.name}.jar") 32 | outputJar.set(layout.buildDirectory.file(outputFile.getPath())) 33 | } 34 | } 35 | 36 | if (project.hasProperty('nms.compile_v1_21') && !Boolean.valueOf(project.findProperty("nms.compile_v1_21").toString())) { 37 | project.tasks.all { task -> task.enabled = false } 38 | } -------------------------------------------------------------------------------- /NMS/v1_20_3/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("io.papermc.paperweight.userdev") version "2.0.0-beta.17" 3 | } 4 | 5 | java { 6 | toolchain { 7 | languageVersion.set(JavaLanguageVersion.of(17)) 8 | } 9 | } 10 | 11 | group 'NMS:v1_20_3' 12 | 13 | dependencies { 14 | paperweight.paperDevBundle("1.20.4-R0.1-SNAPSHOT") 15 | compileOnly project(":NMS:Spigot-1_20_3") 16 | compileOnly project(":NMS:Paper-1_20_3") 17 | compileOnly project(":API") 18 | compileOnly rootProject 19 | } 20 | 21 | shadowJar { 22 | archiveFileName = "${project.name}-exclude.jar" 23 | } 24 | 25 | assemble { 26 | dependsOn(reobfJar) 27 | } 28 | 29 | tasks { 30 | reobfJar { 31 | File outputFile = new File(rootProject.archiveFolder, "reobf/${project.name}.jar") 32 | outputJar.set(layout.buildDirectory.file(outputFile.getPath())) 33 | } 34 | } 35 | 36 | if (project.hasProperty('nms.compile_v1_20') && !Boolean.valueOf(project.findProperty("nms.compile_v1_20").toString())) { 37 | project.tasks.all { task -> task.enabled = false } 38 | } -------------------------------------------------------------------------------- /NMS/v1_20_4/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("io.papermc.paperweight.userdev") version "2.0.0-beta.17" 3 | } 4 | 5 | java { 6 | toolchain { 7 | languageVersion.set(JavaLanguageVersion.of(21)) 8 | } 9 | } 10 | 11 | group 'NMS:v1_20_4' 12 | 13 | dependencies { 14 | paperweight.paperDevBundle("1.20.6-R0.1-SNAPSHOT") 15 | compileOnly project(":NMS:Spigot-1_20_3") 16 | compileOnly project(":NMS:Paper-1_20_3") 17 | compileOnly project(":API") 18 | compileOnly rootProject 19 | } 20 | 21 | shadowJar { 22 | archiveFileName = "${project.name}-exclude.jar" 23 | } 24 | 25 | assemble { 26 | dependsOn(reobfJar) 27 | } 28 | 29 | tasks { 30 | reobfJar { 31 | File outputFile = new File(rootProject.archiveFolder, "reobf/${project.name}.jar") 32 | outputJar.set(layout.buildDirectory.file(outputFile.getPath())) 33 | } 34 | } 35 | 36 | if (project.hasProperty('nms.compile_v1_20') && !Boolean.valueOf(project.findProperty("nms.compile_v1_20").toString())) { 37 | project.tasks.all { task -> task.enabled = false } 38 | } -------------------------------------------------------------------------------- /NMS/v1_21_3/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("io.papermc.paperweight.userdev") version "2.0.0-beta.17" 3 | } 4 | 5 | java { 6 | toolchain { 7 | languageVersion.set(JavaLanguageVersion.of(21)) 8 | } 9 | } 10 | 11 | group 'NMS:v1_21_3' 12 | 13 | dependencies { 14 | paperweight.paperDevBundle("1.21.3-R0.1-SNAPSHOT") 15 | compileOnly project(":NMS:Spigot-1_20_3") 16 | compileOnly project(":NMS:Paper-1_20_3") 17 | compileOnly project(":API") 18 | compileOnly rootProject 19 | } 20 | 21 | shadowJar { 22 | archiveFileName = "${project.name}-exclude.jar" 23 | } 24 | 25 | assemble { 26 | dependsOn(reobfJar) 27 | } 28 | 29 | tasks { 30 | reobfJar { 31 | File outputFile = new File(rootProject.archiveFolder, "reobf/${project.name}.jar") 32 | outputJar.set(layout.buildDirectory.file(outputFile.getPath())) 33 | } 34 | } 35 | 36 | if (project.hasProperty('nms.compile_v1_21') && !Boolean.valueOf(project.findProperty("nms.compile_v1_21").toString())) { 37 | project.tasks.all { task -> task.enabled = false } 38 | } -------------------------------------------------------------------------------- /NMS/v1_21_4/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("io.papermc.paperweight.userdev") version "2.0.0-beta.17" 3 | } 4 | 5 | java { 6 | toolchain { 7 | languageVersion.set(JavaLanguageVersion.of(21)) 8 | } 9 | } 10 | 11 | group 'NMS:v1_21_4' 12 | 13 | dependencies { 14 | paperweight.paperDevBundle("1.21.4-R0.1-SNAPSHOT") 15 | compileOnly project(":NMS:Spigot-1_20_3") 16 | compileOnly project(":NMS:Paper-1_20_3") 17 | compileOnly project(":API") 18 | compileOnly rootProject 19 | } 20 | 21 | shadowJar { 22 | archiveFileName = "${project.name}-exclude.jar" 23 | } 24 | 25 | assemble { 26 | dependsOn(reobfJar) 27 | } 28 | 29 | tasks { 30 | reobfJar { 31 | File outputFile = new File(rootProject.archiveFolder, "reobf/${project.name}.jar") 32 | outputJar.set(layout.buildDirectory.file(outputFile.getPath())) 33 | } 34 | } 35 | 36 | if (project.hasProperty('nms.compile_v1_21') && !Boolean.valueOf(project.findProperty("nms.compile_v1_21").toString())) { 37 | project.tasks.all { task -> task.enabled = false } 38 | } -------------------------------------------------------------------------------- /NMS/v1_21_5/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("io.papermc.paperweight.userdev") version "2.0.0-beta.17" 3 | } 4 | 5 | java { 6 | toolchain { 7 | languageVersion.set(JavaLanguageVersion.of(21)) 8 | } 9 | } 10 | 11 | group 'NMS:v1_21_5' 12 | 13 | dependencies { 14 | paperweight.paperDevBundle("1.21.5-R0.1-SNAPSHOT") 15 | compileOnly project(":NMS:Spigot-1_20_3") 16 | compileOnly project(":NMS:Paper-1_20_3") 17 | compileOnly project(":API") 18 | compileOnly rootProject 19 | } 20 | 21 | shadowJar { 22 | archiveFileName = "${project.name}-exclude.jar" 23 | } 24 | 25 | assemble { 26 | dependsOn(reobfJar) 27 | } 28 | 29 | tasks { 30 | reobfJar { 31 | File outputFile = new File(rootProject.archiveFolder, "reobf/${project.name}.jar") 32 | outputJar.set(layout.buildDirectory.file(outputFile.getPath())) 33 | } 34 | } 35 | 36 | if (project.hasProperty('nms.compile_v1_21') && !Boolean.valueOf(project.findProperty("nms.compile_v1_21").toString())) { 37 | project.tasks.all { task -> task.enabled = false } 38 | } -------------------------------------------------------------------------------- /NMS/v1_21_7/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("io.papermc.paperweight.userdev") version "2.0.0-beta.17" 3 | } 4 | 5 | java { 6 | toolchain { 7 | languageVersion.set(JavaLanguageVersion.of(21)) 8 | } 9 | } 10 | 11 | group 'NMS:v1_21_7' 12 | 13 | dependencies { 14 | paperweight.paperDevBundle("1.21.7-R0.1-SNAPSHOT") 15 | compileOnly project(":NMS:Spigot-1_20_3") 16 | compileOnly project(":NMS:Paper-1_20_3") 17 | compileOnly project(":API") 18 | compileOnly rootProject 19 | } 20 | 21 | shadowJar { 22 | archiveFileName = "${project.name}-exclude.jar" 23 | } 24 | 25 | assemble { 26 | dependsOn(reobfJar) 27 | } 28 | 29 | tasks { 30 | reobfJar { 31 | File outputFile = new File(rootProject.archiveFolder, "reobf/${project.name}.jar") 32 | outputJar.set(layout.buildDirectory.file(outputFile.getPath())) 33 | } 34 | } 35 | 36 | if (project.hasProperty('nms.compile_v1_21') && !Boolean.valueOf(project.findProperty("nms.compile_v1_21").toString())) { 37 | project.tasks.all { task -> task.enabled = false } 38 | } -------------------------------------------------------------------------------- /NMS/v1_21_9/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("io.papermc.paperweight.userdev") version "2.0.0-beta.17" 3 | } 4 | 5 | java { 6 | toolchain { 7 | languageVersion.set(JavaLanguageVersion.of(21)) 8 | } 9 | } 10 | 11 | group 'NMS:v1_21_9' 12 | 13 | dependencies { 14 | paperweight.paperDevBundle("1.21.10-R0.1-SNAPSHOT") 15 | compileOnly project(":NMS:Spigot-1_20_3") 16 | compileOnly project(":NMS:Paper-1_20_3") 17 | compileOnly project(":API") 18 | compileOnly rootProject 19 | } 20 | 21 | shadowJar { 22 | archiveFileName = "${project.name}-exclude.jar" 23 | } 24 | 25 | assemble { 26 | dependsOn(reobfJar) 27 | } 28 | 29 | tasks { 30 | reobfJar { 31 | File outputFile = new File(rootProject.archiveFolder, "reobf/${project.name}.jar") 32 | outputJar.set(layout.buildDirectory.file(outputFile.getPath())) 33 | } 34 | } 35 | 36 | if (project.hasProperty('nms.compile_v1_21') && !Boolean.valueOf(project.findProperty("nms.compile_v1_21").toString())) { 37 | project.tasks.all { task -> task.enabled = false } 38 | } -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/tools/ToolBreaksTracker.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.tools; 2 | 3 | import com.bgsoftware.wildtools.WildToolsPlugin; 4 | import org.bukkit.entity.Player; 5 | import org.bukkit.metadata.FixedMetadataValue; 6 | 7 | public class ToolBreaksTracker { 8 | 9 | private static final WildToolsPlugin plugin = WildToolsPlugin.getPlugin(); 10 | 11 | private static final String TOOL_BREAK_IDENTIFIER = "WildTools-ToolBreak"; 12 | private static final FixedMetadataValue TOOL_BREAK_VALUE = new FixedMetadataValue(plugin, true); 13 | 14 | private ToolBreaksTracker() { 15 | 16 | } 17 | 18 | public static void trackPlayer(Player player) { 19 | player.setMetadata(TOOL_BREAK_IDENTIFIER, TOOL_BREAK_VALUE); 20 | } 21 | 22 | public static boolean containsPlayer(Player player) { 23 | return player.hasMetadata(TOOL_BREAK_IDENTIFIER); 24 | } 25 | 26 | public static void removePlayer(Player player) { 27 | player.removeMetadata(TOOL_BREAK_IDENTIFIER, plugin); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /Hooks/SuperMobCoins/src/main/java/com/bgsoftware/wildtools/hooks/SuperMobCoinsHook.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import com.bgsoftware.wildtools.WildToolsPlugin; 4 | import com.bgsoftware.wildtools.api.objects.tools.Tool; 5 | import me.swanis.mobcoins.events.MobCoinsReceiveEvent; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.event.EventHandler; 8 | import org.bukkit.event.Listener; 9 | 10 | public class SuperMobCoinsHook { 11 | 12 | public static void register(WildToolsPlugin plugin) { 13 | plugin.getServer().getPluginManager().registerEvents(new Listener() { 14 | @EventHandler 15 | public void onMobCoinReceive(MobCoinsReceiveEvent e) { 16 | Player killer = e.getProfile().getPlayer(); 17 | Tool tool = plugin.getToolsManager().getTool(plugin.getNMSAdapter().getItemInHand(killer)); 18 | 19 | if (tool != null) 20 | e.setAmount((int) (e.getAmount() * tool.getMultiplier())); 21 | } 22 | }, plugin); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /Hooks/MassiveFactions/src/main/java/com/bgsoftware/wildtools/hooks/ClaimsProvider_MassiveFactions.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import com.bgsoftware.wildtools.api.hooks.ClaimsProvider; 4 | import com.massivecraft.factions.entity.BoardColl; 5 | import com.massivecraft.factions.entity.Faction; 6 | import com.massivecraft.factions.entity.MPerm; 7 | import com.massivecraft.factions.entity.MPlayer; 8 | import com.massivecraft.massivecore.ps.PS; 9 | import org.bukkit.Location; 10 | import org.bukkit.entity.Player; 11 | 12 | public class ClaimsProvider_MassiveFactions implements ClaimsProvider { 13 | 14 | @Override 15 | public boolean isPlayerClaim(Player player, Location location) { 16 | MPlayer mPlayer = MPlayer.get(player); 17 | Faction faction = BoardColl.get().getFactionAt(PS.valueOf(location)); 18 | return faction != null && (mPlayer.getFaction().equals(faction) || (mPlayer.hasFaction() && 19 | faction.getPermitted(MPerm.getPermAccess()).contains(faction.getRelationWish(mPlayer.getFaction())))); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/hooks/SellInfo.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.hooks; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | public class SellInfo { 7 | 8 | private final Map soldItems = new HashMap<>(); 9 | private final double totalEarnings; 10 | 11 | /** 12 | * Constructor for the sell info object. 13 | * @param soldItems The sold items of the transaction. 14 | * @param totalEarnings The total earnings that were made from this transaction. 15 | */ 16 | public SellInfo(Map soldItems, double totalEarnings){ 17 | this.soldItems.putAll(soldItems); 18 | this.totalEarnings = totalEarnings; 19 | } 20 | 21 | /** 22 | * Get all the sold items of the transaction. 23 | */ 24 | public Map getSoldItems() { 25 | return soldItems; 26 | } 27 | 28 | /** 29 | * Get the total earnings from this transaction. 30 | */ 31 | public double getTotalEarnings() { 32 | return totalEarnings; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Hooks/Lands/src/main/java/com/bgsoftware/wildtools/hooks/ClaimsProvider_Lands.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import com.bgsoftware.wildtools.WildToolsPlugin; 4 | import com.bgsoftware.wildtools.api.hooks.ClaimsProvider; 5 | import me.angeschossen.lands.api.integration.LandsIntegration; 6 | import me.angeschossen.lands.api.land.LandArea; 7 | import me.angeschossen.lands.api.role.enums.RoleSetting; 8 | import org.bukkit.Location; 9 | import org.bukkit.entity.Player; 10 | 11 | public class ClaimsProvider_Lands implements ClaimsProvider { 12 | 13 | private final LandsIntegration landsIntegration; 14 | 15 | public ClaimsProvider_Lands(WildToolsPlugin plugin) { 16 | landsIntegration = new LandsIntegration(plugin, false); 17 | landsIntegration.initialize(); 18 | } 19 | 20 | @Override 21 | public boolean isPlayerClaim(Player player, Location location) { 22 | LandArea landArea = landsIntegration.getArea(location); 23 | return landArea != null && landArea.canSetting(player.getUniqueId(), RoleSetting.BLOCK_BREAK); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /Hooks/ChunkHoppers/src/main/java/com/bgsoftware/wildtools/hooks/DropsProvider_ChunkHoppers.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import com.bgsoftware.wildtools.api.hooks.DropsProvider; 4 | import dev.warse.chunkhoppers.ChunkHoppers; 5 | import dev.warse.chunkhoppers.utils.ChunkHopper; 6 | import org.bukkit.block.Block; 7 | import org.bukkit.entity.Player; 8 | import org.bukkit.inventory.ItemStack; 9 | 10 | import java.util.ArrayList; 11 | import java.util.Collections; 12 | import java.util.List; 13 | 14 | public class DropsProvider_ChunkHoppers implements DropsProvider { 15 | 16 | @Override 17 | public List getBlockDrops(Player player, Block block) { 18 | for (ChunkHopper chunkHopper : ChunkHoppers.getInstance().getHoppers()) { 19 | if (chunkHopper.getLoc().equals(block.getLocation())) { 20 | return Collections.singletonList(chunkHopper.getItem()); 21 | } 22 | } 23 | 24 | return null; 25 | } 26 | 27 | @Override 28 | public boolean isSpawnersOnly() { 29 | return false; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /Hooks/Vault/src/main/java/com/bgsoftware/wildtools/hooks/EconomyProvider_Vault.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import com.bgsoftware.wildtools.WildToolsPlugin; 4 | import net.milkbowl.vault.economy.Economy; 5 | import org.bukkit.Bukkit; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.plugin.RegisteredServiceProvider; 8 | 9 | public class EconomyProvider_Vault implements EconomyProvider { 10 | 11 | private static Economy econ; 12 | 13 | public static boolean isCompatible() { 14 | RegisteredServiceProvider rsp = Bukkit.getServicesManager().getRegistration(Economy.class); 15 | if (rsp != null) 16 | econ = rsp.getProvider(); 17 | 18 | if (econ != null) 19 | WildToolsPlugin.log("Using Vault as an economy provider."); 20 | 21 | return econ != null; 22 | } 23 | 24 | @Override 25 | public void depositPlayer(Player player, double price) { 26 | if (!econ.hasAccount(player)) 27 | econ.createPlayerAccount(player); 28 | 29 | econ.depositPlayer(player, price); 30 | } 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/nms/NMSWorld.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms; 2 | 3 | import com.bgsoftware.wildtools.utils.math.Vector3; 4 | import com.bgsoftware.wildtools.utils.world.WorldEditSession; 5 | import org.bukkit.Chunk; 6 | import org.bukkit.CropState; 7 | import org.bukkit.Location; 8 | import org.bukkit.World; 9 | import org.bukkit.block.Block; 10 | import org.bukkit.entity.Player; 11 | import org.bukkit.inventory.ItemStack; 12 | 13 | import java.util.List; 14 | 15 | public interface NMSWorld { 16 | 17 | List getBlockDrops(Player player, Block block, boolean silkTouch); 18 | 19 | int getExpFromBlock(Block block, Player player); 20 | 21 | boolean isFullyGrown(Block block); 22 | 23 | void setCropState(Block block, CropState cropState); 24 | 25 | void setBlockFast(World world, Vector3 location, int combinedId, boolean sendUpdate); 26 | 27 | void refreshChunk(Chunk chunk, List blocksList); 28 | 29 | int getCombinedId(Block block); 30 | 31 | boolean isOutsideWorldBorder(Location location); 32 | 33 | int getMinHeight(World world); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /Hooks/Towny/src/main/java/com/bgsoftware/wildtools/hooks/ClaimsProvider_Towny.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import com.bgsoftware.wildtools.api.hooks.ClaimsProvider; 4 | import com.palmergames.bukkit.towny.exceptions.NotRegisteredException; 5 | import com.palmergames.bukkit.towny.object.Resident; 6 | import com.palmergames.bukkit.towny.object.TownBlock; 7 | import com.palmergames.bukkit.towny.object.TownyUniverse; 8 | import com.palmergames.bukkit.towny.object.WorldCoord; 9 | import org.bukkit.Location; 10 | import org.bukkit.entity.Player; 11 | 12 | public class ClaimsProvider_Towny implements ClaimsProvider { 13 | 14 | @Override 15 | public boolean isPlayerClaim(Player player, Location location) { 16 | try { 17 | TownBlock townBlock = WorldCoord.parseWorldCoord(location).getTownBlock(); 18 | Resident resident = TownyUniverse.getDataSource().getResident(player.getName()); 19 | return resident != null && resident.hasTown() && resident.getTown().hasTownBlock(townBlock); 20 | } catch (NotRegisteredException ex) { 21 | return false; 22 | } 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /Hooks/MergedSpawner/src/main/java/com/bgsoftware/wildtools/hooks/DropsProvider_MergedSpawner.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import com.bgsoftware.wildtools.api.hooks.DropsProvider; 4 | import com.vk2gpz.mergedspawner.api.MergedSpawnerAPI; 5 | import org.bukkit.block.Block; 6 | import org.bukkit.block.BlockState; 7 | import org.bukkit.block.CreatureSpawner; 8 | import org.bukkit.entity.Player; 9 | import org.bukkit.inventory.ItemStack; 10 | 11 | import java.util.Collections; 12 | import java.util.List; 13 | 14 | public class DropsProvider_MergedSpawner implements DropsProvider { 15 | 16 | @Override 17 | public List getBlockDrops(Player player, Block block) { 18 | BlockState blockState = block.getState(); 19 | 20 | if (!(blockState instanceof CreatureSpawner)) 21 | return null; 22 | 23 | int count = MergedSpawnerAPI.getInstance().getCountFor(block); 24 | return Collections.singletonList(MergedSpawnerAPI.getInstance().getSpawnerFor(((CreatureSpawner) blockState).getSpawnedType(), count)); 25 | } 26 | 27 | @Override 28 | public boolean isSpawnersOnly() { 29 | return true; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Hooks/FactionsX/src/main/java/com/bgsoftware/wildtools/hooks/ClaimsProvider_FactionsX.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import com.bgsoftware.wildtools.api.hooks.ClaimsProvider; 4 | import net.prosavage.factionsx.core.FPlayer; 5 | import net.prosavage.factionsx.core.Faction; 6 | import net.prosavage.factionsx.manager.GridManager; 7 | import net.prosavage.factionsx.manager.PlayerManager; 8 | import net.prosavage.factionsx.persist.data.FactionsKt; 9 | import net.prosavage.factionsx.util.PlayerAction; 10 | import org.bukkit.Location; 11 | import org.bukkit.entity.Player; 12 | 13 | public class ClaimsProvider_FactionsX implements ClaimsProvider { 14 | 15 | @Override 16 | public boolean isPlayerClaim(Player player, Location location) { 17 | FPlayer fPlayer = PlayerManager.INSTANCE.getFPlayer(player); 18 | Faction faction = GridManager.INSTANCE.getFactionAt(FactionsKt.getFLocation(location)); 19 | return !faction.isWilderness() && (fPlayer.getFaction().equals(faction) || (fPlayer.hasFaction() && 20 | faction.getRelationPerms().getPermForRelation(faction.getRelationTo(fPlayer.getFaction()), PlayerAction.BREAK_BLOCK))); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/handlers/ProvidersManager.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.handlers; 2 | 3 | import com.bgsoftware.wildtools.api.hooks.ClaimsProvider; 4 | import com.bgsoftware.wildtools.api.hooks.ContainerProvider; 5 | import com.bgsoftware.wildtools.api.hooks.DropsProvider; 6 | import com.bgsoftware.wildtools.api.hooks.PricesProvider; 7 | 8 | public interface ProvidersManager { 9 | 10 | /** 11 | * Add a new container handler for the core. 12 | * @param containerProvider The handler to add. 13 | */ 14 | void addContainerProvider(ContainerProvider containerProvider); 15 | 16 | /** 17 | * Add a new drops handler for the core. 18 | * @param dropsProvider The handler to add. 19 | */ 20 | void addDropsProvider(DropsProvider dropsProvider); 21 | 22 | /** 23 | * Set the prices provider for the core. 24 | * @param pricesProvider The provider to set. 25 | */ 26 | void setPricesProvider(PricesProvider pricesProvider); 27 | 28 | /** 29 | * Add a new claims handler for the core. 30 | * @param claimsProvider The handler to add. 31 | */ 32 | void addClaimsProvider(ClaimsProvider claimsProvider); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /Hooks/SavageFactions/src/main/java/com/bgsoftware/wildtools/hooks/FactionsProvider_SavageFactions.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import com.bgsoftware.wildtools.WildToolsPlugin; 4 | import com.massivecraft.factions.FPlayer; 5 | import com.massivecraft.factions.FPlayers; 6 | import com.massivecraft.factions.struct.Role; 7 | import org.bukkit.entity.Player; 8 | 9 | public class FactionsProvider_SavageFactions implements FactionsProvider { 10 | 11 | public FactionsProvider_SavageFactions(){ 12 | WildToolsPlugin.log(" - Using SavageFactions as FactionsProvider for tnt banks."); 13 | } 14 | 15 | @Override 16 | public int getTNTAmountFromBank(Player player) { 17 | FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player); 18 | return !fPlayer.hasFaction() || !fPlayer.getRole().isAtLeast(Role.MODERATOR) ? 0 : fPlayer.getFaction().getTnt(); 19 | } 20 | 21 | @Override 22 | public void takeTNTFromBank(Player player, int amount) { 23 | FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player); 24 | 25 | if(fPlayer.hasFaction() && fPlayer.getRole().isAtLeast(Role.MODERATOR)) 26 | fPlayer.getFaction().takeTnt(amount); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/hooks/DropsProvider.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.hooks; 2 | 3 | import org.bukkit.block.Block; 4 | import org.bukkit.entity.Player; 5 | import org.bukkit.inventory.ItemStack; 6 | 7 | import javax.annotation.Nullable; 8 | import java.util.List; 9 | 10 | public interface DropsProvider { 11 | 12 | /** 13 | * Get all the drops for the block. 14 | * This method is used to get custom drops for blocks, and add them to the inventory of the player if the tool 15 | * has auto collect enabled. WildTools adds "drop-items" metadata to the block. If it's enabled, then you should 16 | * drop the items of the block on your own. Otherwise, WildTools will handle that part. 17 | * @param player The player that broke the block. 18 | * @param block The block that was broken. 19 | * @return If you want WildTools to handle block drops, return null. Otherwise, WildTools will drop the items 20 | * returned by this method, even if the list is empty. 21 | */ 22 | @Nullable 23 | List getBlockDrops(Player player, Block block); 24 | 25 | /** 26 | * Check whether or not this handler is used only for spawners. 27 | */ 28 | boolean isSpawnersOnly(); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/objects/tools/HarvesterTool.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.objects.tools; 2 | 3 | public interface HarvesterTool extends Tool { 4 | 5 | /** 6 | * Get the harvesting radius of the wand. 7 | */ 8 | int getRadius(); 9 | 10 | /** 11 | * Get the farmland harvesting radius of the wand. 12 | */ 13 | int getFarmlandRadius(); 14 | 15 | /** 16 | * Set the farmland harvesting radius of the wand. 17 | * @param farmlandRadius The new farmland harvesting radius. 18 | */ 19 | void setFarmlandRadius(int farmlandRadius); 20 | 21 | /** 22 | * Get the activation action of the wand. 23 | * @return Can be RIGHT_CLICK or LEFT_CLICK. 24 | */ 25 | String getActivationAction(); 26 | 27 | /** 28 | * Set the activation action of the wand. 29 | * @param activateAction Can be RIGHT_CLICK or LEFT_CLICK. 30 | */ 31 | void setActivationAction(String activateAction); 32 | 33 | /** 34 | * Should the radius be only for one layer? 35 | */ 36 | boolean isOneLayerOnly(); 37 | 38 | /** 39 | * Set whether or not the radius should be only for one layer. 40 | */ 41 | void setOneLayerOnly(boolean oneLayerOnly); 42 | 43 | } 44 | -------------------------------------------------------------------------------- /Hooks/SilkSpawners_CandC2/src/main/java/com/bgsoftware/wildtools/hooks/DropsProvider_SilkSpawners_CandC2.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import com.bgsoftware.wildtools.api.hooks.DropsProvider; 4 | import de.corneliusmay.silkspawners.plugin.SilkSpawners; 5 | import de.corneliusmay.silkspawners.plugin.spawner.Spawner; 6 | import org.bukkit.block.Block; 7 | import org.bukkit.entity.Player; 8 | import org.bukkit.inventory.ItemStack; 9 | import org.bukkit.plugin.java.JavaPlugin; 10 | 11 | import java.util.Collections; 12 | import java.util.List; 13 | 14 | public class DropsProvider_SilkSpawners_CandC2 implements DropsProvider { 15 | 16 | private final SilkSpawners silkSpawners; 17 | 18 | public DropsProvider_SilkSpawners_CandC2() { 19 | silkSpawners = JavaPlugin.getPlugin(SilkSpawners.class); 20 | } 21 | 22 | @Override 23 | public List getBlockDrops(Player player, Block block) { 24 | Spawner spawner = new Spawner(this.silkSpawners, block); 25 | if (!spawner.isValid()) 26 | return Collections.emptyList(); 27 | 28 | return Collections.singletonList(spawner.getItemStack()); 29 | } 30 | 31 | @Override 32 | public boolean isSpawnersOnly() { 33 | return true; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /NMS/Paper/src/main/java/com/bgsoftware/wildtools/nms/alogrithms/PaperGlowEnchantment.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.alogrithms; 2 | 3 | import io.papermc.paper.enchantments.EnchantmentRarity; 4 | import net.kyori.adventure.text.Component; 5 | import org.bukkit.entity.EntityCategory; 6 | import org.bukkit.inventory.EquipmentSlot; 7 | 8 | import java.util.Collections; 9 | import java.util.Set; 10 | 11 | public class PaperGlowEnchantment extends SpigotGlowEnchantment { 12 | 13 | public PaperGlowEnchantment(String name) { 14 | super(name); 15 | } 16 | 17 | @Override 18 | public Component displayName(int i) { 19 | return Component.empty(); 20 | } 21 | 22 | @Override 23 | public boolean isTradeable() { 24 | return false; 25 | } 26 | 27 | @Override 28 | public boolean isDiscoverable() { 29 | return false; 30 | } 31 | 32 | @Override 33 | public EnchantmentRarity getRarity() { 34 | return EnchantmentRarity.COMMON; 35 | } 36 | 37 | @Override 38 | public float getDamageIncrease(int i, EntityCategory entityCategory) { 39 | return 0; 40 | } 41 | 42 | @Override 43 | public Set getActiveSlots() { 44 | return Collections.emptySet(); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /NMS/Spigot/src/main/java/com/bgsoftware/wildtools/nms/alogrithms/SpigotGlowEnchantment.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.alogrithms; 2 | 3 | import org.bukkit.NamespacedKey; 4 | import org.bukkit.enchantments.Enchantment; 5 | import org.bukkit.enchantments.EnchantmentTarget; 6 | 7 | public class SpigotGlowEnchantment extends Enchantment { 8 | 9 | public SpigotGlowEnchantment(String name) { 10 | super(NamespacedKey.minecraft(name)); 11 | } 12 | 13 | @Override 14 | public String getName() { 15 | return "WildToolsGlow"; 16 | } 17 | 18 | @Override 19 | public int getMaxLevel() { 20 | return 1; 21 | } 22 | 23 | @Override 24 | public int getStartLevel() { 25 | return 0; 26 | } 27 | 28 | @Override 29 | public EnchantmentTarget getItemTarget() { 30 | return null; 31 | } 32 | 33 | public boolean isTreasure() { 34 | return false; 35 | } 36 | 37 | public boolean isCursed() { 38 | return false; 39 | } 40 | 41 | @Override 42 | public boolean conflictsWith(Enchantment enchantment) { 43 | return false; 44 | } 45 | 46 | @Override 47 | public boolean canEnchantItem(org.bukkit.inventory.ItemStack itemStack) { 48 | return true; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/objects/Selection.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.objects; 2 | 3 | import com.bgsoftware.wildtools.api.objects.tools.Tool; 4 | import org.bukkit.Location; 5 | import org.bukkit.block.Dispenser; 6 | 7 | import java.util.List; 8 | 9 | public interface Selection { 10 | 11 | /** 12 | * Set the right-click location of the selection. 13 | * @param rightClick The right-click location. 14 | */ 15 | void setRightClick(Location rightClick); 16 | 17 | /** 18 | * Set the left-click location of the selection. 19 | * @param leftClick The right-click location. 20 | */ 21 | void setLeftClick(Location leftClick); 22 | 23 | /** 24 | * Check whether or not both locations are set. 25 | */ 26 | boolean isReady(); 27 | 28 | /** 29 | * Check whether or not the player is between both locations. 30 | */ 31 | boolean isInside(); 32 | 33 | /** 34 | * Get all the dispensers between both locations. 35 | * @param tool The tool that was used. 36 | */ 37 | List getDispensers(Tool tool); 38 | 39 | /** 40 | * Remove the selection from cache. 41 | * Please note: selections are auto removed from cache after 10 minutes. 42 | */ 43 | void remove(); 44 | 45 | } 46 | -------------------------------------------------------------------------------- /NMS/Paper-1_20_3/src/main/java/com/bgsoftware/wildtools/nms/v1_20_3/alogrithms/PaperGlowEnchantment.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_20_3.alogrithms; 2 | 3 | import io.papermc.paper.enchantments.EnchantmentRarity; 4 | import net.kyori.adventure.text.Component; 5 | import org.bukkit.entity.EntityCategory; 6 | import org.bukkit.inventory.EquipmentSlot; 7 | 8 | import java.util.Collections; 9 | import java.util.Set; 10 | 11 | public class PaperGlowEnchantment extends SpigotGlowEnchantment { 12 | 13 | public PaperGlowEnchantment(String name) { 14 | super(name); 15 | } 16 | 17 | @Override 18 | public Component displayName(int i) { 19 | return Component.empty(); 20 | } 21 | 22 | @Override 23 | public boolean isTradeable() { 24 | return false; 25 | } 26 | 27 | @Override 28 | public boolean isDiscoverable() { 29 | return false; 30 | } 31 | 32 | @Override 33 | public EnchantmentRarity getRarity() { 34 | return EnchantmentRarity.COMMON; 35 | } 36 | 37 | @Override 38 | public float getDamageIncrease(int i, EntityCategory entityCategory) { 39 | return 0; 40 | } 41 | 42 | @Override 43 | public Set getActiveSlots() { 44 | return Collections.emptySet(); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/hooks/ContainerProvider.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.hooks; 2 | 3 | import org.bukkit.block.BlockState; 4 | import org.bukkit.entity.Player; 5 | import org.bukkit.inventory.Inventory; 6 | 7 | public interface ContainerProvider { 8 | 9 | /** 10 | * Checks whether or not a block is a container. 11 | * @param blockState The block to check. 12 | */ 13 | boolean isContainer(BlockState blockState); 14 | 15 | /** 16 | * Performs a sell task on the container. 17 | * @param blockState The container to sell. 18 | * @param inventory The inventory of the block state, nullable. 19 | * @param player The player who sold the container. 20 | * @return A SellInfo object with all the information about the transaction. 21 | */ 22 | SellInfo sellContainer(BlockState blockState, Inventory inventory, Player player); 23 | 24 | /** 25 | * Performs a cleaning of items after the sell task completes. 26 | * @param blockState The container to remove items from. 27 | * @param inventory The inventory of the block state, nullable. 28 | * @param sellInfo The object that was returned by the sellContainer method. 29 | */ 30 | void removeContainer(BlockState blockState, Inventory inventory, SellInfo sellInfo); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /NMS/v1_17/src/main/java/com/bgsoftware/wildtools/nms/v1_17/NMSWorldImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_17; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.network.protocol.game.ClientboundLightUpdatePacket; 5 | import net.minecraft.server.level.ServerPlayer; 6 | import net.minecraft.server.level.ThreadedLevelLightEngine; 7 | import net.minecraft.world.level.ChunkPos; 8 | import net.minecraft.world.level.block.state.BlockState; 9 | import net.minecraft.world.level.chunk.LevelChunk; 10 | 11 | public class NMSWorldImpl extends com.bgsoftware.wildtools.nms.v1_17.AbstractNMSWorld { 12 | 13 | @Override 14 | protected int getExpDrop(BlockState blockState, ServerPlayer serverPlayer, BlockPos blockPos) { 15 | return blockState.getBlock().getExpDrop(blockState, serverPlayer.getLevel(), blockPos, serverPlayer.getMainHandItem()); 16 | } 17 | 18 | @Override 19 | protected void setBlockState(LevelChunk levelChunk, BlockPos blockPos, BlockState blockState) { 20 | levelChunk.setBlockState(blockPos, blockState, true); 21 | } 22 | 23 | @Override 24 | protected ClientboundLightUpdatePacket createLightUpdatePacket(ChunkPos chunkPos, ThreadedLevelLightEngine lightEngine) { 25 | return new ClientboundLightUpdatePacket(chunkPos, lightEngine, null, null, true); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /NMS/v1_18/src/main/java/com/bgsoftware/wildtools/nms/v1_18/NMSWorldImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_18; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.network.protocol.game.ClientboundLightUpdatePacket; 5 | import net.minecraft.server.level.ServerPlayer; 6 | import net.minecraft.server.level.ThreadedLevelLightEngine; 7 | import net.minecraft.world.level.ChunkPos; 8 | import net.minecraft.world.level.block.state.BlockState; 9 | import net.minecraft.world.level.chunk.LevelChunk; 10 | 11 | public class NMSWorldImpl extends com.bgsoftware.wildtools.nms.v1_18.AbstractNMSWorld { 12 | 13 | @Override 14 | protected int getExpDrop(BlockState blockState, ServerPlayer serverPlayer, BlockPos blockPos) { 15 | return blockState.getBlock().getExpDrop(blockState, serverPlayer.getLevel(), blockPos, serverPlayer.getMainHandItem()); 16 | } 17 | 18 | @Override 19 | protected void setBlockState(LevelChunk levelChunk, BlockPos blockPos, BlockState blockState) { 20 | levelChunk.setBlockState(blockPos, blockState, true); 21 | } 22 | 23 | @Override 24 | protected ClientboundLightUpdatePacket createLightUpdatePacket(ChunkPos chunkPos, ThreadedLevelLightEngine lightEngine) { 25 | return new ClientboundLightUpdatePacket(chunkPos, lightEngine, null, null, true); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /NMS/v1_21_7/src/main/java/com/bgsoftware/wildtools/nms/v1_21_7/NMSWorldImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_21_7; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.network.protocol.game.ClientboundLightUpdatePacket; 5 | import net.minecraft.server.level.ServerPlayer; 6 | import net.minecraft.server.level.ThreadedLevelLightEngine; 7 | import net.minecraft.world.level.ChunkPos; 8 | import net.minecraft.world.level.block.state.BlockState; 9 | import net.minecraft.world.level.chunk.LevelChunk; 10 | 11 | public class NMSWorldImpl extends com.bgsoftware.wildtools.nms.v1_21_7.AbstractNMSWorld { 12 | 13 | @Override 14 | protected int getExpDrop(BlockState blockState, ServerPlayer serverPlayer, BlockPos blockPos) { 15 | return blockState.getBlock().getExpDrop(blockState, serverPlayer.level(), blockPos, serverPlayer.getMainHandItem(), true); 16 | } 17 | 18 | @Override 19 | protected void setBlockState(LevelChunk levelChunk, BlockPos blockPos, BlockState blockState) { 20 | levelChunk.setBlockState(blockPos, blockState, 3); 21 | } 22 | 23 | @Override 24 | protected ClientboundLightUpdatePacket createLightUpdatePacket(ChunkPos chunkPos, ThreadedLevelLightEngine lightEngine) { 25 | return new ClientboundLightUpdatePacket(chunkPos, lightEngine, null, null); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /NMS/v1_21_9/src/main/java/com/bgsoftware/wildtools/nms/v1_21_9/NMSWorldImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_21_9; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.network.protocol.game.ClientboundLightUpdatePacket; 5 | import net.minecraft.server.level.ServerPlayer; 6 | import net.minecraft.server.level.ThreadedLevelLightEngine; 7 | import net.minecraft.world.level.ChunkPos; 8 | import net.minecraft.world.level.block.state.BlockState; 9 | import net.minecraft.world.level.chunk.LevelChunk; 10 | 11 | public class NMSWorldImpl extends com.bgsoftware.wildtools.nms.v1_21_9.AbstractNMSWorld { 12 | 13 | @Override 14 | protected int getExpDrop(BlockState blockState, ServerPlayer serverPlayer, BlockPos blockPos) { 15 | return blockState.getBlock().getExpDrop(blockState, serverPlayer.level(), blockPos, serverPlayer.getMainHandItem(), true); 16 | } 17 | 18 | @Override 19 | protected void setBlockState(LevelChunk levelChunk, BlockPos blockPos, BlockState blockState) { 20 | levelChunk.setBlockState(blockPos, blockState, 3); 21 | } 22 | 23 | @Override 24 | protected ClientboundLightUpdatePacket createLightUpdatePacket(ChunkPos chunkPos, ThreadedLevelLightEngine lightEngine) { 25 | return new ClientboundLightUpdatePacket(chunkPos, lightEngine, null, null); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /NMS/v1_19/src/main/java/com/bgsoftware/wildtools/nms/v1_19/NMSWorldImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_19; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.network.protocol.game.ClientboundLightUpdatePacket; 5 | import net.minecraft.server.level.ServerPlayer; 6 | import net.minecraft.server.level.ThreadedLevelLightEngine; 7 | import net.minecraft.world.level.ChunkPos; 8 | import net.minecraft.world.level.block.state.BlockState; 9 | import net.minecraft.world.level.chunk.LevelChunk; 10 | 11 | public class NMSWorldImpl extends com.bgsoftware.wildtools.nms.v1_19.AbstractNMSWorld { 12 | 13 | @Override 14 | protected int getExpDrop(BlockState blockState, ServerPlayer serverPlayer, BlockPos blockPos) { 15 | return blockState.getBlock().getExpDrop(blockState, serverPlayer.getLevel(), blockPos, serverPlayer.getMainHandItem(), true); 16 | } 17 | 18 | @Override 19 | protected void setBlockState(LevelChunk levelChunk, BlockPos blockPos, BlockState blockState) { 20 | levelChunk.setBlockState(blockPos, blockState, true); 21 | } 22 | 23 | @Override 24 | protected ClientboundLightUpdatePacket createLightUpdatePacket(ChunkPos chunkPos, ThreadedLevelLightEngine lightEngine) { 25 | return new ClientboundLightUpdatePacket(chunkPos, lightEngine, null, null, true); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /NMS/v1_21/src/main/java/com/bgsoftware/wildtools/nms/v1_21/NMSWorldImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_21; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.network.protocol.game.ClientboundLightUpdatePacket; 5 | import net.minecraft.server.level.ServerPlayer; 6 | import net.minecraft.server.level.ThreadedLevelLightEngine; 7 | import net.minecraft.world.level.ChunkPos; 8 | import net.minecraft.world.level.block.state.BlockState; 9 | import net.minecraft.world.level.chunk.LevelChunk; 10 | 11 | public class NMSWorldImpl extends com.bgsoftware.wildtools.nms.v1_21.AbstractNMSWorld { 12 | 13 | @Override 14 | protected int getExpDrop(BlockState blockState, ServerPlayer serverPlayer, BlockPos blockPos) { 15 | return blockState.getBlock().getExpDrop(blockState, serverPlayer.serverLevel(), blockPos, serverPlayer.getMainHandItem(), true); 16 | } 17 | 18 | @Override 19 | protected void setBlockState(LevelChunk levelChunk, BlockPos blockPos, BlockState blockState) { 20 | levelChunk.setBlockState(blockPos, blockState, true); 21 | } 22 | 23 | @Override 24 | protected ClientboundLightUpdatePacket createLightUpdatePacket(ChunkPos chunkPos, ThreadedLevelLightEngine lightEngine) { 25 | return new ClientboundLightUpdatePacket(chunkPos, lightEngine, null, null); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /NMS/v1_21_10/src/main/java/com/bgsoftware/wildtools/nms/v1_21_10/NMSWorldImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_21_10; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.network.protocol.game.ClientboundLightUpdatePacket; 5 | import net.minecraft.server.level.ServerPlayer; 6 | import net.minecraft.server.level.ThreadedLevelLightEngine; 7 | import net.minecraft.world.level.ChunkPos; 8 | import net.minecraft.world.level.block.state.BlockState; 9 | import net.minecraft.world.level.chunk.LevelChunk; 10 | 11 | public class NMSWorldImpl extends com.bgsoftware.wildtools.nms.v1_21_10.AbstractNMSWorld { 12 | 13 | @Override 14 | protected int getExpDrop(BlockState blockState, ServerPlayer serverPlayer, BlockPos blockPos) { 15 | return blockState.getBlock().getExpDrop(blockState, serverPlayer.level(), blockPos, serverPlayer.getMainHandItem(), true); 16 | } 17 | 18 | @Override 19 | protected void setBlockState(LevelChunk levelChunk, BlockPos blockPos, BlockState blockState) { 20 | levelChunk.setBlockState(blockPos, blockState, 3); 21 | } 22 | 23 | @Override 24 | protected ClientboundLightUpdatePacket createLightUpdatePacket(ChunkPos chunkPos, ThreadedLevelLightEngine lightEngine) { 25 | return new ClientboundLightUpdatePacket(chunkPos, lightEngine, null, null); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/hooks/StackedItemProvider_Default.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import org.bukkit.Location; 4 | import org.bukkit.entity.Item; 5 | import org.bukkit.inventory.ItemStack; 6 | 7 | public class StackedItemProvider_Default implements StackedItemProvider { 8 | 9 | @Override 10 | public ItemStack getItemStack(Item item) { 11 | return item.getItemStack(); 12 | } 13 | 14 | @Override 15 | public void setItemStack(Item item, ItemStack itemStack) { 16 | item.setItemStack(itemStack); 17 | } 18 | 19 | @Override 20 | public void dropItem(Location location, ItemStack itemStack, int count) { 21 | ItemStack dropItem = itemStack.clone(); 22 | 23 | if (count > itemStack.getMaxStackSize()) { 24 | int amountOfStacks = count / itemStack.getMaxStackSize(); 25 | dropItem.setAmount(itemStack.getMaxStackSize()); 26 | for (int i = 0; i < amountOfStacks; ++i) { 27 | location.getWorld().dropItemNaturally(location, dropItem); 28 | } 29 | count = count % itemStack.getMaxStackSize(); 30 | } 31 | 32 | if (count > 0) { 33 | dropItem.setAmount(count); 34 | location.getWorld().dropItemNaturally(location, dropItem); 35 | } 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/utils/math/Vector2.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.utils.math; 2 | 3 | import org.bukkit.Chunk; 4 | import org.bukkit.Location; 5 | import org.bukkit.World; 6 | 7 | import java.util.Objects; 8 | 9 | public class Vector2 { 10 | 11 | private final int x; 12 | private final int z; 13 | 14 | public static Vector2 of(Location location) { 15 | return new Vector2(location.getBlockX() >> 4, location.getBlockZ() >> 4); 16 | } 17 | 18 | public Vector2(int x, int z) { 19 | this.x = x; 20 | this.z = z; 21 | } 22 | 23 | public int getX() { 24 | return x; 25 | } 26 | 27 | public int getZ() { 28 | return z; 29 | } 30 | 31 | public Chunk toChunk(World world) { 32 | return world.getChunkAt(this.x, this.z); 33 | } 34 | 35 | @Override 36 | public boolean equals(Object o) { 37 | if (this == o) return true; 38 | if (o == null || getClass() != o.getClass()) return false; 39 | Vector2 that = (Vector2) o; 40 | return x == that.x && z == that.z; 41 | } 42 | 43 | @Override 44 | public int hashCode() { 45 | return Objects.hash(x, z); 46 | } 47 | 48 | @Override 49 | public String toString() { 50 | return "Vector2{" + x + ", " + z + "}"; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /NMS/v1_20_3/src/main/java/com/bgsoftware/wildtools/nms/v1_20_3/NMSWorldImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_20_3; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.network.protocol.game.ClientboundLightUpdatePacket; 5 | import net.minecraft.server.level.ServerPlayer; 6 | import net.minecraft.server.level.ThreadedLevelLightEngine; 7 | import net.minecraft.world.level.ChunkPos; 8 | import net.minecraft.world.level.block.state.BlockState; 9 | import net.minecraft.world.level.chunk.LevelChunk; 10 | 11 | public class NMSWorldImpl extends com.bgsoftware.wildtools.nms.v1_20_3.AbstractNMSWorld { 12 | 13 | @Override 14 | protected int getExpDrop(BlockState blockState, ServerPlayer serverPlayer, BlockPos blockPos) { 15 | return blockState.getBlock().getExpDrop(blockState, serverPlayer.serverLevel(), blockPos, serverPlayer.getMainHandItem(), true); 16 | } 17 | 18 | @Override 19 | protected void setBlockState(LevelChunk levelChunk, BlockPos blockPos, BlockState blockState) { 20 | levelChunk.setBlockState(blockPos, blockState, true); 21 | } 22 | 23 | @Override 24 | protected ClientboundLightUpdatePacket createLightUpdatePacket(ChunkPos chunkPos, ThreadedLevelLightEngine lightEngine) { 25 | return new ClientboundLightUpdatePacket(chunkPos, lightEngine, null, null); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /NMS/v1_20_4/src/main/java/com/bgsoftware/wildtools/nms/v1_20_4/NMSWorldImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_20_4; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.network.protocol.game.ClientboundLightUpdatePacket; 5 | import net.minecraft.server.level.ServerPlayer; 6 | import net.minecraft.server.level.ThreadedLevelLightEngine; 7 | import net.minecraft.world.level.ChunkPos; 8 | import net.minecraft.world.level.block.state.BlockState; 9 | import net.minecraft.world.level.chunk.LevelChunk; 10 | 11 | public class NMSWorldImpl extends com.bgsoftware.wildtools.nms.v1_20_4.AbstractNMSWorld { 12 | 13 | @Override 14 | protected int getExpDrop(BlockState blockState, ServerPlayer serverPlayer, BlockPos blockPos) { 15 | return blockState.getBlock().getExpDrop(blockState, serverPlayer.serverLevel(), blockPos, serverPlayer.getMainHandItem(), true); 16 | } 17 | 18 | @Override 19 | protected void setBlockState(LevelChunk levelChunk, BlockPos blockPos, BlockState blockState) { 20 | levelChunk.setBlockState(blockPos, blockState, true); 21 | } 22 | 23 | @Override 24 | protected ClientboundLightUpdatePacket createLightUpdatePacket(ChunkPos chunkPos, ThreadedLevelLightEngine lightEngine) { 25 | return new ClientboundLightUpdatePacket(chunkPos, lightEngine, null, null); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /NMS/v1_21_3/src/main/java/com/bgsoftware/wildtools/nms/v1_21_3/NMSWorldImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_21_3; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.network.protocol.game.ClientboundLightUpdatePacket; 5 | import net.minecraft.server.level.ServerPlayer; 6 | import net.minecraft.server.level.ThreadedLevelLightEngine; 7 | import net.minecraft.world.level.ChunkPos; 8 | import net.minecraft.world.level.block.state.BlockState; 9 | import net.minecraft.world.level.chunk.LevelChunk; 10 | 11 | public class NMSWorldImpl extends com.bgsoftware.wildtools.nms.v1_21_3.AbstractNMSWorld { 12 | 13 | @Override 14 | protected int getExpDrop(BlockState blockState, ServerPlayer serverPlayer, BlockPos blockPos) { 15 | return blockState.getBlock().getExpDrop(blockState, serverPlayer.serverLevel(), blockPos, serverPlayer.getMainHandItem(), true); 16 | } 17 | 18 | @Override 19 | protected void setBlockState(LevelChunk levelChunk, BlockPos blockPos, BlockState blockState) { 20 | levelChunk.setBlockState(blockPos, blockState, true); 21 | } 22 | 23 | @Override 24 | protected ClientboundLightUpdatePacket createLightUpdatePacket(ChunkPos chunkPos, ThreadedLevelLightEngine lightEngine) { 25 | return new ClientboundLightUpdatePacket(chunkPos, lightEngine, null, null); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /NMS/v1_21_4/src/main/java/com/bgsoftware/wildtools/nms/v1_21_4/NMSWorldImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_21_4; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.network.protocol.game.ClientboundLightUpdatePacket; 5 | import net.minecraft.server.level.ServerPlayer; 6 | import net.minecraft.server.level.ThreadedLevelLightEngine; 7 | import net.minecraft.world.level.ChunkPos; 8 | import net.minecraft.world.level.block.state.BlockState; 9 | import net.minecraft.world.level.chunk.LevelChunk; 10 | 11 | public class NMSWorldImpl extends com.bgsoftware.wildtools.nms.v1_21_4.AbstractNMSWorld { 12 | 13 | @Override 14 | protected int getExpDrop(BlockState blockState, ServerPlayer serverPlayer, BlockPos blockPos) { 15 | return blockState.getBlock().getExpDrop(blockState, serverPlayer.serverLevel(), blockPos, serverPlayer.getMainHandItem(), true); 16 | } 17 | 18 | @Override 19 | protected void setBlockState(LevelChunk levelChunk, BlockPos blockPos, BlockState blockState) { 20 | levelChunk.setBlockState(blockPos, blockState, true); 21 | } 22 | 23 | @Override 24 | protected ClientboundLightUpdatePacket createLightUpdatePacket(ChunkPos chunkPos, ThreadedLevelLightEngine lightEngine) { 25 | return new ClientboundLightUpdatePacket(chunkPos, lightEngine, null, null); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /NMS/v1_21_5/src/main/java/com/bgsoftware/wildtools/nms/v1_21_5/NMSWorldImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_21_5; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.network.protocol.game.ClientboundLightUpdatePacket; 5 | import net.minecraft.server.level.ServerPlayer; 6 | import net.minecraft.server.level.ThreadedLevelLightEngine; 7 | import net.minecraft.world.level.ChunkPos; 8 | import net.minecraft.world.level.block.state.BlockState; 9 | import net.minecraft.world.level.chunk.LevelChunk; 10 | 11 | public class NMSWorldImpl extends com.bgsoftware.wildtools.nms.v1_21_5.AbstractNMSWorld { 12 | 13 | @Override 14 | protected int getExpDrop(BlockState blockState, ServerPlayer serverPlayer, BlockPos blockPos) { 15 | return blockState.getBlock().getExpDrop(blockState, serverPlayer.serverLevel(), blockPos, serverPlayer.getMainHandItem(), true); 16 | } 17 | 18 | @Override 19 | protected void setBlockState(LevelChunk levelChunk, BlockPos blockPos, BlockState blockState) { 20 | levelChunk.setBlockState(blockPos, blockState, 3); 21 | } 22 | 23 | @Override 24 | protected ClientboundLightUpdatePacket createLightUpdatePacket(ChunkPos chunkPos, ThreadedLevelLightEngine lightEngine) { 25 | return new ClientboundLightUpdatePacket(chunkPos, lightEngine, null, null); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/hooks/PricesProvider_Default.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import com.bgsoftware.wildtools.WildToolsPlugin; 4 | import com.bgsoftware.wildtools.api.hooks.PricesProvider; 5 | import org.bukkit.entity.Player; 6 | import org.bukkit.inventory.ItemStack; 7 | 8 | import java.util.HashMap; 9 | import java.util.Map; 10 | 11 | public class PricesProvider_Default implements PricesProvider { 12 | 13 | @SuppressWarnings("MismatchedQueryAndUpdateOfCollection") 14 | public static Map prices = new HashMap<>(); 15 | 16 | public PricesProvider_Default(){ 17 | WildToolsPlugin.log(" - Couldn't find any prices providers, using default one."); 18 | } 19 | 20 | @Override 21 | public double getPrice(Player player, ItemStack itemStack) { 22 | //Checks for 'TYPE' item 23 | if(prices.containsKey(itemStack.getType().name())) 24 | return prices.get(itemStack.getType().name()) * itemStack.getAmount(); 25 | //Checks for 'TYPE:DATA' item 26 | if(prices.containsKey(itemStack.getType().name() + ":" + itemStack.getDurability())) 27 | return prices.get(itemStack.getType().name() + ":" + itemStack.getDurability()) * itemStack.getAmount(); 28 | //Couldn't find a price for this item 29 | return -1; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /NMS/v1_16_R3/src/main/java/com/bgsoftware/wildtools/nms/v1_16_R3/world/FakeCraftBlock.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_16_R3.world; 2 | 3 | import org.bukkit.Material; 4 | import org.bukkit.block.Block; 5 | import org.bukkit.block.BlockState; 6 | import org.bukkit.block.data.BlockData; 7 | import org.bukkit.craftbukkit.v1_16_R3.CraftWorld; 8 | import org.bukkit.craftbukkit.v1_16_R3.block.CraftBlock; 9 | import org.bukkit.craftbukkit.v1_16_R3.block.data.CraftBlockData; 10 | 11 | public class FakeCraftBlock extends CraftBlock { 12 | 13 | private final BlockState originalState; 14 | private Material blockType; 15 | 16 | public FakeCraftBlock(Block block, Material material, BlockState originalState) { 17 | super(((CraftWorld) block.getWorld()).getHandle(), ((CraftBlock) block).getPosition()); 18 | this.blockType = material; 19 | this.originalState = originalState; 20 | } 21 | 22 | @Override 23 | public Material getType() { 24 | return blockType; 25 | } 26 | 27 | @Override 28 | public void setType(Material type) { 29 | this.blockType = type; 30 | super.setType(type); 31 | } 32 | 33 | @Override 34 | public BlockData getBlockData() { 35 | return CraftBlockData.newData(blockType, null); 36 | } 37 | 38 | @Override 39 | public BlockState getState() { 40 | return originalState; 41 | } 42 | 43 | } 44 | 45 | -------------------------------------------------------------------------------- /Hooks/FactionsX/src/main/java/com/bgsoftware/wildtools/hooks/FactionsProvider_FactionsX.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import com.bgsoftware.wildtools.WildToolsPlugin; 4 | import net.prosavage.factionsx.core.FPlayer; 5 | import net.prosavage.factionsx.core.Faction; 6 | import net.prosavage.factionsx.core.FactionTNTData; 7 | import net.prosavage.factionsx.manager.PlayerManager; 8 | import net.prosavage.factionsx.persist.TNTAddonData; 9 | import org.bukkit.entity.Player; 10 | 11 | public class FactionsProvider_FactionsX implements FactionsProvider { 12 | 13 | public FactionsProvider_FactionsX(){ 14 | WildToolsPlugin.log(" - Couldn't find any factions providers for tnt banks, using default one."); 15 | } 16 | 17 | @Override 18 | public int getTNTAmountFromBank(Player player) { 19 | FPlayer fPlayer = PlayerManager.INSTANCE.getFPlayer(player); 20 | Faction faction = fPlayer.getFaction(); 21 | return TNTAddonData.INSTANCE.getTntData().getTNTData(faction).getTntAmt(); 22 | } 23 | 24 | @Override 25 | public void takeTNTFromBank(Player player, int amount) { 26 | FPlayer fPlayer = PlayerManager.INSTANCE.getFPlayer(player); 27 | Faction faction = fPlayer.getFaction(); 28 | FactionTNTData.TNTData tntData = TNTAddonData.INSTANCE.getTntData().getTNTData(faction); 29 | tntData.setTntAmt(tntData.getTntAmt() - amount); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/events/MagnetWandUseEvent.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.events; 2 | 3 | import com.bgsoftware.wildtools.api.objects.tools.MagnetTool; 4 | import org.bukkit.entity.Item; 5 | import org.bukkit.entity.Player; 6 | import org.bukkit.event.HandlerList; 7 | 8 | import java.util.Collections; 9 | import java.util.List; 10 | 11 | /** 12 | * MagnetWandUseEvent is called when a magnet wand is used. 13 | */ 14 | public class MagnetWandUseEvent extends ToolUseEvent { 15 | 16 | private static final HandlerList HANDLERS = new HandlerList(); 17 | 18 | private final List items; 19 | 20 | /** 21 | * The constructor of the event. 22 | * @param player The player who used the wand. 23 | * @param tool The wand that was used. 24 | * @param items All the affected items by the wand. 25 | */ 26 | public MagnetWandUseEvent(Player player, MagnetTool tool, List items){ 27 | super(player, tool); 28 | this.items = Collections.unmodifiableList(items); 29 | } 30 | 31 | /** 32 | * Get all the affected items by the wand. 33 | */ 34 | public List getItems() { 35 | return items; 36 | } 37 | 38 | @Override 39 | public HandlerList getHandlers() { 40 | return HANDLERS; 41 | } 42 | 43 | public static HandlerList getHandlerList() { 44 | return HANDLERS; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/events/SortWandUseEvent.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.events; 2 | 3 | import com.bgsoftware.wildtools.api.objects.tools.SortTool; 4 | import org.bukkit.entity.Player; 5 | import org.bukkit.event.HandlerList; 6 | import org.bukkit.inventory.ItemStack; 7 | 8 | import java.util.Collections; 9 | import java.util.List; 10 | 11 | /** 12 | * SortWandUseEvent is called when a sort wand is used. 13 | */ 14 | public class SortWandUseEvent extends ToolUseEvent { 15 | 16 | private static final HandlerList HANDLERS = new HandlerList(); 17 | 18 | private final List items; 19 | 20 | /** 21 | * The constructor of the event. 22 | * @param player The player who used the wand. 23 | * @param tool The wand that was used. 24 | * @param items All the affected items by the wand. 25 | */ 26 | public SortWandUseEvent(Player player, SortTool tool, List items){ 27 | super(player, tool); 28 | this.items = Collections.unmodifiableList(items); 29 | } 30 | 31 | /** 32 | * Get all the affected items by the wand. 33 | */ 34 | public List getItems() { 35 | return items; 36 | } 37 | 38 | @Override 39 | public HandlerList getHandlers() { 40 | return HANDLERS; 41 | } 42 | 43 | public static HandlerList getHandlerList() { 44 | return HANDLERS; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Compiling settings 2 | # You can turn-off compiling of specific modules here by setting them to `false` 3 | nms.compile_v1_7=true 4 | nms.compile_v1_8=true 5 | nms.compile_v1_12=true 6 | nms.compile_v1_16=true 7 | nms.compile_v1_17=true 8 | nms.compile_v1_18=true 9 | nms.compile_v1_19=true 10 | nms.compile_v1_20=true 11 | nms.compile_v1_21=true 12 | hook.compile_chunkcollectors=true 13 | hook.compile_chunkhoppers=true 14 | hook.compile_cmi=true 15 | hook.compile_economyshopgui=true 16 | hook.compile_essentials215=true 17 | hook.compile_essentials216=true 18 | hook.compile_factionsuuid02=true 19 | hook.compile_factionsuuid05=true 20 | hook.compile_factionsx=true 21 | hook.compile_folia=true 22 | hook.compile_griefprevention=true 23 | hook.compile_guishop=true 24 | hook.compile_lands=true 25 | hook.compile_massivefactions=true 26 | hook.compile_mcmmo1=true 27 | hook.compile_mcmmo2=true 28 | hook.compile_mergedspawner=true 29 | hook.compile_newtshop=true 30 | hook.compile_quantumshop=true 31 | hook.compile_residence=true 32 | hook.compile_rosestacker=true 33 | hook.compile_savagefactions=true 34 | hook.compile_shopguiplus=true 35 | hook.compile_silkspawners_candc2=true 36 | hook.compile_silkspawners_timbru5=true 37 | hook.compile_silkspawners_timbru6=true 38 | hook.compile_supermobcoins=true 39 | hook.compile_towny=true 40 | hook.compile_vault=true 41 | hook.compile_villagers=true 42 | hook.compile_wildchests=true 43 | hook.compile_wildstacker=true -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/events/CannonWandUseEvent.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.events; 2 | 3 | import com.bgsoftware.wildtools.api.objects.tools.CannonTool; 4 | import org.bukkit.Location; 5 | import org.bukkit.entity.Player; 6 | import org.bukkit.event.HandlerList; 7 | 8 | import java.util.Collections; 9 | import java.util.List; 10 | 11 | /** 12 | * CannonWandUseEvent is called when a cannon wand is used. 13 | */ 14 | public class CannonWandUseEvent extends ToolUseEvent { 15 | 16 | private static final HandlerList HANDLERS = new HandlerList(); 17 | 18 | private final List blocks; 19 | 20 | /** 21 | * The constructor of the event. 22 | * @param player The player who used the wand. 23 | * @param tool The wand that was used. 24 | * @param blocks All the affected blocks by the wand. 25 | */ 26 | public CannonWandUseEvent(Player player, CannonTool tool, List blocks){ 27 | super(player, tool); 28 | this.blocks = Collections.unmodifiableList(blocks); 29 | } 30 | 31 | /** 32 | * Get all the affected blocks by the wand. 33 | */ 34 | public List getBlocks() { 35 | return blocks; 36 | } 37 | 38 | @Override 39 | public HandlerList getHandlers() { 40 | return HANDLERS; 41 | } 42 | 43 | public static HandlerList getHandlerList() { 44 | return HANDLERS; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/hooks/PricesProvider_ShopsBridgeWrapper.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import com.bgsoftware.common.shopsbridge.BulkTransaction; 4 | import com.bgsoftware.common.shopsbridge.IShopsBridge; 5 | import com.bgsoftware.common.shopsbridge.ShopsProvider; 6 | import com.bgsoftware.wildtools.WildToolsPlugin; 7 | import com.bgsoftware.wildtools.api.hooks.PricesProvider; 8 | import org.bukkit.entity.Player; 9 | import org.bukkit.inventory.ItemStack; 10 | 11 | public class PricesProvider_ShopsBridgeWrapper implements PricesProvider { 12 | 13 | private final IShopsBridge shopsBridge; 14 | private BulkTransaction bulkTransaction; 15 | 16 | public PricesProvider_ShopsBridgeWrapper(ShopsProvider shopsProvider, IShopsBridge shopsBridge) { 17 | WildToolsPlugin.log(" - Using " + shopsProvider.getPluginName() + " as PricesProvider."); 18 | this.shopsBridge = shopsBridge; 19 | } 20 | 21 | @Override 22 | public double getPrice(Player player, ItemStack itemStack) { 23 | return (this.bulkTransaction == null ? this.shopsBridge : this.bulkTransaction) 24 | .getSellPrice(player, itemStack).getPrice().doubleValue(); 25 | } 26 | 27 | public void startBulkTransaction() { 28 | this.bulkTransaction = this.shopsBridge.startBulkTransaction(); 29 | } 30 | 31 | public void stopBulkTransaction() { 32 | this.bulkTransaction = null; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /NMS/v1_17/src/main/java/com/bgsoftware/wildtools/nms/v1_17/tool/ToolItemStackImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_17.tool; 2 | 3 | import net.minecraft.nbt.CompoundTag; 4 | import net.minecraft.world.item.ItemStack; 5 | 6 | import java.util.function.Function; 7 | 8 | public class ToolItemStackImpl extends com.bgsoftware.wildtools.nms.v1_17.tool.AbstractToolItemStack { 9 | 10 | public ToolItemStackImpl(ItemStack nmsItem) { 11 | super(nmsItem); 12 | } 13 | 14 | @Override 15 | public void setTag(String key, int value) { 16 | this.nmsItem.getOrCreateTag().putInt(key, value); 17 | } 18 | 19 | @Override 20 | public void setTag(String key, String value) { 21 | this.nmsItem.getOrCreateTag().putString(key, value); 22 | } 23 | 24 | @Override 25 | public int getTag(String key, int def) { 26 | return getTagInternal(compoundTag -> 27 | compoundTag.contains(key, 3) ? compoundTag.getInt(key) : def, def); 28 | } 29 | 30 | @Override 31 | public String getTag(String key, String def) { 32 | return getTagInternal(compoundTag -> 33 | compoundTag.contains(key, 8) ? compoundTag.getString(key) : def, def); 34 | } 35 | 36 | private R getTagInternal(Function function, R def) { 37 | CompoundTag compoundTag = this.nmsItem.getTag(); 38 | return compoundTag == null ? def : function.apply(compoundTag); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /NMS/v1_19/src/main/java/com/bgsoftware/wildtools/nms/v1_19/tool/ToolItemStackImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_19.tool; 2 | 3 | import net.minecraft.nbt.CompoundTag; 4 | import net.minecraft.world.item.ItemStack; 5 | 6 | import java.util.function.Function; 7 | 8 | public class ToolItemStackImpl extends com.bgsoftware.wildtools.nms.v1_19.tool.AbstractToolItemStack { 9 | 10 | public ToolItemStackImpl(ItemStack nmsItem) { 11 | super(nmsItem); 12 | } 13 | 14 | @Override 15 | public void setTag(String key, int value) { 16 | this.nmsItem.getOrCreateTag().putInt(key, value); 17 | } 18 | 19 | @Override 20 | public void setTag(String key, String value) { 21 | this.nmsItem.getOrCreateTag().putString(key, value); 22 | } 23 | 24 | @Override 25 | public int getTag(String key, int def) { 26 | return getTagInternal(compoundTag -> 27 | compoundTag.contains(key, 3) ? compoundTag.getInt(key) : def, def); 28 | } 29 | 30 | @Override 31 | public String getTag(String key, String def) { 32 | return getTagInternal(compoundTag -> 33 | compoundTag.contains(key, 8) ? compoundTag.getString(key) : def, def); 34 | } 35 | 36 | private R getTagInternal(Function function, R def) { 37 | CompoundTag compoundTag = this.nmsItem.getTag(); 38 | return compoundTag == null ? def : function.apply(compoundTag); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /NMS/v1_20_3/src/main/java/com/bgsoftware/wildtools/nms/v1_20_3/tool/ToolItemStackImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_20_3.tool; 2 | 3 | import net.minecraft.nbt.CompoundTag; 4 | import net.minecraft.world.item.ItemStack; 5 | 6 | import java.util.function.Function; 7 | 8 | public class ToolItemStackImpl extends com.bgsoftware.wildtools.nms.v1_20_3.tool.AbstractToolItemStack { 9 | 10 | public ToolItemStackImpl(ItemStack nmsItem) { 11 | super(nmsItem); 12 | } 13 | 14 | @Override 15 | public void setTag(String key, int value) { 16 | this.nmsItem.getOrCreateTag().putInt(key, value); 17 | } 18 | 19 | @Override 20 | public void setTag(String key, String value) { 21 | this.nmsItem.getOrCreateTag().putString(key, value); 22 | } 23 | 24 | @Override 25 | public int getTag(String key, int def) { 26 | return getTagInternal(compoundTag -> 27 | compoundTag.contains(key, 3) ? compoundTag.getInt(key) : def, def); 28 | } 29 | 30 | @Override 31 | public String getTag(String key, String def) { 32 | return getTagInternal(compoundTag -> 33 | compoundTag.contains(key, 8) ? compoundTag.getString(key) : def, def); 34 | } 35 | 36 | private R getTagInternal(Function function, R def) { 37 | CompoundTag compoundTag = this.nmsItem.getTag(); 38 | return compoundTag == null ? def : function.apply(compoundTag); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/events/CraftingWandUseEvent.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.events; 2 | 3 | import com.bgsoftware.wildtools.api.objects.tools.CraftingTool; 4 | import org.bukkit.entity.Player; 5 | import org.bukkit.event.HandlerList; 6 | import org.bukkit.inventory.ItemStack; 7 | 8 | import java.util.Collections; 9 | import java.util.List; 10 | 11 | /** 12 | * CraftingWandUseEvent is called when a crafting wand is used. 13 | */ 14 | public class CraftingWandUseEvent extends ToolUseEvent { 15 | 16 | private static final HandlerList HANDLERS = new HandlerList(); 17 | 18 | private final List items; 19 | 20 | /** 21 | * The constructor of the event. 22 | * @param player The player who used the wand. 23 | * @param tool The wand that was used. 24 | * @param items All the affected items by the wand. 25 | */ 26 | public CraftingWandUseEvent(Player player, CraftingTool tool, List items){ 27 | super(player, tool); 28 | this.items = Collections.unmodifiableList(items); 29 | } 30 | 31 | /** 32 | * Get all the affected items by the wand. 33 | */ 34 | public List getItems() { 35 | return items; 36 | } 37 | 38 | @Override 39 | public HandlerList getHandlers() { 40 | return HANDLERS; 41 | } 42 | 43 | public static HandlerList getHandlerList() { 44 | return HANDLERS; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /NMS/Spigot-1_20_3/src/main/java/com/bgsoftware/wildtools/nms/v1_20_3/alogrithms/SpigotGlowEnchantment.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_20_3.alogrithms; 2 | 3 | import org.bukkit.NamespacedKey; 4 | import org.bukkit.enchantments.Enchantment; 5 | import org.bukkit.enchantments.EnchantmentTarget; 6 | 7 | public class SpigotGlowEnchantment extends Enchantment { 8 | 9 | private final NamespacedKey key; 10 | 11 | public SpigotGlowEnchantment(String name) { 12 | this.key = NamespacedKey.minecraft(name); 13 | } 14 | 15 | @Override 16 | public String getName() { 17 | return "WildToolsGlow"; 18 | } 19 | 20 | @Override 21 | public int getMaxLevel() { 22 | return 1; 23 | } 24 | 25 | @Override 26 | public int getStartLevel() { 27 | return 0; 28 | } 29 | 30 | @Override 31 | public EnchantmentTarget getItemTarget() { 32 | return null; 33 | } 34 | 35 | public boolean isTreasure() { 36 | return false; 37 | } 38 | 39 | public boolean isCursed() { 40 | return false; 41 | } 42 | 43 | @Override 44 | public boolean conflictsWith(Enchantment enchantment) { 45 | return false; 46 | } 47 | 48 | @Override 49 | public boolean canEnchantItem(org.bukkit.inventory.ItemStack itemStack) { 50 | return true; 51 | } 52 | 53 | @Override 54 | public NamespacedKey getKey() { 55 | return this.key; 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/events/LightningWandUseEvent.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.events; 2 | 3 | import com.bgsoftware.wildtools.api.objects.tools.LightningTool; 4 | import org.bukkit.entity.Creeper; 5 | import org.bukkit.entity.Player; 6 | import org.bukkit.event.HandlerList; 7 | 8 | import java.util.Collections; 9 | import java.util.List; 10 | 11 | /** 12 | * LightningWandUseEvent is called when a lightning wand is used. 13 | */ 14 | public class LightningWandUseEvent extends ToolUseEvent { 15 | 16 | private static final HandlerList HANDLERS = new HandlerList(); 17 | 18 | private final List creepers; 19 | 20 | /** 21 | * The constructor of the event. 22 | * @param player The player who used the wand. 23 | * @param tool The wand that was used. 24 | * @param creepers All the affected creepers by the wand. 25 | */ 26 | public LightningWandUseEvent(Player player, LightningTool tool, List creepers){ 27 | super(player, tool); 28 | this.creepers = Collections.unmodifiableList(creepers); 29 | } 30 | 31 | /** 32 | * Get all the affected creepers by the wand. 33 | */ 34 | public List getCreepers() { 35 | return creepers; 36 | } 37 | 38 | @Override 39 | public HandlerList getHandlers() { 40 | return HANDLERS; 41 | } 42 | 43 | public static HandlerList getHandlerList() { 44 | return HANDLERS; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/utils/math/Vector3.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.utils.math; 2 | 3 | import org.bukkit.Location; 4 | import org.bukkit.World; 5 | 6 | import java.util.Objects; 7 | 8 | public class Vector3 { 9 | 10 | private final int x; 11 | private final int y; 12 | private final int z; 13 | 14 | public static Vector3 of(Location location) { 15 | return new Vector3(location.getBlockX(), location.getBlockY(), location.getBlockZ()); 16 | } 17 | 18 | public Vector3(int x, int y, int z) { 19 | this.x = x; 20 | this.y = y; 21 | this.z = z; 22 | } 23 | 24 | public int getX() { 25 | return x; 26 | } 27 | 28 | public int getY() { 29 | return y; 30 | } 31 | 32 | public int getZ() { 33 | return z; 34 | } 35 | 36 | public Location toLocation(World world) { 37 | return new Location(world, this.x, this.y, this.z); 38 | } 39 | 40 | @Override 41 | public boolean equals(Object o) { 42 | if (this == o) return true; 43 | if (o == null || getClass() != o.getClass()) return false; 44 | Vector3 that = (Vector3) o; 45 | return x == that.x && y == that.y && z == that.z; 46 | } 47 | 48 | @Override 49 | public int hashCode() { 50 | return Objects.hash(x, y, z); 51 | } 52 | 53 | @Override 54 | public String toString() { 55 | return "Vector3{" + x + ", " + y + ", " + z + "}"; 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/utils/inventory/InventoryUtils.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.utils.inventory; 2 | 3 | import org.bukkit.inventory.Inventory; 4 | import org.bukkit.inventory.ItemStack; 5 | 6 | public class InventoryUtils { 7 | 8 | public static int countItems(Inventory inventory, ItemStack itemStack){ 9 | int amount = 0; 10 | 11 | if(itemStack == null) 12 | return amount; 13 | 14 | ItemStack[] contents = inventory.getContents(); 15 | 16 | for(int i = 0; i < 36; i++){ 17 | if (itemStack.isSimilar(contents[i])) 18 | amount += contents[i].getAmount(); 19 | } 20 | 21 | if(contents.length == 41 && itemStack.isSimilar(contents[40])) 22 | amount += contents[40].getAmount(); 23 | 24 | return amount; 25 | } 26 | 27 | public static void removeItem(Inventory inventory, ItemStack itemStack){ 28 | ItemStack additionalItem = inventory.removeItem(itemStack).get(0); 29 | try { 30 | ItemStack offHand = inventory.getItem(40); 31 | if (additionalItem != null && additionalItem.isSimilar(offHand)) { 32 | offHand.setAmount(offHand.getAmount() - additionalItem.getAmount()); 33 | if (offHand.getAmount() <= 0) 34 | inventory.setItem(40, null); 35 | else 36 | inventory.setItem(40, offHand); 37 | } 38 | }catch(Exception ignored){ } 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /Hooks/SilkSpawners_Timbru6/src/main/java/com/bgsoftware/wildtools/hooks/DropsProvider_SilkSpawners_Timbru6.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import com.bgsoftware.wildtools.api.hooks.DropsProvider; 4 | import de.dustplanet.util.SilkUtil; 5 | import org.bukkit.block.Block; 6 | import org.bukkit.block.CreatureSpawner; 7 | import org.bukkit.entity.Player; 8 | import org.bukkit.inventory.ItemStack; 9 | 10 | import java.util.Collections; 11 | import java.util.LinkedList; 12 | import java.util.List; 13 | 14 | public class DropsProvider_SilkSpawners_Timbru6 implements DropsProvider { 15 | 16 | private final SilkUtil silkUtil; 17 | 18 | public DropsProvider_SilkSpawners_Timbru6() { 19 | silkUtil = SilkUtil.hookIntoSilkSpanwers(); 20 | } 21 | 22 | @Override 23 | public List getBlockDrops(Player player, Block block) { 24 | if (!(block.getState() instanceof CreatureSpawner)) 25 | return null; 26 | 27 | String entityId = silkUtil.getSpawnerEntityID(block); 28 | if (entityId == null) 29 | entityId = silkUtil.getDefaultEntityID(); 30 | 31 | String mobName = silkUtil.getCreatureName(entityId).toLowerCase().replace(" ", ""); 32 | 33 | ItemStack dropItem = silkUtil.newSpawnerItem(entityId, silkUtil.getCustomSpawnerName(mobName), 1, false); 34 | 35 | return Collections.singletonList(dropItem); 36 | } 37 | 38 | @Override 39 | public boolean isSpawnersOnly() { 40 | return true; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /Hooks/McMMO2/src/main/java/com/bgsoftware/wildtools/hooks/DropsProvider_mcMMO2.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import com.bgsoftware.wildtools.WildToolsPlugin; 4 | import com.bgsoftware.wildtools.api.hooks.DropsProvider; 5 | import com.bgsoftware.wildtools.utils.Materials; 6 | import com.gmail.nossr50.datatypes.skills.PrimarySkillType; 7 | import com.gmail.nossr50.datatypes.skills.SubSkillType; 8 | import com.gmail.nossr50.util.BlockUtils; 9 | import org.bukkit.block.Block; 10 | import org.bukkit.entity.Player; 11 | import org.bukkit.inventory.ItemStack; 12 | 13 | import java.util.List; 14 | 15 | public class DropsProvider_mcMMO2 implements DropsProvider { 16 | 17 | private static final WildToolsPlugin plugin = WildToolsPlugin.getPlugin(); 18 | 19 | @Override 20 | public List getBlockDrops(Player player, Block block) { 21 | if (!Materials.isCrop(block.getType()) || !shouldBonusDrops(player, block)) 22 | return null; 23 | 24 | List drops = plugin.getNMSWorld().getBlockDrops(player, block, false); 25 | drops.forEach(itemStack -> itemStack.setAmount(itemStack.getAmount() * 2)); 26 | return drops; 27 | } 28 | 29 | @Override 30 | public boolean isSpawnersOnly() { 31 | return false; 32 | } 33 | 34 | private boolean shouldBonusDrops(Player player, Block block) { 35 | return BlockUtils.checkDoubleDrops(player, block.getState(), PrimarySkillType.HERBALISM, SubSkillType.HERBALISM_DOUBLE_DROPS); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /NMS/v1_18/src/main/java/com/bgsoftware/wildtools/nms/v1_18/tool/ToolItemStackImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_18.tool; 2 | 3 | import com.bgsoftware.wildtools.utils.items.ToolItemStack; 4 | import net.minecraft.nbt.CompoundTag; 5 | import net.minecraft.world.item.ItemStack; 6 | 7 | import java.util.function.Function; 8 | 9 | public class ToolItemStackImpl extends com.bgsoftware.wildtools.nms.v1_18.tool.AbstractToolItemStack { 10 | 11 | public ToolItemStackImpl(ItemStack nmsItem) { 12 | super(nmsItem); 13 | } 14 | 15 | @Override 16 | public void setTag(String key, int value) { 17 | this.nmsItem.getOrCreateTag().putInt(key, value); 18 | } 19 | 20 | @Override 21 | public void setTag(String key, String value) { 22 | this.nmsItem.getOrCreateTag().putString(key, value); 23 | } 24 | 25 | @Override 26 | public int getTag(String key, int def) { 27 | return getTagInternal(compoundTag -> 28 | compoundTag.contains(key, 3) ? compoundTag.getInt(key) : def, def); 29 | } 30 | 31 | @Override 32 | public String getTag(String key, String def) { 33 | return getTagInternal(compoundTag -> 34 | compoundTag.contains(key, 8) ? compoundTag.getString(key) : def, def); 35 | } 36 | 37 | private R getTagInternal(Function function, R def) { 38 | CompoundTag compoundTag = this.nmsItem.getTag(); 39 | return compoundTag == null ? def : function.apply(compoundTag); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | gradlePluginPortal() 4 | maven { url "https://repo.papermc.io/repository/maven-public/" } 5 | } 6 | } 7 | 8 | rootProject.name = 'WildTools' 9 | 10 | include 'API' 11 | include 'Hooks' 12 | include 'Hooks:ChunkCollectors' 13 | include 'Hooks:ChunkHoppers' 14 | include 'Hooks:FactionsUUID' 15 | include 'Hooks:FactionsX' 16 | include 'Hooks:Folia' 17 | include 'Hooks:GriefPrevention' 18 | include 'Hooks:Lands' 19 | include 'Hooks:MassiveFactions' 20 | include 'Hooks:McMMO1' 21 | include 'Hooks:McMMO2' 22 | include 'Hooks:MergedSpawner' 23 | include 'Hooks:Residence' 24 | include 'Hooks:RoseStacker' 25 | include 'Hooks:SavageFactions' 26 | include 'Hooks:SilkSpawners_CandC2' 27 | include 'Hooks:SilkSpawners_Timbru5' 28 | include 'Hooks:SilkSpawners_Timbru6' 29 | include 'Hooks:SuperMobCoins' 30 | include 'Hooks:Towny' 31 | include 'Hooks:Vault' 32 | include 'Hooks:Villagers' 33 | include 'Hooks:WildChests' 34 | include 'Hooks:WildStacker' 35 | include 'NMS' 36 | include 'NMS:Spigot' 37 | include 'NMS:Spigot-1_20_3' 38 | include 'NMS:Paper' 39 | include 'NMS:Paper-1_20_3' 40 | include 'NMS:v1_7_R4' 41 | include 'NMS:v1_8_R3' 42 | include 'NMS:v1_12_R1' 43 | include 'NMS:v1_16_R3' 44 | include 'NMS:v1_17' 45 | include 'NMS:v1_18' 46 | include 'NMS:v1_19' 47 | include 'NMS:v1_20_3' 48 | include 'NMS:v1_20_4' 49 | include 'NMS:v1_21' 50 | include 'NMS:v1_21_3' 51 | include 'NMS:v1_21_4' 52 | include 'NMS:v1_21_5' 53 | include 'NMS:v1_21_7' 54 | include 'NMS:v1_21_9' 55 | include 'NMS:v1_21_10' -------------------------------------------------------------------------------- /Hooks/SilkSpawners_Timbru5/src/main/java/com/bgsoftware/wildtools/hooks/DropsProvider_SilkSpawners_Timbru5.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import com.bgsoftware.wildtools.api.hooks.DropsProvider; 4 | import de.dustplanet.util.SilkUtil; 5 | import org.bukkit.block.Block; 6 | import org.bukkit.block.CreatureSpawner; 7 | import org.bukkit.entity.Player; 8 | import org.bukkit.inventory.ItemStack; 9 | 10 | import java.util.ArrayList; 11 | import java.util.Collections; 12 | import java.util.LinkedList; 13 | import java.util.List; 14 | 15 | public class DropsProvider_SilkSpawners_Timbru5 implements DropsProvider { 16 | 17 | private final SilkUtil silkUtil; 18 | 19 | public DropsProvider_SilkSpawners_Timbru5() { 20 | silkUtil = SilkUtil.hookIntoSilkSpanwers(); 21 | } 22 | 23 | @Override 24 | public List getBlockDrops(Player player, Block block) { 25 | if (!(block.getState() instanceof CreatureSpawner)) 26 | return null; 27 | 28 | silkUtil.getSpawnerEntityID(block); 29 | 30 | short entityId = silkUtil.getSpawnerEntityID(block); 31 | if (entityId == 0) 32 | entityId = silkUtil.getDefaultEntityID(); 33 | 34 | String mobName = silkUtil.getCreatureName(entityId).toLowerCase().replace(" ", ""); 35 | 36 | ItemStack dropItem = silkUtil.newSpawnerItem(entityId, silkUtil.getCustomSpawnerName(mobName), 1, false); 37 | 38 | return Collections.singletonList(dropItem); 39 | } 40 | 41 | @Override 42 | public boolean isSpawnersOnly() { 43 | return true; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /Hooks/WildStacker/src/main/java/com/bgsoftware/wildtools/hooks/DropsProvider_WildStacker.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import com.bgsoftware.wildstacker.api.WildStackerAPI; 4 | import com.bgsoftware.wildstacker.api.objects.StackedSpawner; 5 | import com.bgsoftware.wildtools.api.hooks.DropsProvider; 6 | import org.bukkit.block.Block; 7 | import org.bukkit.block.CreatureSpawner; 8 | import org.bukkit.entity.Player; 9 | import org.bukkit.inventory.ItemStack; 10 | 11 | import java.util.Collections; 12 | import java.util.List; 13 | 14 | public class DropsProvider_WildStacker implements DropsProvider { 15 | 16 | @Override 17 | public List getBlockDrops(Player player, Block block) { 18 | if (!(block.getState() instanceof CreatureSpawner)) 19 | return null; 20 | 21 | StackedSpawner stackedSpawner = WildStackerAPI.getStackedSpawner((CreatureSpawner) block.getState()); 22 | 23 | int spawnerStackAmount = stackedSpawner.getStackAmount(); 24 | 25 | ItemStack dropItem; 26 | try { 27 | dropItem = stackedSpawner.getDropItem(); 28 | } catch (Throwable ex) { 29 | dropItem = DropsProviders_Default.getSpawnerItem((CreatureSpawner) block.getState()); 30 | dropItem.setAmount(spawnerStackAmount); 31 | } 32 | 33 | // We want to unstack the spawner when getting drops from stacked spawners. 34 | stackedSpawner.runUnstack(spawnerStackAmount); 35 | 36 | return Collections.singletonList(dropItem); 37 | } 38 | 39 | @Override 40 | public boolean isSpawnersOnly() { 41 | return true; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/command/commands/CommandSettings.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.command.commands; 2 | 3 | import com.bgsoftware.wildtools.command.ICommand; 4 | import org.bukkit.ChatColor; 5 | import org.bukkit.command.CommandSender; 6 | import org.bukkit.entity.Player; 7 | import com.bgsoftware.wildtools.WildToolsPlugin; 8 | 9 | import java.util.List; 10 | 11 | public class CommandSettings implements ICommand { 12 | 13 | @Override 14 | public String getLabel() { 15 | return "settings"; 16 | } 17 | 18 | @Override 19 | public String getUsage() { 20 | return "tools settings"; 21 | } 22 | 23 | @Override 24 | public String getPermission() { 25 | return "wildtools.settings"; 26 | } 27 | 28 | @Override 29 | public String getDescription() { 30 | return "Open settings editor."; 31 | } 32 | 33 | @Override 34 | public int getMinArgs() { 35 | return 1; 36 | } 37 | 38 | @Override 39 | public int getMaxArgs() { 40 | return 1; 41 | } 42 | 43 | @Override 44 | public void run(WildToolsPlugin plugin, CommandSender sender, String[] args) { 45 | if(!(sender instanceof Player)){ 46 | sender.sendMessage(ChatColor.RED + "Only players can perform this command."); 47 | return; 48 | } 49 | 50 | Player player = (Player) sender; 51 | 52 | player.openInventory(plugin.getEditor().getSettingsEditor()); 53 | } 54 | 55 | @Override 56 | public List tabComplete(WildToolsPlugin plugin, CommandSender sender, String[] args) { 57 | return null; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/hooks/DropsProviders_Default.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import com.bgsoftware.wildtools.api.hooks.DropsProvider; 4 | import com.bgsoftware.wildtools.utils.Materials; 5 | import org.bukkit.block.Block; 6 | import org.bukkit.block.CreatureSpawner; 7 | import org.bukkit.entity.Player; 8 | import org.bukkit.inventory.ItemStack; 9 | import org.bukkit.inventory.meta.BlockStateMeta; 10 | 11 | import java.util.Collections; 12 | import java.util.List; 13 | 14 | public class DropsProviders_Default implements DropsProvider { 15 | 16 | @Override 17 | public List getBlockDrops(Player player, Block block) { 18 | if (!(block.getState() instanceof CreatureSpawner)) 19 | return null; 20 | 21 | ItemStack dropItem = getSpawnerItem((CreatureSpawner) block.getState()); 22 | 23 | return Collections.singletonList(dropItem); 24 | } 25 | 26 | @Override 27 | public boolean isSpawnersOnly() { 28 | return true; 29 | } 30 | 31 | public static ItemStack getSpawnerItem(CreatureSpawner creatureSpawner) { 32 | ItemStack itemStack = new ItemStack(Materials.SPAWNER.toBukkitType()); 33 | 34 | try { 35 | BlockStateMeta blockStateMeta = (BlockStateMeta) itemStack.getItemMeta(); 36 | blockStateMeta.setBlockState(creatureSpawner); 37 | itemStack.setItemMeta(blockStateMeta); 38 | } catch (Throwable ex) { 39 | //noinspection deprecation 40 | itemStack.setDurability(creatureSpawner.getSpawnedType().getTypeId()); 41 | } 42 | 43 | return itemStack; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /NMS/build.gradle: -------------------------------------------------------------------------------- 1 | group 'NMS' 2 | 3 | subprojects { 4 | def generatedSrcDir = file("$buildDir/generated/sources/nms") 5 | 6 | task generateNmsSources { 7 | doLast { 8 | delete generatedSrcDir 9 | 10 | generatedSrcDir.mkdirs() 11 | 12 | def props = new Properties() 13 | def propertiesFile = file("$projectDir/properties") 14 | if (!propertiesFile.exists()) { 15 | return 16 | } 17 | 18 | propertiesFile.withInputStream { stream -> 19 | props.load(stream) 20 | } 21 | 22 | def templatesDir = file("${rootDir}/NMS/src/main/templates/") 23 | def templates = fileTree(templatesDir) { 24 | include '**/*.template' 25 | } 26 | 27 | templates.each { File templateFile -> 28 | def relativePath = templatesDir.toPath().relativize(templateFile.toPath()).toString() 29 | def outputFile = new File(generatedSrcDir, relativePath.replace('.template', '')) 30 | outputFile.parentFile.mkdirs() 31 | 32 | def templateText = templateFile.text 33 | props.each { k, v -> 34 | templateText = templateText.replace("\${${k}}", v) 35 | } 36 | outputFile.text = templateText 37 | println "Generated ${outputFile}" 38 | } 39 | 40 | } 41 | } 42 | 43 | sourceSets { 44 | main { 45 | java { 46 | srcDirs = ['src/main/java', generatedSrcDir] 47 | } 48 | } 49 | } 50 | 51 | compileJava.dependsOn(generateNmsSources) 52 | } -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/utils/ServerVersion.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.utils; 2 | 3 | import org.bukkit.Bukkit; 4 | 5 | public enum ServerVersion { 6 | 7 | v1_7(17), 8 | v1_8(18), 9 | v1_9(19), 10 | v1_10(110), 11 | v1_11(111), 12 | v1_12(112), 13 | v1_13(113), 14 | v1_14(114), 15 | v1_15(115), 16 | v1_16(116), 17 | v1_17(117), 18 | v1_18(118), 19 | v1_19(119), 20 | v1_20(120), 21 | v1_21(121); 22 | 23 | private static final ServerVersion currentVersion; 24 | private static final String bukkitVersion; 25 | private static final boolean legacy; 26 | 27 | static { 28 | bukkitVersion = Bukkit.getBukkitVersion().split("-")[0]; 29 | String[] sections = bukkitVersion.split("\\."); 30 | currentVersion = ServerVersion.valueOf("v" + sections[0] + "_" + sections[1]); 31 | legacy = isLessThan(ServerVersion.v1_13); 32 | } 33 | 34 | private final int code; 35 | 36 | ServerVersion(int code) { 37 | this.code = code; 38 | } 39 | 40 | 41 | public static boolean isAtLeast(ServerVersion serverVersion) { 42 | return currentVersion.code >= serverVersion.code; 43 | } 44 | 45 | public static boolean isLessThan(ServerVersion serverVersion) { 46 | return currentVersion.code < serverVersion.code; 47 | } 48 | 49 | public static boolean isEquals(ServerVersion serverVersion) { 50 | return currentVersion.code == serverVersion.code; 51 | } 52 | 53 | public static boolean isLegacy() { 54 | return legacy; 55 | } 56 | 57 | public static String getBukkitVersion() { 58 | return bukkitVersion; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/events/CrowbarWandUseEvent.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.events; 2 | 3 | import com.bgsoftware.wildtools.api.objects.tools.CrowbarTool; 4 | import org.bukkit.block.Block; 5 | import org.bukkit.entity.Player; 6 | import org.bukkit.event.Cancellable; 7 | import org.bukkit.event.HandlerList; 8 | 9 | /** 10 | * CrowbarWandUseEvent is called when a crowbar wand is used. 11 | */ 12 | public class CrowbarWandUseEvent extends ToolUseEvent implements Cancellable { 13 | 14 | private static final HandlerList HANDLERS = new HandlerList(); 15 | 16 | private final Block affectedBlock; 17 | 18 | private boolean cancelled = false; 19 | 20 | /** 21 | * The constructor of the event. 22 | * @param player The player who used the wand. 23 | * @param tool The wand that was used. 24 | * @param affectedBlock The affected block by the wand. 25 | */ 26 | public CrowbarWandUseEvent(Player player, CrowbarTool tool, Block affectedBlock){ 27 | super(player, tool); 28 | this.affectedBlock = affectedBlock; 29 | } 30 | 31 | /** 32 | * Get the affected block by the wand. 33 | */ 34 | public Block getBlock() { 35 | return affectedBlock; 36 | } 37 | 38 | @Override 39 | public boolean isCancelled() { 40 | return cancelled; 41 | } 42 | 43 | @Override 44 | public void setCancelled(boolean cancelled) { 45 | this.cancelled = cancelled; 46 | } 47 | 48 | @Override 49 | public HandlerList getHandlers() { 50 | return HANDLERS; 51 | } 52 | 53 | public static HandlerList getHandlerList() { 54 | return HANDLERS; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /Hooks/RoseStacker/src/main/java/com/bgsoftware/wildtools/hooks/DropsProvider_RoseStacker.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import com.bgsoftware.wildtools.api.hooks.DropsProvider; 4 | import dev.rosewood.rosestacker.api.RoseStackerAPI; 5 | import dev.rosewood.rosestacker.stack.StackedSpawner; 6 | import dev.rosewood.rosestacker.utils.ItemUtils; 7 | import org.bukkit.block.Block; 8 | import org.bukkit.block.CreatureSpawner; 9 | import org.bukkit.entity.Player; 10 | import org.bukkit.inventory.ItemStack; 11 | 12 | import java.util.ArrayList; 13 | import java.util.Collections; 14 | import java.util.LinkedList; 15 | import java.util.List; 16 | 17 | public class DropsProvider_RoseStacker implements DropsProvider { 18 | 19 | @Override 20 | public List getBlockDrops(Player player, Block block) { 21 | if (!(block.getState() instanceof CreatureSpawner)) 22 | return null; 23 | 24 | ItemStack dropItem; 25 | StackedSpawner stackedSpawner = RoseStackerAPI.getInstance().getStackedSpawner(block); 26 | 27 | if (stackedSpawner != null) { 28 | dropItem = ItemUtils.getSpawnerAsStackedItemStack(stackedSpawner.getSpawner().getSpawnedType(), stackedSpawner.getStackSize()); 29 | stackedSpawner.setStackSize(0); 30 | stackedSpawner.updateDisplay(); 31 | RoseStackerAPI.getInstance().removeSpawnerStack(stackedSpawner); 32 | } else { 33 | dropItem = DropsProviders_Default.getSpawnerItem((CreatureSpawner) block.getState()); 34 | } 35 | 36 | return Collections.singletonList(dropItem); 37 | } 38 | 39 | @Override 40 | public boolean isSpawnersOnly() { 41 | return true; 42 | } 43 | } -------------------------------------------------------------------------------- /NMS/Spigot/src/main/java/com/bgsoftware/wildtools/nms/recipe/AdvancedRecipeClassImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.recipe; 2 | 3 | import com.bgsoftware.common.reflection.ReflectField; 4 | import com.bgsoftware.wildtools.WildToolsPlugin; 5 | import com.bgsoftware.wildtools.recipes.AdvancedShapedRecipe; 6 | import org.bukkit.NamespacedKey; 7 | import org.bukkit.inventory.RecipeChoice; 8 | import org.bukkit.inventory.ShapedRecipe; 9 | 10 | import java.util.Map; 11 | 12 | public class AdvancedRecipeClassImpl extends ShapedRecipe implements AdvancedShapedRecipe { 13 | 14 | private static final WildToolsPlugin plugin = WildToolsPlugin.getPlugin(); 15 | 16 | private static final ReflectField> INGREDIENTS_FIELD = new ReflectField<>( 17 | ShapedRecipe.class, Map.class, "ingredients"); 18 | 19 | private Map ingredients; 20 | 21 | public AdvancedRecipeClassImpl(String toolName, org.bukkit.inventory.ItemStack result) { 22 | super(new NamespacedKey(plugin, "recipe_" + toolName), result); 23 | updateIngredients(); 24 | } 25 | 26 | @Override 27 | public AdvancedRecipeClassImpl shape(String... shape) { 28 | super.shape(shape); 29 | updateIngredients(); 30 | return this; 31 | } 32 | 33 | @Override 34 | public AdvancedRecipeClassImpl setIngredient(char key, org.bukkit.inventory.ItemStack itemStack) { 35 | this.ingredients.put(key, new RecipeChoice.MaterialChoice(itemStack.getType())); 36 | return this; 37 | } 38 | 39 | @Override 40 | public ShapedRecipe toRecipe() { 41 | return this; 42 | } 43 | 44 | private void updateIngredients() { 45 | ingredients = INGREDIENTS_FIELD.get(this); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/events/CuboidWandUseEvent.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.events; 2 | 3 | import com.bgsoftware.wildtools.api.objects.tools.CuboidTool; 4 | import org.bukkit.Location; 5 | import org.bukkit.entity.Player; 6 | import org.bukkit.event.Cancellable; 7 | import org.bukkit.event.HandlerList; 8 | 9 | import java.util.Collections; 10 | import java.util.List; 11 | 12 | /** 13 | * CuboidWandUseEvent is called when a cuboid wand is used. 14 | */ 15 | public class CuboidWandUseEvent extends ToolUseEvent implements Cancellable { 16 | 17 | private static final HandlerList HANDLERS = new HandlerList(); 18 | 19 | private final List blocks; 20 | 21 | private boolean cancelled = false; 22 | 23 | /** 24 | * The constructor of the event. 25 | * @param player The player who used the wand. 26 | * @param tool The wand that was used. 27 | * @param blocks All the affected blocks by the wand. 28 | */ 29 | public CuboidWandUseEvent(Player player, CuboidTool tool, List blocks){ 30 | super(player, tool); 31 | this.blocks = Collections.unmodifiableList(blocks); 32 | } 33 | 34 | /** 35 | * Get all the affected blocks by the wand. 36 | */ 37 | public List getBlocks() { 38 | return blocks; 39 | } 40 | 41 | @Override 42 | public boolean isCancelled() { 43 | return cancelled; 44 | } 45 | 46 | @Override 47 | public void setCancelled(boolean cancelled) { 48 | this.cancelled = cancelled; 49 | } 50 | 51 | @Override 52 | public HandlerList getHandlers() { 53 | return HANDLERS; 54 | } 55 | 56 | public static HandlerList getHandlerList() { 57 | return HANDLERS; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/events/DrainWandUseEvent.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.events; 2 | 3 | import com.bgsoftware.wildtools.api.objects.tools.DrainTool; 4 | import org.bukkit.Location; 5 | import org.bukkit.entity.Player; 6 | import org.bukkit.event.Cancellable; 7 | import org.bukkit.event.HandlerList; 8 | 9 | import java.util.Collections; 10 | import java.util.List; 11 | 12 | /** 13 | * DrainWandUseEvent is called when a drain wand is used. 14 | */ 15 | public class DrainWandUseEvent extends ToolUseEvent implements Cancellable { 16 | 17 | private static final HandlerList HANDLERS = new HandlerList(); 18 | 19 | private final List blocks; 20 | 21 | private boolean cancelled = false; 22 | 23 | /** 24 | * The constructor of the event. 25 | * @param player The player who used the wand. 26 | * @param tool The wand that was used. 27 | * @param blocks All the affected blocks by the wand. 28 | */ 29 | public DrainWandUseEvent(Player player, DrainTool tool, List blocks){ 30 | super(player, tool); 31 | this.blocks = Collections.unmodifiableList(blocks); 32 | } 33 | 34 | /** 35 | * Get all the affected blocks by the wand. 36 | */ 37 | public List getBlocks() { 38 | return blocks; 39 | } 40 | 41 | @Override 42 | public boolean isCancelled() { 43 | return this.cancelled; 44 | } 45 | 46 | @Override 47 | public void setCancelled(boolean cancelled) { 48 | this.cancelled = cancelled; 49 | } 50 | 51 | @Override 52 | public HandlerList getHandlers() { 53 | return HANDLERS; 54 | } 55 | 56 | public static HandlerList getHandlerList() { 57 | return HANDLERS; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/events/IceWandUseEvent.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.events; 2 | 3 | import com.bgsoftware.wildtools.api.objects.tools.IceTool; 4 | import org.bukkit.Location; 5 | import org.bukkit.entity.Player; 6 | import org.bukkit.event.Cancellable; 7 | import org.bukkit.event.HandlerList; 8 | 9 | import java.util.Collections; 10 | import java.util.List; 11 | 12 | /** 13 | * IceWandUseEvent is called when an ice wand is used. 14 | */ 15 | public class IceWandUseEvent extends ToolUseEvent implements Cancellable { 16 | 17 | private static final HandlerList HANDLERS = new HandlerList(); 18 | 19 | private final List blocks; 20 | 21 | private boolean cancelled = false; 22 | 23 | /** 24 | * The constructor of the event. 25 | * 26 | * @param player The player who used the wand. 27 | * @param tool The wand that was used. 28 | * @param blocks All the affected blocks by the wand. 29 | */ 30 | public IceWandUseEvent(Player player, IceTool tool, List blocks) { 31 | super(player, tool); 32 | this.blocks = Collections.unmodifiableList(blocks); 33 | } 34 | 35 | /** 36 | * Get all the affected blocks by the wand. 37 | */ 38 | public List getBlocks() { 39 | return blocks; 40 | } 41 | 42 | @Override 43 | public boolean isCancelled() { 44 | return this.cancelled; 45 | } 46 | 47 | @Override 48 | public void setCancelled(boolean cancelled) { 49 | this.cancelled = cancelled; 50 | } 51 | 52 | @Override 53 | public HandlerList getHandlers() { 54 | return HANDLERS; 55 | } 56 | 57 | public static HandlerList getHandlerList() { 58 | return HANDLERS; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/events/PillarWandUseEvent.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.events; 2 | 3 | import com.bgsoftware.wildtools.api.objects.tools.PillarTool; 4 | import org.bukkit.Location; 5 | import org.bukkit.entity.Player; 6 | import org.bukkit.event.Cancellable; 7 | import org.bukkit.event.HandlerList; 8 | 9 | import java.util.Collections; 10 | import java.util.List; 11 | 12 | /** 13 | * PillarWandUseEvent is called when a pillar wand is used. 14 | */ 15 | public class PillarWandUseEvent extends ToolUseEvent implements Cancellable { 16 | 17 | private static final HandlerList HANDLERS = new HandlerList(); 18 | 19 | private final List blocks; 20 | 21 | private boolean cancelled = false; 22 | 23 | /** 24 | * The constructor of the event. 25 | * @param player The player who used the wand. 26 | * @param tool The wand that was used. 27 | * @param blocks All the affected blocks by the wand. 28 | */ 29 | public PillarWandUseEvent(Player player, PillarTool tool, List blocks){ 30 | super(player, tool); 31 | this.blocks = Collections.unmodifiableList(blocks); 32 | } 33 | 34 | /** 35 | * Get all the affected blocks by the wand. 36 | */ 37 | public List getBlocks() { 38 | return blocks; 39 | } 40 | 41 | @Override 42 | public boolean isCancelled() { 43 | return this.cancelled; 44 | } 45 | 46 | @Override 47 | public void setCancelled(boolean cancelled) { 48 | this.cancelled = cancelled; 49 | } 50 | 51 | @Override 52 | public HandlerList getHandlers() { 53 | return HANDLERS; 54 | } 55 | 56 | public static HandlerList getHandlerList() { 57 | return HANDLERS; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/main/resources/plugin.yml: -------------------------------------------------------------------------------- 1 | name: WildTools 2 | version: ${project.version} 3 | main: com.bgsoftware.wildtools.WildToolsPlugin 4 | 5 | description: Configurable trench picks, tray picks, sell-wands, harvester-hoes and more! 6 | website: https://bg-software.com/ 7 | api-version: 1.13 8 | author: Ome_R 9 | folia-supported: true 10 | 11 | # Custom section used by DependenciesManager, which replaces softdepend. 12 | class-depends: 13 | - ChunkCollectors 14 | - ChunkHoppers 15 | - Factions 16 | - FactionsX 17 | - GriefPrevention 18 | - Lands 19 | - MassiveCore 20 | - mcMMO 21 | - Residence 22 | - RoseStacker 23 | - SilkSpawners 24 | - SuperMobCoins 25 | - Towny 26 | - Vault 27 | - Villages 28 | - WildChests 29 | - WildStacker 30 | 31 | commands: 32 | tools: 33 | description: List of all wildtools command 34 | 35 | permissions: 36 | wildtools.*: 37 | description: Gives access to all the command. 38 | default: op 39 | children: 40 | wildtools.use: true 41 | wildtools.give: true 42 | wildtools.info: true 43 | wildtools.list: true 44 | wildtools.reload: true 45 | wildtools.sellmode: true 46 | wildtools.settings: true 47 | wildtools.use: 48 | description: Gives access to use the custom tools. 49 | default: true 50 | wildtools.give: 51 | description: Gives access to give tools to other players. 52 | wildtools.info: 53 | description: Gives access to get information about tools. 54 | wildtools.list: 55 | description: Gives access to see all tools. 56 | wildtools.reload: 57 | description: Gives access to reload all configuration files. 58 | wildtools.sellmode: 59 | description: Gives access to use harvester sell mode. 60 | wildtools.settings: 61 | description: Gives access to use settings editor. -------------------------------------------------------------------------------- /NMS/Spigot-1_20_3/src/main/java/com/bgsoftware/wildtools/nms/v1_20_3/recipe/AdvancedRecipeClassImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_20_3.recipe; 2 | 3 | import com.bgsoftware.common.reflection.ReflectField; 4 | import com.bgsoftware.wildtools.WildToolsPlugin; 5 | import com.bgsoftware.wildtools.recipes.AdvancedShapedRecipe; 6 | import org.bukkit.NamespacedKey; 7 | import org.bukkit.inventory.RecipeChoice; 8 | import org.bukkit.inventory.ShapedRecipe; 9 | 10 | import java.util.Map; 11 | 12 | public class AdvancedRecipeClassImpl extends ShapedRecipe implements AdvancedShapedRecipe { 13 | 14 | private static final WildToolsPlugin plugin = WildToolsPlugin.getPlugin(); 15 | 16 | private static final ReflectField> INGREDIENTS_FIELD = new ReflectField<>( 17 | ShapedRecipe.class, Map.class, "ingredients"); 18 | 19 | private Map ingredients; 20 | 21 | public AdvancedRecipeClassImpl(String toolName, org.bukkit.inventory.ItemStack result) { 22 | super(new NamespacedKey(plugin, "recipe_" + toolName), result); 23 | updateIngredients(); 24 | } 25 | 26 | @Override 27 | public AdvancedRecipeClassImpl shape(String... shape) { 28 | super.shape(shape); 29 | updateIngredients(); 30 | return this; 31 | } 32 | 33 | @Override 34 | public AdvancedRecipeClassImpl setIngredient(char key, org.bukkit.inventory.ItemStack itemStack) { 35 | this.ingredients.put(key, new RecipeChoice.MaterialChoice(itemStack.getType())); 36 | return this; 37 | } 38 | 39 | @Override 40 | public ShapedRecipe toRecipe() { 41 | return this; 42 | } 43 | 44 | private void updateIngredients() { 45 | ingredients = INGREDIENTS_FIELD.get(this); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/events/BuilderWandUseEvent.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.events; 2 | 3 | import com.bgsoftware.wildtools.api.objects.tools.BuilderTool; 4 | import org.bukkit.Location; 5 | import org.bukkit.entity.Player; 6 | import org.bukkit.event.Cancellable; 7 | import org.bukkit.event.HandlerList; 8 | 9 | import java.util.Collections; 10 | import java.util.List; 11 | 12 | /** 13 | * BuilderWandUseEvent is called when a builder wand is used. 14 | */ 15 | public class BuilderWandUseEvent extends ToolUseEvent implements Cancellable { 16 | 17 | private static final HandlerList HANDLERS = new HandlerList(); 18 | 19 | private final List blocks; 20 | 21 | private boolean cancelled = false; 22 | 23 | /** 24 | * The constructor of the event. 25 | * 26 | * @param player The player who used the wand. 27 | * @param tool The wand that was used. 28 | * @param blocks All the affected blocks by the wand. 29 | */ 30 | public BuilderWandUseEvent(Player player, BuilderTool tool, List blocks) { 31 | super(player, tool); 32 | this.blocks = Collections.unmodifiableList(blocks); 33 | } 34 | 35 | /** 36 | * Get all the affected blocks by the wand. 37 | */ 38 | public List getBlocks() { 39 | return blocks; 40 | } 41 | 42 | @Override 43 | public boolean isCancelled() { 44 | return cancelled; 45 | } 46 | 47 | @Override 48 | public void setCancelled(boolean cancelled) { 49 | this.cancelled = cancelled; 50 | } 51 | 52 | @Override 53 | public HandlerList getHandlers() { 54 | return HANDLERS; 55 | } 56 | 57 | public static HandlerList getHandlerList() { 58 | return HANDLERS; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /API/src/main/java/com/bgsoftware/wildtools/api/events/HarvesterHoeUseEvent.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.api.events; 2 | 3 | import com.bgsoftware.wildtools.api.objects.tools.HarvesterTool; 4 | import org.bukkit.Location; 5 | import org.bukkit.entity.Player; 6 | import org.bukkit.event.Cancellable; 7 | import org.bukkit.event.HandlerList; 8 | 9 | import java.util.Collections; 10 | import java.util.List; 11 | 12 | /** 13 | * HarvesterHoeUseEvent is called when a harvester hoe is used. 14 | */ 15 | public class HarvesterHoeUseEvent extends ToolUseEvent implements Cancellable { 16 | 17 | private static final HandlerList HANDLERS = new HandlerList(); 18 | 19 | private final List blocks; 20 | 21 | private boolean cancelled = false; 22 | 23 | /** 24 | * The constructor of the event. 25 | * @param player The player who used the wand. 26 | * @param tool The wand that was used. 27 | * @param blocks All the affected blocks by the wand. 28 | */ 29 | public HarvesterHoeUseEvent(Player player, HarvesterTool tool, List blocks){ 30 | super(player, tool); 31 | this.blocks = Collections.unmodifiableList(blocks); 32 | } 33 | 34 | /** 35 | * Get all the affected blocks by the wand. 36 | */ 37 | public List getBlocks() { 38 | return blocks; 39 | } 40 | 41 | @Override 42 | public boolean isCancelled() { 43 | return this.cancelled; 44 | } 45 | 46 | @Override 47 | public void setCancelled(boolean cancelled) { 48 | this.cancelled = cancelled; 49 | } 50 | 51 | @Override 52 | public HandlerList getHandlers() { 53 | return HANDLERS; 54 | } 55 | 56 | public static HandlerList getHandlerList() { 57 | return HANDLERS; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/main/resources/recipes.yml: -------------------------------------------------------------------------------- 1 | #################################################### 2 | ## ## 3 | ## WildTools Configuration ## 4 | ## Developed by Ome_R ## 5 | ## ## 6 | #################################################### 7 | 8 | items: 9 | tool_core: 10 | type: REDSTONE 11 | name: '&4Tool Core' 12 | lore: 13 | - '&7You can craft tools with this core!' 14 | glow: true 15 | 16 | recipes: 17 | trench_pickaxe: 18 | - 'DIAMOND, DIAMOND, DIAMOND' 19 | - 'tool_core, STICK, tool_core' 20 | - 'tool_core, STICK, tool_core' 21 | tray_pickaxe: 22 | - 'DIAMOND, DIAMOND, DIAMOND' 23 | - 'tool_core, STICK, tool_core' 24 | - 'AIR, STICK, AIR' 25 | sand_wand: 26 | - 'SAND, STICK, tool_core' 27 | - 'AIR, AIR, AIR' 28 | - 'AIR, AIR, AIR' 29 | sell_wand: 30 | - 'GOLD_INGOT, STICK, tool_core' 31 | - 'AIR, AIR, AIR' 32 | - 'AIR, AIR, AIR' 33 | lightning_wand: 34 | - 'EMERALD, STICK, tool_core' 35 | - 'AIR, AIR, AIR' 36 | - 'AIR, AIR, AIR' 37 | harvester_hoe: 38 | - 'DIAMOND, DIAMOND, AIR' 39 | - 'tool_core, STICK, AIR' 40 | - 'AIR, STICK, AIR' 41 | cannon_wand: 42 | - 'TNT, STICK, tool_core' 43 | - 'AIR, AIR, AIR' 44 | - 'AIR, AIR, AIR' 45 | crafting_wand: 46 | - 'WORKBENCH, STICK, tool_core' 47 | - 'AIR, AIR, AIR' 48 | - 'AIR, AIR, AIR' 49 | builder_wand: 50 | - 'tool_core, AIR, tool_core' 51 | - 'AIR, STICK, AIR' 52 | - 'tool_core, AIR, tool_core' 53 | ice_wand: 54 | - 'ICE, STICK, tool_core' 55 | - 'AIR, AIR, AIR' 56 | - 'AIR, AIR, AIR' 57 | drain_wand: 58 | - 'WATER_BUCKET, STICK, tool_core' 59 | - 'AIR, AIR, AIR' 60 | - 'AIR, AIR, AIR' 61 | sort_wand: 62 | - 'CHEST, STICK, tool_core' 63 | - 'AIR, AIR, AIR' 64 | - 'AIR, AIR, AIR' -------------------------------------------------------------------------------- /NMS/src/main/templates/tool/AbstractToolItemStack.java.template: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.${NMS_VERSION}.tool; 2 | 3 | import com.bgsoftware.wildtools.utils.items.ToolItemStack; 4 | import net.minecraft.nbt.CompoundTag; 5 | import net.minecraft.server.level.ServerPlayer; 6 | import net.minecraft.stats.Stats; 7 | import net.minecraft.world.item.Item; 8 | import net.minecraft.world.item.ItemStack; 9 | import ${CRAFTBUKKIT_PACKAGE}.entity.CraftPlayer; 10 | import ${CRAFTBUKKIT_PACKAGE}.event.CraftEventFactory; 11 | import ${CRAFTBUKKIT_PACKAGE}.inventory.CraftItemStack; 12 | import org.bukkit.entity.Player; 13 | 14 | public abstract class AbstractToolItemStack extends ToolItemStack { 15 | 16 | protected final ItemStack nmsItem; 17 | 18 | public AbstractToolItemStack(ItemStack nmsItem) { 19 | this.nmsItem = nmsItem; 20 | this.setItem(CraftItemStack.asCraftMirror(nmsItem)); 21 | } 22 | 23 | @Override 24 | public ToolItemStack copy() { 25 | return new ToolItemStackImpl(nmsItem.copy()); 26 | } 27 | 28 | @Override 29 | public abstract void setTag(String key, int value); 30 | 31 | @Override 32 | public abstract void setTag(String key, String value); 33 | 34 | @Override 35 | public abstract int getTag(String key, int def); 36 | 37 | @Override 38 | public abstract String getTag(String key, String def); 39 | 40 | @Override 41 | public void breakTool(Player player) { 42 | ServerPlayer serverPlayer = ((CraftPlayer) player).getHandle(); 43 | 44 | Item item = this.nmsItem.getItem(); 45 | 46 | if (this.nmsItem.getCount() == 1) 47 | CraftEventFactory.callPlayerItemBreakEvent(serverPlayer, this.nmsItem); 48 | 49 | this.nmsItem.shrink(1); 50 | 51 | serverPlayer.awardStat(Stats.ITEM_BROKEN.get(item)); 52 | 53 | this.nmsItem.setDamageValue(0); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /Hooks/McMMO1/src/main/java/com/bgsoftware/wildtools/hooks/DropsProvider_mcMMO1.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.hooks; 2 | 3 | import com.bgsoftware.wildtools.WildToolsPlugin; 4 | import com.bgsoftware.wildtools.api.hooks.DropsProvider; 5 | import com.bgsoftware.wildtools.utils.Materials; 6 | import com.gmail.nossr50.datatypes.player.McMMOPlayer; 7 | import com.gmail.nossr50.datatypes.skills.SecondaryAbility; 8 | import com.gmail.nossr50.datatypes.skills.SkillType; 9 | import com.gmail.nossr50.skills.herbalism.HerbalismManager; 10 | import com.gmail.nossr50.util.player.UserManager; 11 | import com.gmail.nossr50.util.skills.PerksUtils; 12 | import com.gmail.nossr50.util.skills.SkillUtils; 13 | import org.bukkit.block.Block; 14 | import org.bukkit.entity.Player; 15 | import org.bukkit.inventory.ItemStack; 16 | 17 | import java.util.List; 18 | 19 | public class DropsProvider_mcMMO1 implements DropsProvider { 20 | 21 | private static final WildToolsPlugin plugin = WildToolsPlugin.getPlugin(); 22 | 23 | @Override 24 | public List getBlockDrops(Player player, Block block) { 25 | if (!Materials.isCrop(block.getType()) || !shouldBonusDrops(player)) 26 | return null; 27 | 28 | List drops = plugin.getNMSWorld().getBlockDrops(player, block, false); 29 | drops.forEach(itemStack -> itemStack.setAmount(itemStack.getAmount() * 2)); 30 | return drops; 31 | } 32 | 33 | @Override 34 | public boolean isSpawnersOnly() { 35 | return false; 36 | } 37 | 38 | private boolean shouldBonusDrops(Player player) { 39 | McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); 40 | HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager(); 41 | int activationChance = PerksUtils.handleLuckyPerks(player, SkillType.HERBALISM); 42 | return SkillUtils.activationSuccessful(SecondaryAbility.HERBALISM_DOUBLE_DROPS, player, herbalismManager.getSkillLevel(), activationChance); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /NMS/v1_21_5/src/main/java/com/bgsoftware/wildtools/nms/v1_21_5/tool/ToolItemStackImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_21_5.tool; 2 | 3 | import net.minecraft.core.component.DataComponents; 4 | import net.minecraft.nbt.CompoundTag; 5 | import net.minecraft.world.item.ItemStack; 6 | import net.minecraft.world.item.component.CustomData; 7 | 8 | import java.util.function.Consumer; 9 | import java.util.function.Function; 10 | 11 | public class ToolItemStackImpl extends com.bgsoftware.wildtools.nms.v1_21_5.tool.AbstractToolItemStack { 12 | 13 | public ToolItemStackImpl(ItemStack nmsItem) { 14 | super(nmsItem); 15 | } 16 | 17 | @Override 18 | public void setTag(String key, int value) { 19 | setTagInternal(compoundTag -> compoundTag.putInt(key, value)); 20 | } 21 | 22 | @Override 23 | public void setTag(String key, String value) { 24 | setTagInternal(compoundTag -> compoundTag.putString(key, value)); 25 | } 26 | 27 | @Override 28 | public int getTag(String key, int def) { 29 | return getTagInternal(compoundTag -> compoundTag.getIntOr(key, def), def); 30 | } 31 | 32 | @Override 33 | public String getTag(String key, String def) { 34 | return getTagInternal(compoundTag -> compoundTag.getStringOr(key, def), def); 35 | } 36 | 37 | private void setTagInternal(Consumer consumer) { 38 | CustomData customData = this.nmsItem.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY); 39 | customData = customData.update(consumer); 40 | this.nmsItem.set(DataComponents.CUSTOM_DATA, customData); 41 | } 42 | 43 | private R getTagInternal(Function function, R def) { 44 | CustomData customData = this.nmsItem.get(DataComponents.CUSTOM_DATA); 45 | if(customData != null) { 46 | CompoundTag compoundTag = customData.getUnsafe(); 47 | return function.apply(compoundTag); 48 | } 49 | return def; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /NMS/v1_21_7/src/main/java/com/bgsoftware/wildtools/nms/v1_21_7/tool/ToolItemStackImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_21_7.tool; 2 | 3 | import net.minecraft.core.component.DataComponents; 4 | import net.minecraft.nbt.CompoundTag; 5 | import net.minecraft.world.item.ItemStack; 6 | import net.minecraft.world.item.component.CustomData; 7 | 8 | import java.util.function.Consumer; 9 | import java.util.function.Function; 10 | 11 | public class ToolItemStackImpl extends com.bgsoftware.wildtools.nms.v1_21_7.tool.AbstractToolItemStack { 12 | 13 | public ToolItemStackImpl(ItemStack nmsItem) { 14 | super(nmsItem); 15 | } 16 | 17 | @Override 18 | public void setTag(String key, int value) { 19 | setTagInternal(compoundTag -> compoundTag.putInt(key, value)); 20 | } 21 | 22 | @Override 23 | public void setTag(String key, String value) { 24 | setTagInternal(compoundTag -> compoundTag.putString(key, value)); 25 | } 26 | 27 | @Override 28 | public int getTag(String key, int def) { 29 | return getTagInternal(compoundTag -> compoundTag.getIntOr(key, def), def); 30 | } 31 | 32 | @Override 33 | public String getTag(String key, String def) { 34 | return getTagInternal(compoundTag -> compoundTag.getStringOr(key, def), def); 35 | } 36 | 37 | private void setTagInternal(Consumer consumer) { 38 | CustomData customData = this.nmsItem.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY); 39 | customData = customData.update(consumer); 40 | this.nmsItem.set(DataComponents.CUSTOM_DATA, customData); 41 | } 42 | 43 | private R getTagInternal(Function function, R def) { 44 | CustomData customData = this.nmsItem.get(DataComponents.CUSTOM_DATA); 45 | if(customData != null) { 46 | CompoundTag compoundTag = customData.getUnsafe(); 47 | return function.apply(compoundTag); 48 | } 49 | return def; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /NMS/v1_17/src/main/java/com/bgsoftware/wildtools/nms/v1_17/NMSAdapterImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_17; 2 | 3 | import com.bgsoftware.wildtools.nms.alogrithms.PaperGlowEnchantment; 4 | import com.bgsoftware.wildtools.nms.alogrithms.SpigotGlowEnchantment; 5 | import net.minecraft.network.protocol.Packet; 6 | import net.minecraft.network.protocol.game.ClientGamePacketListener; 7 | import net.minecraft.server.level.ServerChunkCache; 8 | import net.minecraft.world.entity.Entity; 9 | import org.bukkit.enchantments.Enchantment; 10 | import org.bukkit.inventory.meta.ItemMeta; 11 | 12 | import java.lang.reflect.Field; 13 | 14 | public class NMSAdapterImpl extends com.bgsoftware.wildtools.nms.v1_17.AbstractNMSAdapter { 15 | 16 | private static final Enchantment GLOW_ENCHANT = initializeGlowEnchantment(); 17 | 18 | @Override 19 | protected void sendPacket(ServerChunkCache serverChunkCache, Entity entity, Packet packet) { 20 | serverChunkCache.broadcast(entity, packet); 21 | } 22 | 23 | @Override 24 | public void makeItemGlow(ItemMeta itemMeta) { 25 | itemMeta.addEnchant(GLOW_ENCHANT, 1, true); 26 | } 27 | 28 | private static Enchantment initializeGlowEnchantment() { 29 | Enchantment glowEnchant; 30 | 31 | try { 32 | glowEnchant = new PaperGlowEnchantment("wildtools_glowing_enchant"); 33 | } catch (Throwable error) { 34 | glowEnchant = new SpigotGlowEnchantment("wildtools_glowing_enchant"); 35 | } 36 | 37 | try { 38 | Field field = Enchantment.class.getDeclaredField("acceptingNew"); 39 | field.setAccessible(true); 40 | field.set(null, true); 41 | field.setAccessible(false); 42 | } catch (Exception ignored) { 43 | } 44 | 45 | try { 46 | Enchantment.registerEnchantment(glowEnchant); 47 | } catch (Exception ignored) { 48 | } 49 | 50 | return glowEnchant; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /NMS/v1_18/src/main/java/com/bgsoftware/wildtools/nms/v1_18/NMSAdapterImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_18; 2 | 3 | import com.bgsoftware.wildtools.nms.alogrithms.PaperGlowEnchantment; 4 | import com.bgsoftware.wildtools.nms.alogrithms.SpigotGlowEnchantment; 5 | import net.minecraft.network.protocol.Packet; 6 | import net.minecraft.network.protocol.game.ClientGamePacketListener; 7 | import net.minecraft.server.level.ServerChunkCache; 8 | import net.minecraft.world.entity.Entity; 9 | import org.bukkit.enchantments.Enchantment; 10 | import org.bukkit.inventory.meta.ItemMeta; 11 | 12 | import java.lang.reflect.Field; 13 | 14 | public class NMSAdapterImpl extends com.bgsoftware.wildtools.nms.v1_18.AbstractNMSAdapter { 15 | 16 | private static final Enchantment GLOW_ENCHANT = initializeGlowEnchantment(); 17 | 18 | @Override 19 | protected void sendPacket(ServerChunkCache serverChunkCache, Entity entity, Packet packet) { 20 | serverChunkCache.broadcast(entity, packet); 21 | } 22 | 23 | @Override 24 | public void makeItemGlow(ItemMeta itemMeta) { 25 | itemMeta.addEnchant(GLOW_ENCHANT, 1, true); 26 | } 27 | 28 | private static Enchantment initializeGlowEnchantment() { 29 | Enchantment glowEnchant; 30 | 31 | try { 32 | glowEnchant = new PaperGlowEnchantment("wildtools_glowing_enchant"); 33 | } catch (Throwable error) { 34 | glowEnchant = new SpigotGlowEnchantment("wildtools_glowing_enchant"); 35 | } 36 | 37 | try { 38 | Field field = Enchantment.class.getDeclaredField("acceptingNew"); 39 | field.setAccessible(true); 40 | field.set(null, true); 41 | field.setAccessible(false); 42 | } catch (Exception ignored) { 43 | } 44 | 45 | try { 46 | Enchantment.registerEnchantment(glowEnchant); 47 | } catch (Exception ignored) { 48 | } 49 | 50 | return glowEnchant; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /NMS/v1_19/src/main/java/com/bgsoftware/wildtools/nms/v1_19/NMSAdapterImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_19; 2 | 3 | import com.bgsoftware.wildtools.nms.alogrithms.PaperGlowEnchantment; 4 | import com.bgsoftware.wildtools.nms.alogrithms.SpigotGlowEnchantment; 5 | import net.minecraft.network.protocol.Packet; 6 | import net.minecraft.network.protocol.game.ClientGamePacketListener; 7 | import net.minecraft.server.level.ServerChunkCache; 8 | import net.minecraft.world.entity.Entity; 9 | import org.bukkit.enchantments.Enchantment; 10 | import org.bukkit.inventory.meta.ItemMeta; 11 | 12 | import java.lang.reflect.Field; 13 | 14 | public class NMSAdapterImpl extends com.bgsoftware.wildtools.nms.v1_19.AbstractNMSAdapter { 15 | 16 | private static final Enchantment GLOW_ENCHANT = initializeGlowEnchantment(); 17 | 18 | @Override 19 | protected void sendPacket(ServerChunkCache serverChunkCache, Entity entity, Packet packet) { 20 | serverChunkCache.broadcast(entity, packet); 21 | } 22 | 23 | @Override 24 | public void makeItemGlow(ItemMeta itemMeta) { 25 | itemMeta.addEnchant(GLOW_ENCHANT, 1, true); 26 | } 27 | 28 | private static Enchantment initializeGlowEnchantment() { 29 | Enchantment glowEnchant; 30 | 31 | try { 32 | glowEnchant = new PaperGlowEnchantment("wildtools_glowing_enchant"); 33 | } catch (Throwable error) { 34 | glowEnchant = new SpigotGlowEnchantment("wildtools_glowing_enchant"); 35 | } 36 | 37 | try { 38 | Field field = Enchantment.class.getDeclaredField("acceptingNew"); 39 | field.setAccessible(true); 40 | field.set(null, true); 41 | field.setAccessible(false); 42 | } catch (Exception ignored) { 43 | } 44 | 45 | try { 46 | Enchantment.registerEnchantment(glowEnchant); 47 | } catch (Exception ignored) { 48 | } 49 | 50 | return glowEnchant; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/utils/items/ItemStackMap.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.utils.items; 2 | 3 | import com.bgsoftware.wildtools.utils.Counter; 4 | import com.google.common.collect.ForwardingMap; 5 | import org.bukkit.inventory.ItemStack; 6 | 7 | import java.util.Collection; 8 | import java.util.HashMap; 9 | import java.util.Map; 10 | 11 | public class ItemStackMap extends ForwardingMap { 12 | 13 | private final Map handle = new HashMap<>(); 14 | 15 | @Override 16 | protected Map delegate() { 17 | return this.handle; 18 | } 19 | 20 | @Override 21 | public Counter remove(Object object) { 22 | if (!(object instanceof ItemStack)) { 23 | return super.remove(object); 24 | } 25 | 26 | return super.remove(getItemStackAsKey((ItemStack) object)); 27 | } 28 | 29 | @Override 30 | public Counter put(ItemStack key, Counter value) { 31 | return super.put(getItemStackAsKey(key), value); 32 | } 33 | 34 | @Override 35 | public boolean containsKey(Object key) { 36 | if (!(key instanceof ItemStack)) { 37 | return super.containsKey(key); 38 | } 39 | 40 | return super.containsKey(getItemStackAsKey((ItemStack) key)); 41 | } 42 | 43 | @Override 44 | public Counter get(Object key) { 45 | if (!(key instanceof ItemStack)) { 46 | return super.get(key); 47 | } 48 | 49 | return super.get(getItemStackAsKey((ItemStack) key)); 50 | } 51 | 52 | public void addItems(Collection items) { 53 | items.forEach(item -> computeIfAbsent(item, i -> new Counter()).increase(item.getAmount())); 54 | } 55 | 56 | private static ItemStack getItemStackAsKey(ItemStack itemStack) { 57 | if (itemStack.getAmount() == 1) 58 | return itemStack; 59 | 60 | ItemStack itemKey = itemStack.clone(); 61 | itemKey.setAmount(1); 62 | return itemKey; 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /NMS/v1_21/src/main/java/com/bgsoftware/wildtools/nms/v1_21/tool/ToolItemStackImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_21.tool; 2 | 3 | import net.minecraft.core.component.DataComponents; 4 | import net.minecraft.nbt.CompoundTag; 5 | import net.minecraft.world.item.ItemStack; 6 | import net.minecraft.world.item.component.CustomData; 7 | 8 | import java.util.function.Consumer; 9 | import java.util.function.Function; 10 | 11 | public class ToolItemStackImpl extends com.bgsoftware.wildtools.nms.v1_21.tool.AbstractToolItemStack { 12 | 13 | public ToolItemStackImpl(ItemStack nmsItem) { 14 | super(nmsItem); 15 | } 16 | 17 | @Override 18 | public void setTag(String key, int value) { 19 | setTagInternal(compoundTag -> compoundTag.putInt(key, value)); 20 | } 21 | 22 | @Override 23 | public void setTag(String key, String value) { 24 | setTagInternal(compoundTag -> compoundTag.putString(key, value)); 25 | } 26 | 27 | @Override 28 | public int getTag(String key, int def) { 29 | return getTagInternal(compoundTag -> 30 | compoundTag.contains(key, 3) ? compoundTag.getInt(key) : def, def); 31 | } 32 | 33 | @Override 34 | public String getTag(String key, String def) { 35 | return getTagInternal(compoundTag -> 36 | compoundTag.contains(key, 8) ? compoundTag.getString(key) : def, def); 37 | } 38 | 39 | private void setTagInternal(Consumer consumer) { 40 | CustomData customData = this.nmsItem.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY); 41 | customData = customData.update(consumer); 42 | this.nmsItem.set(DataComponents.CUSTOM_DATA, customData); 43 | } 44 | 45 | private R getTagInternal(Function function, R def) { 46 | CustomData customData = this.nmsItem.get(DataComponents.CUSTOM_DATA); 47 | if(customData != null) { 48 | CompoundTag compoundTag = customData.getUnsafe(); 49 | return function.apply(compoundTag); 50 | } 51 | return def; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /NMS/v1_20_4/src/main/java/com/bgsoftware/wildtools/nms/v1_20_4/tool/ToolItemStackImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_20_4.tool; 2 | 3 | import net.minecraft.core.component.DataComponents; 4 | import net.minecraft.nbt.CompoundTag; 5 | import net.minecraft.world.item.ItemStack; 6 | import net.minecraft.world.item.component.CustomData; 7 | 8 | import java.util.function.Consumer; 9 | import java.util.function.Function; 10 | 11 | public class ToolItemStackImpl extends com.bgsoftware.wildtools.nms.v1_20_4.tool.AbstractToolItemStack { 12 | 13 | public ToolItemStackImpl(ItemStack nmsItem) { 14 | super(nmsItem); 15 | } 16 | 17 | @Override 18 | public void setTag(String key, int value) { 19 | setTagInternal(compoundTag -> compoundTag.putInt(key, value)); 20 | } 21 | 22 | @Override 23 | public void setTag(String key, String value) { 24 | setTagInternal(compoundTag -> compoundTag.putString(key, value)); 25 | } 26 | 27 | @Override 28 | public int getTag(String key, int def) { 29 | return getTagInternal(compoundTag -> 30 | compoundTag.contains(key, 3) ? compoundTag.getInt(key) : def, def); 31 | } 32 | 33 | @Override 34 | public String getTag(String key, String def) { 35 | return getTagInternal(compoundTag -> 36 | compoundTag.contains(key, 8) ? compoundTag.getString(key) : def, def); 37 | } 38 | 39 | private void setTagInternal(Consumer consumer) { 40 | CustomData customData = this.nmsItem.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY); 41 | customData = customData.update(consumer); 42 | this.nmsItem.set(DataComponents.CUSTOM_DATA, customData); 43 | } 44 | 45 | private R getTagInternal(Function function, R def) { 46 | CustomData customData = this.nmsItem.get(DataComponents.CUSTOM_DATA); 47 | if(customData != null) { 48 | CompoundTag compoundTag = customData.getUnsafe(); 49 | return function.apply(compoundTag); 50 | } 51 | return def; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /NMS/v1_21_3/src/main/java/com/bgsoftware/wildtools/nms/v1_21_3/tool/ToolItemStackImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_21_3.tool; 2 | 3 | import net.minecraft.core.component.DataComponents; 4 | import net.minecraft.nbt.CompoundTag; 5 | import net.minecraft.world.item.ItemStack; 6 | import net.minecraft.world.item.component.CustomData; 7 | 8 | import java.util.function.Consumer; 9 | import java.util.function.Function; 10 | 11 | public class ToolItemStackImpl extends com.bgsoftware.wildtools.nms.v1_21_3.tool.AbstractToolItemStack { 12 | 13 | public ToolItemStackImpl(ItemStack nmsItem) { 14 | super(nmsItem); 15 | } 16 | 17 | @Override 18 | public void setTag(String key, int value) { 19 | setTagInternal(compoundTag -> compoundTag.putInt(key, value)); 20 | } 21 | 22 | @Override 23 | public void setTag(String key, String value) { 24 | setTagInternal(compoundTag -> compoundTag.putString(key, value)); 25 | } 26 | 27 | @Override 28 | public int getTag(String key, int def) { 29 | return getTagInternal(compoundTag -> 30 | compoundTag.contains(key, 3) ? compoundTag.getInt(key) : def, def); 31 | } 32 | 33 | @Override 34 | public String getTag(String key, String def) { 35 | return getTagInternal(compoundTag -> 36 | compoundTag.contains(key, 8) ? compoundTag.getString(key) : def, def); 37 | } 38 | 39 | private void setTagInternal(Consumer consumer) { 40 | CustomData customData = this.nmsItem.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY); 41 | customData = customData.update(consumer); 42 | this.nmsItem.set(DataComponents.CUSTOM_DATA, customData); 43 | } 44 | 45 | private R getTagInternal(Function function, R def) { 46 | CustomData customData = this.nmsItem.get(DataComponents.CUSTOM_DATA); 47 | if(customData != null) { 48 | CompoundTag compoundTag = customData.getUnsafe(); 49 | return function.apply(compoundTag); 50 | } 51 | return def; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /NMS/v1_21_4/src/main/java/com/bgsoftware/wildtools/nms/v1_21_4/tool/ToolItemStackImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_21_4.tool; 2 | 3 | import net.minecraft.core.component.DataComponents; 4 | import net.minecraft.nbt.CompoundTag; 5 | import net.minecraft.world.item.ItemStack; 6 | import net.minecraft.world.item.component.CustomData; 7 | 8 | import java.util.function.Consumer; 9 | import java.util.function.Function; 10 | 11 | public class ToolItemStackImpl extends com.bgsoftware.wildtools.nms.v1_21_4.tool.AbstractToolItemStack { 12 | 13 | public ToolItemStackImpl(ItemStack nmsItem) { 14 | super(nmsItem); 15 | } 16 | 17 | @Override 18 | public void setTag(String key, int value) { 19 | setTagInternal(compoundTag -> compoundTag.putInt(key, value)); 20 | } 21 | 22 | @Override 23 | public void setTag(String key, String value) { 24 | setTagInternal(compoundTag -> compoundTag.putString(key, value)); 25 | } 26 | 27 | @Override 28 | public int getTag(String key, int def) { 29 | return getTagInternal(compoundTag -> 30 | compoundTag.contains(key, 3) ? compoundTag.getInt(key) : def, def); 31 | } 32 | 33 | @Override 34 | public String getTag(String key, String def) { 35 | return getTagInternal(compoundTag -> 36 | compoundTag.contains(key, 8) ? compoundTag.getString(key) : def, def); 37 | } 38 | 39 | private void setTagInternal(Consumer consumer) { 40 | CustomData customData = this.nmsItem.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY); 41 | customData = customData.update(consumer); 42 | this.nmsItem.set(DataComponents.CUSTOM_DATA, customData); 43 | } 44 | 45 | private R getTagInternal(Function function, R def) { 46 | CustomData customData = this.nmsItem.get(DataComponents.CUSTOM_DATA); 47 | if(customData != null) { 48 | CompoundTag compoundTag = customData.getUnsafe(); 49 | return function.apply(compoundTag); 50 | } 51 | return def; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /NMS/v1_20_3/src/main/java/com/bgsoftware/wildtools/nms/v1_20_3/NMSAdapterImpl.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.nms.v1_20_3; 2 | 3 | import com.bgsoftware.common.reflection.ReflectField; 4 | import com.bgsoftware.wildtools.nms.v1_20_3.alogrithms.PaperGlowEnchantment; 5 | import com.bgsoftware.wildtools.nms.v1_20_3.alogrithms.SpigotGlowEnchantment; 6 | import net.minecraft.network.protocol.Packet; 7 | import net.minecraft.network.protocol.game.ClientGamePacketListener; 8 | import net.minecraft.server.level.ServerChunkCache; 9 | import net.minecraft.world.entity.Entity; 10 | import org.bukkit.NamespacedKey; 11 | import org.bukkit.Registry; 12 | import org.bukkit.craftbukkit.v1_20_R3.CraftRegistry; 13 | import org.bukkit.enchantments.Enchantment; 14 | import org.bukkit.inventory.meta.ItemMeta; 15 | 16 | import java.util.Map; 17 | 18 | public class NMSAdapterImpl extends com.bgsoftware.wildtools.nms.v1_20_3.AbstractNMSAdapter { 19 | 20 | private static final ReflectField> REGISTRY_CACHE = 21 | new ReflectField<>(CraftRegistry.class, Map.class, "cache"); 22 | 23 | private static final Enchantment GLOW_ENCHANT = initializeGlowEnchantment(); 24 | 25 | @Override 26 | protected void sendPacket(ServerChunkCache serverChunkCache, Entity entity, Packet packet) { 27 | serverChunkCache.broadcast(entity, packet); 28 | } 29 | 30 | @Override 31 | public void makeItemGlow(ItemMeta itemMeta) { 32 | itemMeta.addEnchant(GLOW_ENCHANT, 1, true); 33 | } 34 | 35 | private static Enchantment initializeGlowEnchantment() { 36 | Enchantment glowEnchant; 37 | 38 | try { 39 | glowEnchant = new PaperGlowEnchantment("wildtools_glowing_enchant"); 40 | } catch (Throwable error) { 41 | glowEnchant = new SpigotGlowEnchantment("wildtools_glowing_enchant"); 42 | } 43 | 44 | Map registryCache = REGISTRY_CACHE.get(Registry.ENCHANTMENT); 45 | 46 | registryCache.put(glowEnchant.getKey(), glowEnchant); 47 | 48 | return glowEnchant; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/command/commands/CommandReload.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.command.commands; 2 | 3 | import com.bgsoftware.wildtools.Locale; 4 | import com.bgsoftware.wildtools.WildToolsPlugin; 5 | import com.bgsoftware.wildtools.command.ICommand; 6 | import com.bgsoftware.wildtools.handlers.DataHandler; 7 | import com.bgsoftware.wildtools.handlers.ProvidersHandler; 8 | import com.bgsoftware.wildtools.handlers.ToolsHandler; 9 | import com.bgsoftware.wildtools.scheduler.Scheduler; 10 | import org.bukkit.command.CommandSender; 11 | 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | public class CommandReload implements ICommand { 16 | 17 | @Override 18 | public String getLabel() { 19 | return "reload"; 20 | } 21 | 22 | @Override 23 | public String getUsage() { 24 | return "tools reload"; 25 | } 26 | 27 | @Override 28 | public String getPermission() { 29 | return "wildtools.reload"; 30 | } 31 | 32 | @Override 33 | public String getDescription() { 34 | return "Reload the settings and the language files."; 35 | } 36 | 37 | @Override 38 | public int getMinArgs() { 39 | return 1; 40 | } 41 | 42 | @Override 43 | public int getMaxArgs() { 44 | return 1; 45 | } 46 | 47 | @Override 48 | public void run(WildToolsPlugin plugin, CommandSender sender, String[] args) { 49 | Scheduler.runTaskAsync(() -> { 50 | WildToolsPlugin.log("******** RELOAD START ********"); 51 | ToolsHandler.reload(); 52 | DataHandler.reload(); 53 | plugin.getEditor().reloadConfiguration(); 54 | Locale.reload(); 55 | ProvidersHandler.reload(); 56 | plugin.getEvents().loadNotifiedForTools(); 57 | WildToolsPlugin.log("******** RELOAD DONE ********"); 58 | Locale.RELOAD_SUCCESS.send(sender); 59 | }); 60 | } 61 | 62 | @Override 63 | public List tabComplete(WildToolsPlugin plugin, CommandSender sender, String[] args) { 64 | return new ArrayList<>(); 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/SellWandLogger.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | import java.text.SimpleDateFormat; 6 | import java.util.Date; 7 | import java.util.logging.FileHandler; 8 | import java.util.logging.Formatter; 9 | import java.util.logging.LogRecord; 10 | import java.util.logging.Logger; 11 | 12 | public class SellWandLogger { 13 | 14 | private static final WildToolsPlugin plugin = WildToolsPlugin.getPlugin(); 15 | private static final Logger LOGGER = Logger.getLogger("WildTools-SellWand"); 16 | private static boolean enabled = true; 17 | 18 | @SuppressWarnings("all") 19 | public static void setLogsFile(String logsFilePath){ 20 | if(logsFilePath.isEmpty()){ 21 | enabled = false; 22 | return; 23 | } 24 | 25 | File file = new File(plugin.getDataFolder(), logsFilePath); 26 | 27 | FileHandler fileHandler; 28 | 29 | try { 30 | if(!file.exists()){ 31 | file.getParentFile().mkdirs(); 32 | file.createNewFile(); 33 | } 34 | 35 | fileHandler = new FileHandler(file.getAbsolutePath(), true); 36 | } catch (IOException ex) { 37 | ex.printStackTrace(); 38 | return; 39 | } 40 | 41 | fileHandler.setFormatter(new LogsFormatter()); 42 | LOGGER.addHandler(fileHandler); 43 | LOGGER.setUseParentHandlers(false); 44 | } 45 | 46 | public static void log(String line){ 47 | if(enabled) 48 | LOGGER.info(line); 49 | } 50 | 51 | public static void close(){ 52 | } 53 | 54 | private static class LogsFormatter extends Formatter{ 55 | 56 | private static final SimpleDateFormat dateFormat = new SimpleDateFormat("[dd/MM/yy HH:mm:ss]"); 57 | 58 | @Override 59 | public String format(LogRecord record) { 60 | return getDateAndTime() + " " + record.getMessage() + "\n"; 61 | } 62 | 63 | private String getDateAndTime() { 64 | return dateFormat.format(new Date()); 65 | } 66 | 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/recipes/MaterialChoice.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.recipes; 2 | 3 | import org.bukkit.Material; 4 | import org.bukkit.inventory.Inventory; 5 | import org.bukkit.inventory.ItemStack; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | import java.util.Objects; 10 | import java.util.function.Predicate; 11 | import java.util.stream.Collectors; 12 | 13 | public class MaterialChoice implements RecipeChoice { 14 | 15 | private final List itemStacks; 16 | 17 | public MaterialChoice(List itemStacks) { 18 | this.itemStacks = itemStacks.stream().map(ItemStack::clone).collect(Collectors.toList()); 19 | } 20 | 21 | @Override 22 | public boolean test(ItemStack itemStack) { 23 | return itemStacks.stream().anyMatch(_itemStack -> _itemStack.isSimilar(itemStack)); 24 | } 25 | 26 | @Override 27 | public boolean test(Predicate predicate) { 28 | return itemStacks.stream().anyMatch(_itemStack -> predicate.test(_itemStack.getType())); 29 | } 30 | 31 | @Override 32 | public void setAmount(int amount) { 33 | itemStacks.forEach(itemStack -> itemStack.setAmount(amount)); 34 | } 35 | 36 | @Override 37 | public int getAmount() { 38 | return itemStacks.isEmpty() ? 0 : itemStacks.get(0).getAmount(); 39 | } 40 | 41 | @Override 42 | public void remove(Inventory inventory) { 43 | for (ItemStack itemStack : itemStacks) { 44 | Map additionalItems = inventory.removeItem(itemStack); 45 | 46 | if (additionalItems.isEmpty()) 47 | break; 48 | 49 | setAmount(additionalItems.get(0).getAmount()); 50 | } 51 | } 52 | 53 | @Override 54 | public int hashCode() { 55 | return 37 * 3 + Objects.hashCode(this.itemStacks); 56 | } 57 | 58 | @Override 59 | public boolean equals(Object obj) { 60 | return obj instanceof MaterialChoice && Objects.equals(itemStacks, ((MaterialChoice) obj).itemStacks); 61 | } 62 | 63 | @Override 64 | public String toString() { 65 | return "MaterialChoice{items=" + itemStacks.toString() + "}"; 66 | } 67 | 68 | @Override 69 | public RecipeChoice copy() { 70 | return new MaterialChoice(itemStacks.stream().map(ItemStack::clone).collect(Collectors.toList())); 71 | } 72 | 73 | } -------------------------------------------------------------------------------- /src/main/java/com/bgsoftware/wildtools/scheduler/BukkitSchedulerImplementation.java: -------------------------------------------------------------------------------- 1 | package com.bgsoftware.wildtools.scheduler; 2 | 3 | import com.bgsoftware.wildtools.WildToolsPlugin; 4 | import org.bukkit.Bukkit; 5 | import org.bukkit.World; 6 | import org.bukkit.entity.Entity; 7 | import org.bukkit.scheduler.BukkitTask; 8 | 9 | public class BukkitSchedulerImplementation implements ISchedulerImplementation { 10 | 11 | public static final BukkitSchedulerImplementation INSTANCE = new BukkitSchedulerImplementation(); 12 | 13 | private static final WildToolsPlugin plugin = WildToolsPlugin.getPlugin(); 14 | 15 | private BukkitSchedulerImplementation() { 16 | 17 | } 18 | 19 | @Override 20 | public boolean isRegionScheduler() { 21 | return false; 22 | } 23 | 24 | @Override 25 | public ScheduledTask scheduleTask(World world, int chunkX, int chunkZ, Runnable task, long delay) { 26 | return scheduleTask(task, delay); 27 | } 28 | 29 | @Override 30 | public ScheduledTask scheduleTask(Entity unused, Runnable task, long delay) { 31 | return scheduleTask(task, delay); 32 | } 33 | 34 | @Override 35 | public ScheduledTask scheduleTask(Runnable task, long delay) { 36 | if (delay <= 0) { 37 | return new BukkitScheduledTask(Bukkit.getScheduler().runTask(plugin, task)); 38 | } else { 39 | return new BukkitScheduledTask(Bukkit.getScheduler().runTaskLater(plugin, task, delay)); 40 | } 41 | } 42 | 43 | @Override 44 | public ScheduledTask scheduleAsyncTask(Runnable task, long delay) { 45 | if (delay <= 0) { 46 | return new BukkitScheduledTask(Bukkit.getScheduler().runTaskAsynchronously(plugin, task)); 47 | } else { 48 | return new BukkitScheduledTask(Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, task, delay)); 49 | } 50 | } 51 | 52 | private static class BukkitScheduledTask implements ScheduledTask { 53 | 54 | private int taskId; 55 | 56 | BukkitScheduledTask(BukkitTask bukkitTask) { 57 | this(bukkitTask.getTaskId()); 58 | } 59 | 60 | BukkitScheduledTask(int taskId) { 61 | this.taskId = taskId; 62 | } 63 | 64 | @Override 65 | public void cancel() { 66 | if (Bukkit.getScheduler().isCurrentlyRunning(this.taskId)) { 67 | Bukkit.getScheduler().cancelTask(this.taskId); 68 | this.taskId = -1; 69 | } 70 | } 71 | } 72 | 73 | } 74 | --------------------------------------------------------------------------------