├── factions ├── abstract │ └── build.gradle.kts ├── SaberFactions │ └── build.gradle.kts ├── handler │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── github │ │ │ └── sirblobman │ │ │ └── api │ │ │ └── factions │ │ │ └── FactionsNotFoundException.java │ └── build.gradle.kts ├── FactionsUUID │ └── build.gradle.kts ├── FactionsUUID-Legacy │ └── build.gradle.kts ├── LegacyFactions │ └── build.gradle.kts ├── MassiveCore-Factions │ └── build.gradle.kts ├── build.gradle.kts ├── FactionsUUID-4 │ └── build.gradle.kts └── FactionsX │ └── build.gradle.kts ├── bungeecord ├── core │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── hidden.yml │ │ │ └── config.yml │ │ │ └── java │ │ │ └── com │ │ │ └── github │ │ │ └── sirblobman │ │ │ └── api │ │ │ └── bungeecord │ │ │ └── core │ │ │ ├── command │ │ │ └── CommandSBCoreReload.java │ │ │ └── hook │ │ │ └── DefaultVanishHook.java │ └── build.gradle.kts ├── abstract │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── github │ │ └── sirblobman │ │ └── api │ │ └── bungeecord │ │ ├── configuration │ │ ├── IHookPlugin.java │ │ ├── IResourceHolder.java │ │ ├── ConfigurablePlugin.java │ │ └── WrapperPluginResourceHolder.java │ │ └── hook │ │ ├── IHook.java │ │ ├── vanish │ │ └── IVanishHook.java │ │ └── permission │ │ └── IPermissionHook.java ├── LuckPerms │ └── build.gradle.kts ├── BungeePerms │ └── build.gradle.kts ├── PremiumVanish │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── github │ │ └── sirblobman │ │ └── api │ │ └── bungeecord │ │ └── premiumvanish │ │ └── PremiumVanishListener.java └── build.gradle.kts ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .github ├── dependabot.yml └── ISSUE_TEMPLATE │ ├── feature-requests.md │ └── bug-report.md ├── nms ├── 1_8_R3 │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── github │ │ └── sirblobman │ │ └── api │ │ ├── nbt │ │ ├── CustomNbtContext_1_8_R3.java │ │ └── Adapter_1_8_R3.java │ │ └── nms │ │ ├── PlayerHandler_1_8_R3.java │ │ └── ServerHandler_1_8_R3.java ├── 1_12_R1 │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── github │ │ └── sirblobman │ │ └── api │ │ ├── nbt │ │ ├── CustomNbtContext_1_12_R1.java │ │ └── Adapter_1_12_R1.java │ │ └── nms │ │ ├── PlayerHandler_1_12_R1.java │ │ ├── ServerHandler_1_12_R1.java │ │ └── EntityHandler_1_12_R1.java ├── 1_16_R3 │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── github │ │ └── sirblobman │ │ └── api │ │ └── nms │ │ ├── PlayerHandler_1_16_R3.java │ │ └── ServerHandler_1_16_R3.java ├── abstract │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── github │ │ └── sirblobman │ │ └── api │ │ ├── nbt │ │ ├── CustomNbtContext.java │ │ ├── custom │ │ │ ├── CustomNbtTypeBoolean.java │ │ │ └── CustomNbtTypeUUID.java │ │ ├── CustomNbtTypePrimitive.java │ │ ├── CustomNbtType.java │ │ └── CustomNbtTypes.java │ │ └── nms │ │ ├── Handler.java │ │ ├── ServerHandler.java │ │ └── PlayerHandler.java ├── fallback │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── github │ │ └── sirblobman │ │ └── api │ │ ├── nbt │ │ ├── CustomNbtContext_Fallback.java │ │ └── CustomNbtContainer_Fallback.java │ │ └── nms │ │ ├── ServerHandler_Fallback.java │ │ ├── PlayerHandler_Fallback.java │ │ └── EntityHandler_Fallback.java ├── modern-nbt │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── github │ │ └── sirblobman │ │ └── api │ │ └── nbt │ │ └── modern │ │ ├── PersistentDataConverter.java │ │ ├── CustomNbtPersistentDataAdapterContextWrapper.java │ │ └── CustomNbtPersistentDataTypeWrapper.java ├── paper │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── github │ │ └── sirblobman │ │ └── api │ │ └── nms │ │ ├── ServerHandler_Paper.java │ │ └── PlayerHandler_Paper.java ├── scoreboard │ └── build.gradle.kts ├── build.gradle.kts ├── 1_17_R1 │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── github │ │ └── sirblobman │ │ └── api │ │ └── nms │ │ ├── PlayerHandler_1_17_R1.java │ │ └── ServerHandler_1_17_R1.java ├── 1_18_R2 │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── github │ │ └── sirblobman │ │ └── api │ │ └── nms │ │ ├── PlayerHandler_1_18_R2.java │ │ └── ServerHandler_1_18_R2.java ├── 1_19_R3 │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── github │ │ └── sirblobman │ │ └── api │ │ └── nms │ │ ├── PlayerHandler_1_19_R3.java │ │ └── ServerHandler_1_19_R3.java ├── 1_20_R1 │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── github │ │ └── sirblobman │ │ └── api │ │ └── nms │ │ ├── PlayerHandler_1_20_R1.java │ │ └── ServerHandler_1_20_R1.java ├── 1_20_R3 │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── github │ │ └── sirblobman │ │ └── api │ │ └── nms │ │ ├── PlayerHandler_1_20_R3.java │ │ └── ServerHandler_1_20_R3.java ├── 1_20_R4 │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── github │ │ └── sirblobman │ │ └── api │ │ └── nms │ │ ├── PlayerHandler_1_20_R4.java │ │ └── ServerHandler_1_20_R4.java ├── 1_21_R3 │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── github │ │ └── sirblobman │ │ └── api │ │ └── nms │ │ ├── PlayerHandler_1_21_R3.java │ │ └── ServerHandler_1_21_R3.java ├── 1_21_R4 │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── github │ │ └── sirblobman │ │ └── api │ │ └── nms │ │ ├── PlayerHandler_1_21_R4.java │ │ └── ServerHandler_1_21_R4.java ├── 1_21_R5 │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── github │ │ └── sirblobman │ │ └── api │ │ └── nms │ │ ├── ProblemReporter_1_21_R5.java │ │ ├── PlayerHandler_1_21_R5.java │ │ └── ServerHandler_1_21_R5.java ├── 1_21_R6 │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── github │ │ └── sirblobman │ │ └── api │ │ └── nms │ │ ├── ProblemReporter_1_21_R6.java │ │ ├── PlayerHandler_1_21_R6.java │ │ └── ServerHandler_1_21_R6.java ├── 1_21_R7 │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── github │ │ └── sirblobman │ │ └── api │ │ └── nms │ │ ├── ProblemReporter_1_21_R7.java │ │ ├── PlayerHandler_1_21_R6.java │ │ └── ServerHandler_1_21_R7.java └── handler │ └── build.gradle.kts ├── gradle.properties ├── core ├── gradle.properties └── src │ └── main │ ├── resources │ ├── language │ │ └── es_mx.lang.yml │ ├── config.yml │ └── language.yml │ └── java │ └── com │ └── github │ └── sirblobman │ └── api │ └── core │ └── command │ ├── blueslimecore │ ├── SubCommandHelp.java │ ├── SubCommandReload.java │ └── CommandBlueSlimeCore.java │ └── CommandItemToYML.java ├── menu ├── src │ └── main │ │ └── java │ │ └── com │ │ └── github │ │ └── sirblobman │ │ └── api │ │ └── menu │ │ ├── button │ │ ├── IButton.java │ │ ├── OpenMenuButton.java │ │ ├── NextPageButton.java │ │ ├── PreviousPageButton.java │ │ ├── ExitButton.java │ │ ├── OpenParentMenuButton.java │ │ └── QuickButton.java │ │ ├── task │ │ ├── CloseMenuTask.java │ │ ├── MenuOpenTask.java │ │ ├── AdvancedMenuRefreshLoopTask.java │ │ ├── AdvancedMenuInternalOpenTask.java │ │ └── AbstractMenuInternalOpenTask.java │ │ └── AbstractPagedMenu.java ├── modern │ └── build.gradle.kts └── build.gradle.kts ├── language ├── src │ └── main │ │ ├── java │ │ └── com │ │ │ └── github │ │ │ └── sirblobman │ │ │ └── api │ │ │ └── language │ │ │ ├── custom │ │ │ ├── ModifiableMessageType.java │ │ │ ├── PlayerListInfo.java │ │ │ └── ModifiableMessage.java │ │ │ ├── replacer │ │ │ ├── StringReplacer.java │ │ │ ├── LongReplacer.java │ │ │ ├── IntegerReplacer.java │ │ │ ├── ComponentReplacer.java │ │ │ ├── TranslatableReplacer.java │ │ │ ├── Replacer.java │ │ │ ├── FloatReplacer.java │ │ │ └── DoubleReplacer.java │ │ │ ├── Language.java │ │ │ ├── listener │ │ │ └── UpdateLocaleTask.java │ │ │ └── LanguageConfigurationComparator.java │ │ └── resources │ │ └── example_en_us.lang.yml └── build.gradle.kts ├── paper-helper ├── build.gradle.kts └── src │ └── main │ └── java │ └── com │ └── github │ └── sirblobman │ └── api │ └── utility │ └── paper │ └── ComponentConverter.java ├── configuration ├── build.gradle.kts └── src │ └── main │ └── java │ └── com │ └── github │ └── sirblobman │ └── api │ └── configuration │ ├── IResourceHolder.java │ ├── IConfigurable.java │ └── WrapperPluginResourceHolder.java ├── plugin ├── src │ └── main │ │ └── java │ │ └── com │ │ └── github │ │ └── sirblobman │ │ └── api │ │ └── plugin │ │ ├── IMultiVersionPlugin.java │ │ └── listener │ │ └── PluginListener.java └── build.gradle.kts ├── update ├── build.gradle.kts └── src │ └── main │ └── java │ └── com │ └── github │ └── sirblobman │ └── api │ └── update │ └── HangarInfo.java ├── bossbar └── build.gradle.kts ├── utility ├── build.gradle.kts └── src │ └── main │ └── java │ └── com │ └── github │ └── sirblobman │ └── api │ ├── language │ └── ComponentBungeeConverter.java │ └── utility │ ├── Validate.java │ └── ConfigurationHelper.java ├── command ├── build.gradle.kts └── src │ └── main │ └── java │ └── com │ └── github │ └── sirblobman │ └── api │ └── command │ ├── PlayerCommand.java │ └── ConsoleCommand.java ├── item ├── build.gradle.kts └── src │ └── main │ └── java │ └── com │ └── github │ └── sirblobman │ └── api │ └── item │ ├── LeatherArmorBuilder.java │ ├── ArmorType.java │ ├── SkullBuilder.java │ ├── BottleType.java │ └── PotionBuilder.java ├── shaded ├── src │ └── main │ │ └── resources │ │ └── included-dependencies.txt └── build.gradle.kts ├── .gitignore ├── settings.gradle.kts └── spigot.overview.phpBB /factions/abstract/build.gradle.kts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bungeecord/core/src/main/resources/hidden.yml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SirBlobman/BlueSlimeCore/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /bungeecord/abstract/build.gradle.kts: -------------------------------------------------------------------------------- 1 | dependencies { 2 | // Local Dependencies 3 | compileOnly(project(":utility")) 4 | } 5 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: gradle 4 | directory: "/" 5 | schedule: 6 | interval: daily 7 | open-pull-requests-limit: 10 8 | -------------------------------------------------------------------------------- /factions/SaberFactions/build.gradle.kts: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compileOnly(project(":factions:abstract")) 3 | compileOnly("com.github.saberllc:SaberFactions:1.6.9.5-4.1.6-BETA") 4 | } 5 | -------------------------------------------------------------------------------- /nms/1_8_R3/build.gradle.kts: -------------------------------------------------------------------------------- 1 | dependencies { 2 | // Local Dependencies 3 | compileOnly(project(":nms:abstract")) 4 | 5 | // Spigot NMS 6 | compileOnly("org.spigotmc:spigot:1.8.8-R0.1-SNAPSHOT") 7 | } 8 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.java.installations.fromEnv=JDK8,JDK16,JDK17,JDK21 2 | org.gradle.parallel=false 3 | org.gradle.caching=true 4 | 5 | version.api=2.9-SNAPSHOT 6 | version.base=2.9.8 7 | version.beta=false 8 | -------------------------------------------------------------------------------- /nms/1_12_R1/build.gradle.kts: -------------------------------------------------------------------------------- 1 | dependencies { 2 | // Local Dependencies 3 | compileOnly(project(":nms:abstract")) 4 | 5 | // Spigot NMS 6 | compileOnly("org.spigotmc:spigot:1.12.2-R0.1-SNAPSHOT") 7 | } 8 | -------------------------------------------------------------------------------- /factions/handler/src/main/java/com/github/sirblobman/api/factions/FactionsNotFoundException.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.factions; 2 | 3 | public final class FactionsNotFoundException extends RuntimeException { 4 | // Empty Class 5 | } 6 | -------------------------------------------------------------------------------- /bungeecord/LuckPerms/build.gradle.kts: -------------------------------------------------------------------------------- 1 | dependencies { 2 | // Local Dependencies 3 | compileOnly(project(":utility")) 4 | compileOnly(project(":bungeecord:abstract")) 5 | 6 | // LuckPerms API 7 | compileOnly("net.luckperms:api:5.5") 8 | } 9 | -------------------------------------------------------------------------------- /nms/1_16_R3/build.gradle.kts: -------------------------------------------------------------------------------- 1 | dependencies { 2 | // Local Dependencies 3 | compileOnly(project(":nms:abstract")) 4 | compileOnly(project(":nms:modern-nbt")) 5 | 6 | // Spigot NMS 7 | compileOnly("org.spigotmc:spigot:1.16.5-R0.1-SNAPSHOT") 8 | } 9 | -------------------------------------------------------------------------------- /core/gradle.properties: -------------------------------------------------------------------------------- 1 | plugin.description=A core plugin with useful libraries. 2 | bukkit.plugin.name=BlueSlimeCore 3 | bukkit.plugin.prefix=Blue Slime Core 4 | bukkit.plugin.website=https://www.spigotmc.org/resources/83189/ 5 | bukkit.plugin.main=com.github.sirblobman.api.core.CorePlugin 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /nms/abstract/build.gradle.kts: -------------------------------------------------------------------------------- 1 | repositories { 2 | maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") 3 | maven("https://oss.sonatype.org/service/local/repositories/snapshots/content/") 4 | } 5 | 6 | dependencies { 7 | // Spigot API 8 | compileOnly("org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT") 9 | } 10 | -------------------------------------------------------------------------------- /factions/FactionsUUID/build.gradle.kts: -------------------------------------------------------------------------------- 1 | repositories { 2 | maven("https://ci.ender.zone/plugin/repository/everything/") 3 | } 4 | 5 | dependencies { 6 | // Local Dependencies 7 | compileOnly(project(":factions:abstract")) 8 | 9 | // FactionsUUID (Modern) 10 | compileOnly("com.massivecraft:Factions:1.6.9.5-U0.6.37") 11 | } 12 | -------------------------------------------------------------------------------- /factions/FactionsUUID-Legacy/build.gradle.kts: -------------------------------------------------------------------------------- 1 | repositories { 2 | maven("https://ci.ender.zone/plugin/repository/everything/") 3 | } 4 | 5 | dependencies { 6 | // Local Dependencies 7 | compileOnly(project(":factions:abstract")) 8 | 9 | // FactionsUUID (Legacy) 10 | compileOnly("com.massivecraft:Factions:1.6.9.5-U0.2.1-RC") 11 | } 12 | -------------------------------------------------------------------------------- /menu/src/main/java/com/github/sirblobman/api/menu/button/IButton.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.menu.button; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.event.inventory.InventoryClickEvent; 6 | 7 | @FunctionalInterface 8 | public interface IButton { 9 | void onClick(@NotNull InventoryClickEvent e); 10 | } 11 | -------------------------------------------------------------------------------- /bungeecord/BungeePerms/build.gradle.kts: -------------------------------------------------------------------------------- 1 | repositories { 2 | maven("https://repo.wea-ondara.net/repository/maven-releases/") 3 | } 4 | 5 | dependencies { 6 | // Local Dependencies 7 | compileOnly(project(":utility")) 8 | compileOnly(project(":bungeecord:abstract")) 9 | 10 | // BungeePerms 11 | compileOnly("net.alpenblock:BungeePerms:4.0-dev-146") 12 | } 13 | -------------------------------------------------------------------------------- /bungeecord/PremiumVanish/build.gradle.kts: -------------------------------------------------------------------------------- 1 | repositories { 2 | maven("https://nexus.sirblobman.xyz/proxy-public/") 3 | } 4 | 5 | dependencies { 6 | // Local Dependencies 7 | compileOnly(project(":utility")) 8 | compileOnly(project(":bungeecord:abstract")) 9 | 10 | // PremiumVanish API 11 | compileOnly("com.github.LeonMangler:PremiumVanishAPI:2.9.0-4") 12 | } 13 | -------------------------------------------------------------------------------- /factions/LegacyFactions/build.gradle.kts: -------------------------------------------------------------------------------- 1 | repositories { 2 | maven("https://nexus.sirblobman.xyz/proxy-public/") 3 | } 4 | 5 | dependencies { 6 | // Local Dependencies 7 | compileOnly(project(":factions:abstract")) 8 | 9 | // LegacyFactions 10 | compileOnly("com.github.redstone:LegacyFactions:v1.4.4") { 11 | exclude("mkremins", "fanciful") 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /language/src/main/java/com/github/sirblobman/api/language/custom/ModifiableMessageType.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.language.custom; 2 | 3 | public enum ModifiableMessageType { 4 | /** 5 | * A message sent to the chat box. 6 | */ 7 | CHAT, 8 | 9 | /** 10 | * A message shown in the action bar above the inventory hotbar. 11 | */ 12 | ACTION_BAR 13 | } 14 | -------------------------------------------------------------------------------- /paper-helper/build.gradle.kts: -------------------------------------------------------------------------------- 1 | repositories { 2 | maven("https://repo.papermc.io/repository/maven-public/") 3 | } 4 | 5 | dependencies { 6 | // Local Dependencies 7 | compileOnly(project(path = ":shaded", configuration = "shadow")) 8 | compileOnly(project(":utility")) 9 | 10 | // Paper API 11 | compileOnly("com.destroystokyo.paper:paper-api:1.16.5-R0.1-SNAPSHOT") 12 | } 13 | -------------------------------------------------------------------------------- /menu/modern/build.gradle.kts: -------------------------------------------------------------------------------- 1 | repositories { 2 | maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") 3 | maven("https://oss.sonatype.org/service/local/repositories/snapshots/content/") 4 | } 5 | 6 | dependencies { 7 | // Local Dependencies 8 | compileOnly(project(":menu")) 9 | 10 | // Spigot API 11 | compileOnly("org.spigotmc:spigot-api:1.21.8-R0.1-SNAPSHOT") 12 | } 13 | -------------------------------------------------------------------------------- /configuration/build.gradle.kts: -------------------------------------------------------------------------------- 1 | repositories { 2 | maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") 3 | maven("https://oss.sonatype.org/service/local/repositories/snapshots/content/") 4 | } 5 | 6 | dependencies { 7 | // Local Dependencies 8 | compileOnly(project(":utility")) 9 | 10 | // Spigot API 11 | compileOnly("org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT") 12 | } 13 | -------------------------------------------------------------------------------- /nms/abstract/src/main/java/com/github/sirblobman/api/nbt/CustomNbtContext.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nbt; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | public interface CustomNbtContext { 6 | /** 7 | * Creates a new and empty nbt container instance. 8 | * 9 | * @return the new container instance 10 | */ 11 | @NotNull CustomNbtContainer newCustomNbtContainer(); 12 | } 13 | -------------------------------------------------------------------------------- /nms/fallback/build.gradle.kts: -------------------------------------------------------------------------------- 1 | repositories { 2 | maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") 3 | maven("https://oss.sonatype.org/service/local/repositories/snapshots/content/") 4 | } 5 | 6 | dependencies { 7 | // Local Dependencies 8 | compileOnly(project(":nms:abstract")) 9 | 10 | // Spigot API 11 | compileOnly("org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT") 12 | } 13 | -------------------------------------------------------------------------------- /nms/modern-nbt/build.gradle.kts: -------------------------------------------------------------------------------- 1 | repositories { 2 | maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") 3 | maven("https://oss.sonatype.org/service/local/repositories/snapshots/content/") 4 | } 5 | 6 | dependencies { 7 | // Local Dependencies 8 | compileOnly(project(":nms:abstract")) 9 | 10 | // Spigot API 11 | compileOnly("org.spigotmc:spigot-api:1.14.4-R0.1-SNAPSHOT") 12 | } 13 | -------------------------------------------------------------------------------- /nms/paper/build.gradle.kts: -------------------------------------------------------------------------------- 1 | repositories { 2 | maven("https://repo.papermc.io/repository/maven-public/") 3 | } 4 | 5 | dependencies { 6 | // Local Dependencies 7 | compileOnly(project(":nms:abstract")) 8 | compileOnly(project(":nms:modern-nbt")) 9 | compileOnly(project(":paper-helper")) 10 | 11 | // Paper API 12 | compileOnly("com.destroystokyo.paper:paper-api:1.16.5-R0.1-SNAPSHOT") 13 | } 14 | -------------------------------------------------------------------------------- /nms/scoreboard/build.gradle.kts: -------------------------------------------------------------------------------- 1 | repositories { 2 | maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") 3 | maven("https://oss.sonatype.org/service/local/repositories/snapshots/content/") 4 | } 5 | 6 | dependencies { 7 | // Local Dependencies 8 | compileOnly(project(":nms:abstract")) 9 | 10 | // Spigot API 11 | compileOnly("org.spigotmc:spigot-api:1.13.2-R0.1-SNAPSHOT") 12 | } 13 | -------------------------------------------------------------------------------- /plugin/src/main/java/com/github/sirblobman/api/plugin/IMultiVersionPlugin.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.plugin; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import com.github.sirblobman.api.folia.FoliaPlugin; 6 | import com.github.sirblobman.api.nms.MultiVersionHandler; 7 | 8 | public interface IMultiVersionPlugin extends FoliaPlugin { 9 | @NotNull MultiVersionHandler getMultiVersionHandler(); 10 | } 11 | -------------------------------------------------------------------------------- /factions/MassiveCore-Factions/build.gradle.kts: -------------------------------------------------------------------------------- 1 | dependencies { 2 | // Local Dependencies 3 | compileOnly(project(":factions:abstract")) 4 | 5 | // Required for some Javadocs 6 | compileOnly("org.spigotmc:spigot-api:1.12.2-R0.1-SNAPSHOT") // Spigot API 7 | 8 | // MassiveCore + Factions 9 | compileOnly("com.massivecraft.massivecore:MassiveCore:2.14.0") 10 | compileOnly("com.massivecraft.factions:Factions:2.14.0") 11 | } 12 | -------------------------------------------------------------------------------- /bungeecord/build.gradle.kts: -------------------------------------------------------------------------------- 1 | tasks.named("jar") { 2 | enabled = false 3 | } 4 | 5 | subprojects { 6 | repositories { 7 | maven("https://oss.sonatype.org/service/local/repositories/snapshots/content/") // BungeeCord API 8 | maven("https://libraries.minecraft.net/") // BungeeCord Protocol 9 | } 10 | 11 | dependencies { 12 | // BungeeCord API 13 | compileOnly("net.md-5:bungeecord-api:1.21-R0.4") 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-requests.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature Requests 3 | about: Make a suggestion or submit a feature you already coded 4 | title: '' 5 | labels: Feature Request 6 | assignees: '' 7 | 8 | --- 9 | 10 | **What version of Spigot are you currently using?** 11 | You can do `/bukkit:version` to find out 12 | 13 | **What version of SirBlobmanCore are you using?** 14 | You can do `/about SirBlobmanCore` to find out 15 | 16 | **What is your feature request?** 17 | -------------------------------------------------------------------------------- /update/build.gradle.kts: -------------------------------------------------------------------------------- 1 | repositories { 2 | maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") 3 | maven("https://oss.sonatype.org/service/local/repositories/snapshots/content/") 4 | } 5 | 6 | dependencies { 7 | // Local Dependencies 8 | compileOnly(project(":utility")) 9 | compileOnly(project(path = ":shaded", configuration = "shadow")) 10 | 11 | // Spigot API 12 | compileOnly("org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT") 13 | } 14 | -------------------------------------------------------------------------------- /bossbar/build.gradle.kts: -------------------------------------------------------------------------------- 1 | repositories { 2 | maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") 3 | maven("https://oss.sonatype.org/service/local/repositories/snapshots/content/") 4 | } 5 | 6 | dependencies { 7 | // Local Dependencies 8 | compileOnly(project(path = ":shaded", configuration = "shadow")) 9 | compileOnly(project(":utility")) 10 | 11 | // Spigot API 12 | compileOnly("org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT") 13 | } 14 | -------------------------------------------------------------------------------- /utility/build.gradle.kts: -------------------------------------------------------------------------------- 1 | repositories { 2 | maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") 3 | maven("https://oss.sonatype.org/service/local/repositories/snapshots/content/") 4 | } 5 | 6 | dependencies { 7 | // Local Dependencies 8 | compileOnly(project(path = ":shaded", configuration = "shadow")) 9 | 10 | // Spigot API 11 | compileOnly("net.md-5:bungeecord-chat:1.21-R0.4") 12 | compileOnly("org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT") { 13 | exclude("net.md-5", "bungeecord-chat") 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /factions/build.gradle.kts: -------------------------------------------------------------------------------- 1 | tasks.named("jar") { 2 | enabled = false 3 | } 4 | 5 | subprojects { 6 | repositories { 7 | maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") 8 | maven("https://oss.sonatype.org/service/local/repositories/snapshots/content/") 9 | maven("https://nexus.sirblobman.xyz/public/") 10 | } 11 | 12 | dependencies { 13 | // Local Dependencies 14 | compileOnly(project(":utility")) 15 | 16 | // Spigot API 17 | compileOnly("org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT") 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /command/build.gradle.kts: -------------------------------------------------------------------------------- 1 | repositories { 2 | maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") 3 | maven("https://oss.sonatype.org/service/local/repositories/snapshots/content/") 4 | } 5 | 6 | dependencies { 7 | // Local Dependencies 8 | compileOnly(project(path = ":shaded", configuration = "shadow")) 9 | compileOnly(project(":utility")) 10 | compileOnly(project(":language")) 11 | compileOnly(project(":plugin")) 12 | compileOnly(project(":paper-helper")) 13 | 14 | // Spigot API 15 | compileOnly("org.spigotmc:spigot-api:1.9.4-R0.1-SNAPSHOT") 16 | } 17 | -------------------------------------------------------------------------------- /update/src/main/java/com/github/sirblobman/api/update/HangarInfo.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.update; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | public final class HangarInfo { 6 | private final String author; 7 | private final String project; 8 | 9 | public HangarInfo(@NotNull String author, @NotNull String project) { 10 | this.author = author; 11 | this.project = project; 12 | } 13 | 14 | public @NotNull String getAuthor() { 15 | return author; 16 | } 17 | 18 | public @NotNull String getProject() { 19 | return project; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /nms/1_8_R3/src/main/java/com/github/sirblobman/api/nbt/CustomNbtContext_1_8_R3.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nbt; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | public final class CustomNbtContext_1_8_R3 implements CustomNbtContext { 6 | private final CustomNbtTypeRegistry_1_8_R3 registry; 7 | 8 | public CustomNbtContext_1_8_R3(CustomNbtTypeRegistry_1_8_R3 registry) { 9 | this.registry = registry; 10 | } 11 | 12 | @Override 13 | public @NotNull CustomNbtContainer_1_8_R3 newCustomNbtContainer() { 14 | return new CustomNbtContainer_1_8_R3(this.registry); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /bungeecord/abstract/src/main/java/com/github/sirblobman/api/bungeecord/configuration/IHookPlugin.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.bungeecord.configuration; 2 | 3 | import com.github.sirblobman.api.bungeecord.hook.permission.IPermissionHook; 4 | import com.github.sirblobman.api.bungeecord.hook.vanish.IVanishHook; 5 | 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | public interface IHookPlugin { 9 | @NotNull IPermissionHook getDefaultPermissionHook(); 10 | 11 | @NotNull IVanishHook getDefaultVanishHook(); 12 | 13 | @NotNull IPermissionHook getPermissionHook(); 14 | 15 | @NotNull IVanishHook getVanishHook(); 16 | } 17 | -------------------------------------------------------------------------------- /nms/1_12_R1/src/main/java/com/github/sirblobman/api/nbt/CustomNbtContext_1_12_R1.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nbt; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | public final class CustomNbtContext_1_12_R1 implements CustomNbtContext { 6 | private final CustomNbtTypeRegistry_1_12_R1 registry; 7 | 8 | public CustomNbtContext_1_12_R1(@NotNull CustomNbtTypeRegistry_1_12_R1 registry) { 9 | this.registry = registry; 10 | } 11 | 12 | @Override 13 | public @NotNull CustomNbtContainer_1_12_R1 newCustomNbtContainer() { 14 | return new CustomNbtContainer_1_12_R1(this.registry); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /plugin/build.gradle.kts: -------------------------------------------------------------------------------- 1 | repositories { 2 | maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") 3 | maven("https://oss.sonatype.org/service/local/repositories/snapshots/content/") 4 | } 5 | 6 | dependencies { 7 | // Local Dependencies 8 | compileOnly(project(path = ":shaded", configuration = "shadow")) 9 | compileOnly(project(path = ":nms:handler", configuration = "shadow")) 10 | compileOnly(project(":utility")) 11 | compileOnly(project(":configuration")) 12 | compileOnly(project(":language")) 13 | 14 | // Spigot API 15 | compileOnly("org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT") 16 | } 17 | -------------------------------------------------------------------------------- /bungeecord/abstract/src/main/java/com/github/sirblobman/api/bungeecord/configuration/IResourceHolder.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.bungeecord.configuration; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | 6 | import java.io.File; 7 | import java.io.InputStream; 8 | import java.util.logging.Logger; 9 | 10 | /** 11 | * Used to indicate an object that can store/save files and log information. 12 | */ 13 | public interface IResourceHolder { 14 | @NotNull File getDataFolder(); 15 | 16 | @Nullable InputStream getResource(String name); 17 | 18 | @NotNull Logger getLogger(); 19 | } 20 | -------------------------------------------------------------------------------- /item/build.gradle.kts: -------------------------------------------------------------------------------- 1 | repositories { 2 | maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") 3 | maven("https://oss.sonatype.org/service/local/repositories/snapshots/content/") 4 | } 5 | 6 | dependencies { 7 | // Local Dependencies 8 | compileOnly(project(path = ":shaded", configuration = "shadow")) 9 | compileOnly(project(":utility")) 10 | compileOnly(project(":paper-helper")) 11 | compileOnly(project(":plugin")) 12 | compileOnly(project(":nms:abstract")) 13 | compileOnly(project(":nms:handler")) 14 | 15 | // Spigot API 16 | compileOnly("org.spigotmc:spigot-api:1.14.4-R0.1-SNAPSHOT") 17 | } 18 | -------------------------------------------------------------------------------- /bungeecord/core/src/main/resources/config.yml: -------------------------------------------------------------------------------- 1 | # Enable these hooks to use them when necessary. 2 | hooks: 3 | LuckPerms: false 4 | BungeePerms: false 5 | PremiumVanish: false 6 | 7 | # This section is only applicable when no permission plugin hook is enabled above. 8 | # To apply a user to a group, simply give the permission "sbcore.ranks." 9 | # (for example, mod would be "sbcore.ranks.mod") 10 | # Note: The higher the weight, the higher up in the list the group will be. 11 | ranks: 12 | admin: 13 | prefix: "&c[Admin]" 14 | suffix: "" 15 | weight: 10 16 | 17 | mod: 18 | prefix: "&e[Mod]" 19 | suffix: "" 20 | weight: 5 21 | -------------------------------------------------------------------------------- /shaded/src/main/resources/included-dependencies.txt: -------------------------------------------------------------------------------- 1 | This jar shades the following dependencies: 2 | - bStats (https://bstats.org/getting-started/include-metrics) 3 | - CryptoMorin XSeries (https://github.com/CryptoMorin/XSeries#getting-started) 4 | - Kyori Adventure (https://docs.advntr.dev/getting-started.html) 5 | - Folia Helper (https://github.com/SirBlobman/Folia-Helper/) 6 | 7 | ViaVersion: 8 | Kyori Adventure adds "ViaVersion" to soft-depend list to prevent class issues. 9 | See https://github.com/KyoriPowered/adventure-platform/blob/master/platform-bukkit/src/main/java/net/kyori/adventure/platform/bukkit/BukkitAudiencesImpl.java#L179-L189 10 | for further details on this. 11 | -------------------------------------------------------------------------------- /language/build.gradle.kts: -------------------------------------------------------------------------------- 1 | repositories { 2 | maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") 3 | maven("https://oss.sonatype.org/service/local/repositories/snapshots/content/") 4 | maven("https://repo.extendedclip.com/content/repositories/placeholderapi/") 5 | } 6 | 7 | dependencies { 8 | // Local Dependencies 9 | compileOnly(project(path = ":shaded", configuration = "shadow")) 10 | compileOnly(project(":utility")) 11 | compileOnly(project(":configuration")) 12 | 13 | // Spigot API 14 | compileOnly("org.spigotmc:spigot-api:1.12.2-R0.1-SNAPSHOT") 15 | 16 | // PlaceholderAPI 17 | compileOnly("me.clip:placeholderapi:2.11.5") 18 | } 19 | -------------------------------------------------------------------------------- /factions/FactionsUUID-4/build.gradle.kts: -------------------------------------------------------------------------------- 1 | repositories { 2 | exclusiveContent { 3 | forRepository { 4 | maven("https://dependency.download/releases/") 5 | } 6 | 7 | filter { 8 | includeGroup("dev.kitteh") 9 | } 10 | } 11 | } 12 | 13 | dependencies { 14 | // Local Dependencies 15 | compileOnly(project(":factions:abstract")) 16 | 17 | // FactionsUUID (v4) 18 | compileOnly("dev.kitteh:factions:4.0.0") 19 | 20 | // Adventure Extras 21 | compileOnly("net.kyori:adventure-text-minimessage:4.25.0") 22 | compileOnly("net.kyori:adventure-text-serializer-gson:4.25.0") 23 | compileOnly("net.kyori:adventure-text-serializer-legacy:4.25.0") 24 | } 25 | -------------------------------------------------------------------------------- /menu/src/main/java/com/github/sirblobman/api/menu/button/OpenMenuButton.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.menu.button; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.entity.Player; 6 | 7 | import com.github.sirblobman.api.menu.IMenu; 8 | 9 | public final class OpenMenuButton extends QuickButton { 10 | private final IMenu menu; 11 | 12 | public OpenMenuButton(@NotNull IMenu menu) { 13 | this.menu = menu; 14 | } 15 | 16 | @Override 17 | public void onLeftClick(@NotNull Player player, boolean shift) { 18 | IMenu menu = getMenu(); 19 | menu.open(); 20 | } 21 | 22 | private @NotNull IMenu getMenu() { 23 | return this.menu; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /menu/build.gradle.kts: -------------------------------------------------------------------------------- 1 | repositories { 2 | maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") 3 | maven("https://oss.sonatype.org/service/local/repositories/snapshots/content/") 4 | } 5 | 6 | dependencies { 7 | // Local Dependencies 8 | compileOnly(project(path = ":shaded", configuration = "shadow")) 9 | compileOnly(project(":utility")) 10 | compileOnly(project(":paper-helper")) 11 | compileOnly(project(":language")) 12 | compileOnly(project(":item")) 13 | compileOnly(project(":nms:abstract")) 14 | compileOnly(project(":nms:handler")) 15 | compileOnly(project(":plugin")) 16 | 17 | // Spigot API 18 | compileOnly("org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT") 19 | } 20 | -------------------------------------------------------------------------------- /nms/fallback/src/main/java/com/github/sirblobman/api/nbt/CustomNbtContext_Fallback.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nbt; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.plugin.Plugin; 6 | 7 | public final class CustomNbtContext_Fallback implements CustomNbtContext { 8 | private final Plugin plugin; 9 | 10 | public CustomNbtContext_Fallback(@NotNull Plugin plugin) { 11 | this.plugin = plugin; 12 | } 13 | 14 | private @NotNull Plugin getPlugin() { 15 | return this.plugin; 16 | } 17 | 18 | @Override 19 | public @NotNull CustomNbtContainer newCustomNbtContainer() { 20 | Plugin plugin = getPlugin(); 21 | return new CustomNbtContainer_Fallback(plugin); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /menu/src/main/java/com/github/sirblobman/api/menu/task/CloseMenuTask.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.menu.task; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.entity.HumanEntity; 6 | import org.bukkit.plugin.Plugin; 7 | 8 | import com.github.sirblobman.api.folia.details.EntityTaskDetails; 9 | 10 | public final class CloseMenuTask extends EntityTaskDetails { 11 | public CloseMenuTask(@NotNull Plugin plugin, @NotNull HumanEntity entity) { 12 | super(plugin, entity); 13 | setDelay(2L); 14 | } 15 | 16 | @Override 17 | public void run() { 18 | HumanEntity entity = getEntity(); 19 | if (entity != null) { 20 | entity.closeInventory(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /bungeecord/abstract/src/main/java/com/github/sirblobman/api/bungeecord/hook/IHook.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.bungeecord.hook; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import net.md_5.bungee.api.plugin.Plugin; 6 | 7 | public interface IHook { 8 | /** 9 | * @return The plugin that will be using the hook. 10 | */ 11 | @NotNull Plugin plugin(); 12 | 13 | /** 14 | * Check if the plugin being hooked is disabled or does not exist. 15 | * 16 | * @return {@code true} if the hook doesn't exist on the proxy, otherwise {@code false}. 17 | */ 18 | boolean isDisabled(); 19 | 20 | default boolean hasListener() { 21 | return false; 22 | } 23 | 24 | default void registerListener() { 25 | // Do Nothing 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug Report 3 | about: Did you find a glitch or bug? Click here to report it. 4 | title: '' 5 | labels: Bug 6 | assignees: '' 7 | --- 8 | 9 | **Describe the bug** 10 | A clear and concise description of what the bug is. 11 | 12 | **To Reproduce** 13 | How can I see the issue for myself? Please explain how it happened. 14 | 15 | **Expected behavior** 16 | A clear and concise description of what you expected to happen. 17 | 18 | **Screenshots** 19 | If applicable, add screenshots or videos to help explain your problem. 20 | 21 | **Minecraft Version** 22 | 23 | - Do `/bukkit:version` to find out 24 | 25 | **SirBlobmanCore Version:** 26 | 27 | - Do `/about SirBlobmanCore` to find out 28 | 29 | **Additional context** 30 | Add any other information about the problem here. 31 | -------------------------------------------------------------------------------- /menu/src/main/java/com/github/sirblobman/api/menu/button/NextPageButton.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.menu.button; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.entity.Player; 6 | 7 | import com.github.sirblobman.api.menu.AbstractPagedMenu; 8 | 9 | public final class NextPageButton extends QuickButton { 10 | private final AbstractPagedMenu pagedMenu; 11 | 12 | public NextPageButton(@NotNull AbstractPagedMenu pagedMenu) { 13 | this.pagedMenu = pagedMenu; 14 | } 15 | 16 | @Override 17 | public void onLeftClick(@NotNull Player player, boolean shift) { 18 | AbstractPagedMenu pagedMenu = getPagedMenu(); 19 | pagedMenu.openNextPage(); 20 | } 21 | 22 | private @NotNull AbstractPagedMenu getPagedMenu() { 23 | return this.pagedMenu; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /factions/FactionsX/build.gradle.kts: -------------------------------------------------------------------------------- 1 | fun getEnvOrProp(variableName: String, propertyName: String): String { 2 | val environmentProvider = providers.environmentVariable(variableName) 3 | val propertyProvider = providers.gradleProperty(propertyName) 4 | return environmentProvider.orElse(propertyProvider).orElse("").get() 5 | } 6 | 7 | repositories { 8 | maven("https://nexus.sirblobman.xyz/private/") { 9 | credentials { 10 | username = getEnvOrProp("MAVEN_DEPLOY_USR", "maven.username.sirblobman") 11 | password = getEnvOrProp("MAVEN_DEPLOY_PSW", "maven.password.sirblobman") 12 | } 13 | } 14 | } 15 | 16 | dependencies { 17 | // Local Dependencies 18 | compileOnly(project(":factions:abstract")) 19 | 20 | // FactionsX 21 | compileOnly("net.prosavage.factionsx:FactionsX:1.2-STABLE") 22 | } 23 | -------------------------------------------------------------------------------- /bungeecord/abstract/src/main/java/com/github/sirblobman/api/bungeecord/configuration/ConfigurablePlugin.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.bungeecord.configuration; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import net.md_5.bungee.api.plugin.Plugin; 6 | 7 | public abstract class ConfigurablePlugin extends Plugin { 8 | private final ConfigurationManager configurationManager; 9 | 10 | public ConfigurablePlugin() { 11 | this.configurationManager = new ConfigurationManager(this); 12 | } 13 | 14 | public @NotNull ConfigurationManager getConfigurationManager() { 15 | return this.configurationManager; 16 | } 17 | 18 | @Override 19 | public abstract void onLoad(); 20 | 21 | @Override 22 | public abstract void onEnable(); 23 | 24 | @Override 25 | public abstract void onDisable(); 26 | } 27 | -------------------------------------------------------------------------------- /language/src/main/java/com/github/sirblobman/api/language/replacer/StringReplacer.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.language.replacer; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import com.github.sirblobman.api.shaded.adventure.text.Component; 6 | 7 | public final class StringReplacer extends Replacer { 8 | private final String replacement; 9 | 10 | public StringReplacer(@NotNull String target, @NotNull String replacement) { 11 | super(target); 12 | this.replacement = replacement; 13 | } 14 | 15 | @Override 16 | public @NotNull Component getReplacement() { 17 | String replacement = getReplacementString(); 18 | return Component.text(replacement); 19 | } 20 | 21 | @Override 22 | public @NotNull String getReplacementString() { 23 | return this.replacement; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /menu/src/main/java/com/github/sirblobman/api/menu/button/PreviousPageButton.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.menu.button; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.entity.Player; 6 | 7 | import com.github.sirblobman.api.menu.AbstractPagedMenu; 8 | 9 | public final class PreviousPageButton extends QuickButton { 10 | private final AbstractPagedMenu pagedMenu; 11 | 12 | public PreviousPageButton(@NotNull AbstractPagedMenu pagedMenu) { 13 | this.pagedMenu = pagedMenu; 14 | } 15 | 16 | @Override 17 | public void onLeftClick(@NotNull Player player, boolean shift) { 18 | AbstractPagedMenu pagedMenu = getPagedMenu(); 19 | pagedMenu.openPreviousPage(); 20 | } 21 | 22 | private @NotNull AbstractPagedMenu getPagedMenu() { 23 | return this.pagedMenu; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /core/src/main/resources/language/es_mx.lang.yml: -------------------------------------------------------------------------------- 1 | parent: "en_us" 2 | language-name: "es_mx" 3 | decimal-format: "0.00" 4 | 5 | language-test: 6 | invalid-language: "el jugador no tiene un idioma selecionado." 7 | language-code: "Codigo de Idioma: {language_code}" 8 | java-locale: "Java Locale: {java_locale}" 9 | message: "mensaje de prueba" 10 | broadcast: "anuncio de prueba" 11 | action-bar: "barra de aciones de prueba" 12 | sound: 13 | sound: "minecraft:entity.cow.hurt" 14 | category: "master" 15 | volume: "0.5" 16 | pitch: "2.0" 17 | title: 18 | title: "título de prueba" 19 | subtitle: "subtítulo de prueba" 20 | fade-in: 20 21 | stay: 70 22 | fade-out: 20 23 | complete: "la prueba de idioma ha terminado." 24 | -------------------------------------------------------------------------------- /language/src/main/java/com/github/sirblobman/api/language/custom/PlayerListInfo.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.language.custom; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import com.github.sirblobman.api.shaded.adventure.text.Component; 6 | 7 | public final class PlayerListInfo { 8 | private Component header; 9 | private Component footer; 10 | 11 | public PlayerListInfo() { 12 | this.header = Component.empty(); 13 | this.footer = Component.empty(); 14 | } 15 | 16 | public @NotNull Component getHeader() { 17 | return this.header; 18 | } 19 | 20 | public void setHeader(@NotNull Component header) { 21 | this.header = header; 22 | } 23 | 24 | public @NotNull Component getFooter() { 25 | return this.footer; 26 | } 27 | 28 | public void setFooter(@NotNull Component footer) { 29 | this.footer = footer; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /language/src/main/resources/example_en_us.lang.yml: -------------------------------------------------------------------------------- 1 | # BlueSlimeCore uses MiniMessage and Adventure to send messages and sounds. 2 | 3 | # Example Message (type not custom) 4 | message-one: "Hello!" 5 | 6 | # Example Message (type is custom) 7 | # The type of message can be changed to ACTION_BAR or CHAT if the default is not what you want. 8 | message-two: 9 | type: ACTION_BAR 10 | content: "Testing 123!" 11 | 12 | # Example Sound 13 | sound-one: 14 | sound: "minecraft:music_disc.13" # Sounds from resource packs can also be played 15 | category: "master" 16 | volume: 1.0 17 | pitch: 1.0 18 | 19 | # Example Title 20 | # The 'title' and 'subtitle' are normal messages. 21 | # 'fade-in', 'stay', and 'fade-out' are integers for the amount of ticks. 22 | title-one: 23 | title: "Hello!" 24 | subtitle: "This is a subtitle." 25 | fade-in: 10 26 | stay: 70 27 | fade-out: 20 28 | -------------------------------------------------------------------------------- /language/src/main/java/com/github/sirblobman/api/language/replacer/LongReplacer.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.language.replacer; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import com.github.sirblobman.api.shaded.adventure.text.Component; 6 | 7 | public final class LongReplacer extends Replacer { 8 | private final long replacement; 9 | 10 | public LongReplacer(String target, long replacement) { 11 | super(target); 12 | this.replacement = replacement; 13 | } 14 | 15 | private long getLong() { 16 | return this.replacement; 17 | } 18 | 19 | @Override 20 | public @NotNull Component getReplacement() { 21 | long replacement = getLong(); 22 | return Component.text(replacement); 23 | } 24 | 25 | @Override 26 | public @NotNull String getReplacementString() { 27 | long replacement = getLong(); 28 | return Long.toString(replacement); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /language/src/main/java/com/github/sirblobman/api/language/custom/ModifiableMessage.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.language.custom; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import com.github.sirblobman.api.shaded.adventure.text.Component; 6 | 7 | public final class ModifiableMessage { 8 | private Component message; 9 | private ModifiableMessageType type; 10 | 11 | public ModifiableMessage() { 12 | this.message = Component.empty(); 13 | this.type = ModifiableMessageType.CHAT; 14 | } 15 | 16 | public @NotNull Component getMessage() { 17 | return this.message; 18 | } 19 | 20 | public void setMessage(@NotNull Component message) { 21 | this.message = message; 22 | } 23 | 24 | public @NotNull ModifiableMessageType getType() { 25 | return this.type; 26 | } 27 | 28 | public void setType(@NotNull ModifiableMessageType type) { 29 | this.type = type; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /nms/build.gradle.kts: -------------------------------------------------------------------------------- 1 | fun getEnvOrProp(variableName: String, propertyName: String): String { 2 | val environmentProvider = providers.environmentVariable(variableName) 3 | val propertyProvider = providers.gradleProperty(propertyName) 4 | return environmentProvider.orElse(propertyProvider).orElse("").get() 5 | } 6 | 7 | tasks.named("jar") { 8 | enabled = false 9 | } 10 | 11 | subprojects { 12 | repositories { 13 | maven("https://nexus.sirblobman.xyz/private/") { 14 | credentials { 15 | username = getEnvOrProp("MAVEN_DEPLOY_USR", "maven.username.sirblobman") 16 | password = getEnvOrProp("MAVEN_DEPLOY_PSW", "maven.password.sirblobman") 17 | } 18 | } 19 | 20 | mavenLocal() 21 | } 22 | 23 | dependencies { 24 | // Local Dependencies 25 | compileOnly(project(path = ":shaded", configuration = "shadow")) 26 | compileOnly(project(":utility")) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /language/src/main/java/com/github/sirblobman/api/language/replacer/IntegerReplacer.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.language.replacer; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import com.github.sirblobman.api.shaded.adventure.text.Component; 6 | 7 | public final class IntegerReplacer extends Replacer { 8 | private final int replacement; 9 | 10 | public IntegerReplacer(@NotNull String target, int replacement) { 11 | super(target); 12 | this.replacement = replacement; 13 | } 14 | 15 | private int getInteger() { 16 | return this.replacement; 17 | } 18 | 19 | @Override 20 | public @NotNull Component getReplacement() { 21 | int replacement = getInteger(); 22 | return Component.text(replacement); 23 | } 24 | 25 | @Override 26 | public @NotNull String getReplacementString() { 27 | int replacement = getInteger(); 28 | return Integer.toString(replacement); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /menu/src/main/java/com/github/sirblobman/api/menu/task/MenuOpenTask.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.menu.task; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.entity.Player; 6 | import org.bukkit.plugin.Plugin; 7 | 8 | import com.github.sirblobman.api.folia.details.EntityTaskDetails; 9 | import com.github.sirblobman.api.menu.IMenu; 10 | 11 | public final class MenuOpenTask extends EntityTaskDetails { 12 | private final IMenu menu; 13 | 14 | public MenuOpenTask(@NotNull Plugin plugin, @NotNull Player entity, @NotNull IMenu menu) { 15 | super(plugin, entity); 16 | this.menu = menu; 17 | } 18 | 19 | private @NotNull IMenu getMenu() { 20 | return this.menu; 21 | } 22 | 23 | @Override 24 | public void run() { 25 | Player entity = getEntity(); 26 | if (entity == null) { 27 | return; 28 | } 29 | 30 | IMenu menu = getMenu(); 31 | menu.open(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /configuration/src/main/java/com/github/sirblobman/api/configuration/IResourceHolder.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.configuration; 2 | 3 | import java.io.File; 4 | import java.io.InputStream; 5 | import java.util.logging.Logger; 6 | 7 | import org.jetbrains.annotations.NotNull; 8 | import org.jetbrains.annotations.Nullable; 9 | 10 | /** 11 | * Used to indicate an object that can store/save files and log information. 12 | */ 13 | public interface IResourceHolder { 14 | /** 15 | * @return The name of this resource holder. 16 | * Must not have any spaces. 17 | */ 18 | @NotNull String getName(); 19 | 20 | /** 21 | * @return A string for creating Minecraft key objects. 22 | * Must be lowercase without spaces or special symbols, but can contain "_" 23 | */ 24 | @NotNull String getKeyName(); 25 | 26 | @NotNull File getDataFolder(); 27 | 28 | @Nullable InputStream getResource(@NotNull String name); 29 | 30 | @NotNull Logger getLogger(); 31 | } 32 | -------------------------------------------------------------------------------- /nms/abstract/src/main/java/com/github/sirblobman/api/nbt/custom/CustomNbtTypeBoolean.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nbt.custom; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import com.github.sirblobman.api.nbt.CustomNbtContext; 6 | import com.github.sirblobman.api.nbt.CustomNbtType; 7 | 8 | public final class CustomNbtTypeBoolean implements CustomNbtType { 9 | @Override 10 | public @NotNull Class getPrimitiveType() { 11 | return Byte.class; 12 | } 13 | 14 | @Override 15 | public @NotNull Class getComplexType() { 16 | return Boolean.class; 17 | } 18 | 19 | @Override 20 | public @NotNull Byte toPrimitive(@NotNull Boolean complex, @NotNull CustomNbtContext context) { 21 | return (byte) (complex ? 1 : 0); 22 | } 23 | 24 | @Override 25 | public @NotNull Boolean fromPrimitive(@NotNull Byte primitive, @NotNull CustomNbtContext context) { 26 | return (primitive >= 1); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /nms/abstract/src/main/java/com/github/sirblobman/api/nbt/CustomNbtTypePrimitive.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nbt; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | public final class CustomNbtTypePrimitive implements CustomNbtType { 6 | private final Class primitiveType; 7 | 8 | CustomNbtTypePrimitive(@NotNull Class primitiveType) { 9 | this.primitiveType = primitiveType; 10 | } 11 | 12 | @Override 13 | public @NotNull Class getPrimitiveType() { 14 | return this.primitiveType; 15 | } 16 | 17 | @Override 18 | public @NotNull Class getComplexType() { 19 | return this.primitiveType; 20 | } 21 | 22 | @Override 23 | public @NotNull T toPrimitive(@NotNull T complex, @NotNull CustomNbtContext context) { 24 | return complex; 25 | } 26 | 27 | @Override 28 | public @NotNull T fromPrimitive(@NotNull T primitive, @NotNull CustomNbtContext context) { 29 | return primitive; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /factions/handler/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar 2 | 3 | plugins { 4 | id("com.gradleup.shadow") version "9.3.0" 5 | } 6 | 7 | dependencies { 8 | // Local Dependencies 9 | implementation(project(":factions:abstract")) 10 | 11 | // Factions Implementations 12 | implementation(project(":factions:FactionsUUID")) 13 | implementation(project(":factions:FactionsUUID-Legacy")) 14 | implementation(project(":factions:FactionsUUID-4")) 15 | implementation(project(":factions:FactionsX")) 16 | implementation(project(":factions:LegacyFactions")) 17 | implementation(project(":factions:MassiveCore-Factions")) 18 | implementation(project(":factions:SaberFactions")) 19 | } 20 | 21 | tasks { 22 | named("jar") { 23 | enabled = false 24 | } 25 | 26 | named("shadowJar") { 27 | archiveClassifier.set(null as String?) 28 | } 29 | 30 | build { 31 | dependsOn("shadowJar") 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /nms/1_17_R1/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import io.github.patrick.gradle.remapper.RemapTask 2 | 3 | plugins { 4 | id("io.github.patrick.remapper") version "1.4.2" 5 | } 6 | 7 | dependencies { 8 | // Local Dependencies 9 | compileOnly(project(":nms:abstract")) 10 | compileOnly(project(":nms:modern-nbt")) 11 | 12 | // SpigotMC Mojang Mapped NMS 13 | compileOnly("org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT:remapped-mojang") 14 | } 15 | 16 | tasks { 17 | named("remap") { 18 | version.set("1.17.1") 19 | action.set(RemapTask.Action.MOJANG_TO_SPIGOT) 20 | inputTask.set(named("jar")) 21 | archiveName.set("remap.jar") 22 | } 23 | 24 | named("assemble") { 25 | dependsOn("remap") 26 | } 27 | } 28 | 29 | configurations { 30 | create("remap") { 31 | isCanBeConsumed = true 32 | isCanBeResolved = true 33 | } 34 | } 35 | 36 | artifacts { 37 | add("remap", layout.buildDirectory.file("libs/remap.jar")) { 38 | builtBy("remap") 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /core/src/main/resources/config.yml: -------------------------------------------------------------------------------- 1 | # Set this option to false if you do not want the update checker to run. 2 | # Default: true 3 | update-checker: true 4 | 5 | # Set this to true if you are having issues and wish to see more console output. 6 | # Default: false 7 | debug-mode: false 8 | 9 | # Set this to true to enable the command logger. 10 | # Default: false 11 | command-logger: false 12 | 13 | # Set this to true to cache the language for a player when they join. 14 | # When this is false, the plugin will wait until the first time a translated message is sent to the player. 15 | # Default: true 16 | cache-language-on-join: true 17 | 18 | # Set this to 'false' to keep the cached language for players that have already left the server. 19 | # This may cause confusion for players that log out and log back in to reset their language. 20 | cache-language-remove-on-quit: true 21 | 22 | # Set this to 'false' to ignore client-side language changes from players. 23 | # This may cause confusion for players that actually want a different language. 24 | cache-language-update-on-change: true 25 | -------------------------------------------------------------------------------- /language/src/main/java/com/github/sirblobman/api/language/replacer/ComponentReplacer.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.language.replacer; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import com.github.sirblobman.api.shaded.adventure.text.Component; 6 | import com.github.sirblobman.api.shaded.adventure.text.serializer.plain.PlainTextComponentSerializer; 7 | 8 | public final class ComponentReplacer extends Replacer { 9 | private final Component replacement; 10 | 11 | public ComponentReplacer(@NotNull String target, @NotNull Component replacement) { 12 | super(target); 13 | this.replacement = replacement; 14 | } 15 | 16 | @Override 17 | public @NotNull Component getReplacement() { 18 | return this.replacement; 19 | } 20 | 21 | @Override 22 | public @NotNull String getReplacementString() { 23 | Component replacement = getReplacement(); 24 | PlainTextComponentSerializer serializer = PlainTextComponentSerializer.plainText(); 25 | return serializer.serialize(replacement); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/resources/language.yml: -------------------------------------------------------------------------------- 1 | # This option allows you to debug language loading and parsing. 2 | # Your console will get spammed though, so it's recommended to keep it disabled. 3 | debug-mode: false 4 | 5 | # Force all players to use the 'default-locale', even when they have set a different language in their client. 6 | # This option also makes the 'console-locale' option useless. 7 | enforce-default-locale: false 8 | 9 | # This is the default language that will be shown to players when their language is not detected. 10 | # Player language can fail to detect if the file does not exist or if your Spigot jar does not support locales. 11 | default-locale: "en_us" 12 | 13 | # This is the language that will be used for messages sent to the server console. 14 | console-locale: "en_us" 15 | 16 | # Set this to true if you want language messages to include PlaceholderAPI placeholders. 17 | # The placeholder will be replaced relative to the player that the message is sent to. 18 | # If the message is sent to a non-player, the placeholders will not be replaced. 19 | use-placeholder-api: false 20 | -------------------------------------------------------------------------------- /nms/abstract/src/main/java/com/github/sirblobman/api/nms/Handler.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import java.util.logging.Logger; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import org.bukkit.plugin.java.JavaPlugin; 8 | 9 | /** 10 | * Abstract NMS Handler Class 11 | * @author SirBlobman 12 | */ 13 | public abstract class Handler { 14 | private final JavaPlugin plugin; 15 | 16 | /** 17 | * Create a new instance of this handler. 18 | * @param plugin The plugin that owns this instance. 19 | */ 20 | protected Handler(@NotNull JavaPlugin plugin) { 21 | this.plugin = plugin; 22 | } 23 | 24 | /** 25 | * @return The plugin that owns this instance. 26 | */ 27 | public final @NotNull JavaPlugin getPlugin() { 28 | return this.plugin; 29 | } 30 | 31 | /** 32 | * @return The logger from the plugin. 33 | * @see JavaPlugin#getLogger() 34 | */ 35 | public final @NotNull Logger getLogger() { 36 | JavaPlugin plugin = getPlugin(); 37 | return plugin.getLogger(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /nms/paper/src/main/java/com/github/sirblobman/api/nms/ServerHandler_Paper.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import java.util.logging.Logger; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import org.bukkit.Server; 8 | import org.bukkit.command.CommandMap; 9 | import org.bukkit.plugin.java.JavaPlugin; 10 | 11 | public final class ServerHandler_Paper extends ServerHandler { 12 | public ServerHandler_Paper(@NotNull JavaPlugin plugin) { 13 | super(plugin); 14 | Logger logger = getLogger(); 15 | logger.info("Using non-NMS Paper ServerHandler"); 16 | } 17 | 18 | @Override 19 | public int getMaxWorldSize() { 20 | Server server = getServer(); 21 | return server.getMaxWorldSize(); 22 | } 23 | 24 | @Override 25 | public double @NotNull [] getServerTpsValues() { 26 | Server server = getServer(); 27 | return server.getTPS(); 28 | } 29 | 30 | @Override 31 | public @NotNull CommandMap getCommandMap() { 32 | Server server = getServer(); 33 | return server.getCommandMap(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /nms/1_18_R2/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import io.github.patrick.gradle.remapper.RemapTask 2 | 3 | plugins { 4 | id("io.github.patrick.remapper") version "1.4.2" 5 | } 6 | 7 | repositories { 8 | maven("https://libraries.minecraft.net") 9 | } 10 | 11 | dependencies { 12 | // Local Dependencies 13 | compileOnly(project(":nms:abstract")) 14 | compileOnly(project(":nms:modern-nbt")) 15 | 16 | // SpigotMC Mojang Mapped NMS 17 | compileOnly("org.spigotmc:spigot:1.18.2-R0.1-SNAPSHOT:remapped-mojang") 18 | } 19 | 20 | tasks { 21 | named("remap") { 22 | version.set("1.18.2") 23 | action.set(RemapTask.Action.MOJANG_TO_SPIGOT) 24 | inputTask.set(named("jar")) 25 | archiveName.set("remap.jar") 26 | } 27 | 28 | named("assemble") { 29 | dependsOn("remap") 30 | } 31 | } 32 | 33 | configurations { 34 | create("remap") { 35 | isCanBeConsumed = true 36 | isCanBeResolved = true 37 | } 38 | } 39 | 40 | artifacts { 41 | add("remap", layout.buildDirectory.file("libs/remap.jar")) { 42 | builtBy("remap") 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /nms/1_19_R3/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import io.github.patrick.gradle.remapper.RemapTask 2 | 3 | plugins { 4 | id("io.github.patrick.remapper") version "1.4.2" 5 | } 6 | 7 | repositories { 8 | maven("https://libraries.minecraft.net") 9 | } 10 | 11 | dependencies { 12 | // Local Dependencies 13 | compileOnly(project(":nms:abstract")) 14 | compileOnly(project(":nms:modern-nbt")) 15 | 16 | // SpigotMC Mojang Mapped NMS 17 | compileOnly("org.spigotmc:spigot:1.19.4-R0.1-SNAPSHOT:remapped-mojang") 18 | } 19 | 20 | tasks { 21 | named("remap") { 22 | version.set("1.19.4") 23 | action.set(RemapTask.Action.MOJANG_TO_SPIGOT) 24 | inputTask.set(named("jar")) 25 | archiveName.set("remap.jar") 26 | } 27 | 28 | named("assemble") { 29 | dependsOn("remap") 30 | } 31 | } 32 | 33 | configurations { 34 | create("remap") { 35 | isCanBeConsumed = true 36 | isCanBeResolved = true 37 | } 38 | } 39 | 40 | artifacts { 41 | add("remap", layout.buildDirectory.file("libs/remap.jar")) { 42 | builtBy("remap") 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /nms/1_20_R1/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import io.github.patrick.gradle.remapper.RemapTask 2 | 3 | plugins { 4 | id("io.github.patrick.remapper") version "1.4.2" 5 | } 6 | 7 | repositories { 8 | maven("https://libraries.minecraft.net") 9 | } 10 | 11 | dependencies { 12 | // Local Dependencies 13 | compileOnly(project(":nms:abstract")) 14 | compileOnly(project(":nms:modern-nbt")) 15 | 16 | // SpigotMC Mojang Mapped NMS 17 | compileOnly("org.spigotmc:spigot:1.20.1-R0.1-SNAPSHOT:remapped-mojang") 18 | } 19 | 20 | tasks { 21 | named("remap") { 22 | version.set("1.20.1") 23 | action.set(RemapTask.Action.MOJANG_TO_SPIGOT) 24 | inputTask.set(named("jar")) 25 | archiveName.set("remap.jar") 26 | } 27 | 28 | named("assemble") { 29 | dependsOn("remap") 30 | } 31 | } 32 | 33 | configurations { 34 | create("remap") { 35 | isCanBeConsumed = true 36 | isCanBeResolved = true 37 | } 38 | } 39 | 40 | artifacts { 41 | add("remap", layout.buildDirectory.file("libs/remap.jar")) { 42 | builtBy("remap") 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /nms/1_20_R3/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import io.github.patrick.gradle.remapper.RemapTask 2 | 3 | plugins { 4 | id("io.github.patrick.remapper") version "1.4.2" 5 | } 6 | 7 | repositories { 8 | maven("https://libraries.minecraft.net") 9 | } 10 | 11 | dependencies { 12 | // Local Dependencies 13 | compileOnly(project(":nms:abstract")) 14 | compileOnly(project(":nms:modern-nbt")) 15 | 16 | // SpigotMC Mojang Mapped NMS 17 | compileOnly("org.spigotmc:spigot:1.20.4-R0.1-SNAPSHOT:remapped-mojang") 18 | } 19 | 20 | tasks { 21 | named("remap") { 22 | version.set("1.20.4") 23 | action.set(RemapTask.Action.MOJANG_TO_SPIGOT) 24 | inputTask.set(named("jar")) 25 | archiveName.set("remap.jar") 26 | } 27 | 28 | named("assemble") { 29 | dependsOn("remap") 30 | } 31 | } 32 | 33 | configurations { 34 | create("remap") { 35 | isCanBeConsumed = true 36 | isCanBeResolved = true 37 | } 38 | } 39 | 40 | artifacts { 41 | add("remap", layout.buildDirectory.file("libs/remap.jar")) { 42 | builtBy("remap") 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /nms/1_20_R4/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import io.github.patrick.gradle.remapper.RemapTask 2 | 3 | plugins { 4 | id("io.github.patrick.remapper") version "1.4.2" 5 | } 6 | 7 | repositories { 8 | maven("https://libraries.minecraft.net") 9 | } 10 | 11 | dependencies { 12 | // Local Dependencies 13 | compileOnly(project(":nms:abstract")) 14 | compileOnly(project(":nms:modern-nbt")) 15 | 16 | // SpigotMC Mojang Mapped NMS 17 | compileOnly("org.spigotmc:spigot:1.20.6-R0.1-SNAPSHOT:remapped-mojang") 18 | } 19 | 20 | tasks { 21 | named("remap") { 22 | version.set("1.20.6") 23 | action.set(RemapTask.Action.MOJANG_TO_SPIGOT) 24 | inputTask.set(named("jar")) 25 | archiveName.set("remap.jar") 26 | } 27 | 28 | named("assemble") { 29 | dependsOn("remap") 30 | } 31 | } 32 | 33 | configurations { 34 | create("remap") { 35 | isCanBeConsumed = true 36 | isCanBeResolved = true 37 | } 38 | } 39 | 40 | artifacts { 41 | add("remap", layout.buildDirectory.file("libs/remap.jar")) { 42 | builtBy("remap") 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /nms/1_21_R3/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import io.github.patrick.gradle.remapper.RemapTask 2 | 3 | plugins { 4 | id("io.github.patrick.remapper") version "1.4.2" 5 | } 6 | 7 | repositories { 8 | maven("https://libraries.minecraft.net") 9 | } 10 | 11 | dependencies { 12 | // Local Dependencies 13 | compileOnly(project(":nms:abstract")) 14 | compileOnly(project(":nms:modern-nbt")) 15 | 16 | // SpigotMC Mojang Mapped NMS 17 | compileOnly("org.spigotmc:spigot:1.21.4-R0.1-SNAPSHOT:remapped-mojang") 18 | } 19 | 20 | tasks { 21 | named("remap") { 22 | version.set("1.21.4") 23 | action.set(RemapTask.Action.MOJANG_TO_SPIGOT) 24 | inputTask.set(named("jar")) 25 | archiveName.set("remap.jar") 26 | } 27 | 28 | named("assemble") { 29 | dependsOn("remap") 30 | } 31 | } 32 | 33 | configurations { 34 | create("remap") { 35 | isCanBeConsumed = true 36 | isCanBeResolved = true 37 | } 38 | } 39 | 40 | artifacts { 41 | add("remap", layout.buildDirectory.file("libs/remap.jar")) { 42 | builtBy("remap") 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /nms/1_21_R4/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import io.github.patrick.gradle.remapper.RemapTask 2 | 3 | plugins { 4 | id("io.github.patrick.remapper") version "1.4.2" 5 | } 6 | 7 | repositories { 8 | maven("https://libraries.minecraft.net") 9 | } 10 | 11 | dependencies { 12 | // Local Dependencies 13 | compileOnly(project(":nms:abstract")) 14 | compileOnly(project(":nms:modern-nbt")) 15 | 16 | // SpigotMC Mojang Mapped NMS 17 | compileOnly("org.spigotmc:spigot:1.21.5-R0.1-SNAPSHOT:remapped-mojang") 18 | } 19 | 20 | tasks { 21 | named("remap") { 22 | version.set("1.21.5") 23 | action.set(RemapTask.Action.MOJANG_TO_SPIGOT) 24 | inputTask.set(named("jar")) 25 | archiveName.set("remap.jar") 26 | } 27 | 28 | named("assemble") { 29 | dependsOn("remap") 30 | } 31 | } 32 | 33 | configurations { 34 | create("remap") { 35 | isCanBeConsumed = true 36 | isCanBeResolved = true 37 | } 38 | } 39 | 40 | artifacts { 41 | add("remap", layout.buildDirectory.file("libs/remap.jar")) { 42 | builtBy("remap") 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /nms/1_21_R5/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import io.github.patrick.gradle.remapper.RemapTask 2 | 3 | plugins { 4 | id("io.github.patrick.remapper") version "1.4.2" 5 | } 6 | 7 | repositories { 8 | maven("https://libraries.minecraft.net") 9 | } 10 | 11 | dependencies { 12 | // Local Dependencies 13 | compileOnly(project(":nms:abstract")) 14 | compileOnly(project(":nms:modern-nbt")) 15 | 16 | // SpigotMC Mojang Mapped NMS 17 | compileOnly("org.spigotmc:spigot:1.21.8-R0.1-SNAPSHOT:remapped-mojang") 18 | } 19 | 20 | tasks { 21 | named("remap") { 22 | version.set("1.21.8") 23 | action.set(RemapTask.Action.MOJANG_TO_SPIGOT) 24 | inputTask.set(named("jar")) 25 | archiveName.set("remap.jar") 26 | } 27 | 28 | named("assemble") { 29 | dependsOn("remap") 30 | } 31 | } 32 | 33 | configurations { 34 | create("remap") { 35 | isCanBeConsumed = true 36 | isCanBeResolved = true 37 | } 38 | } 39 | 40 | artifacts { 41 | add("remap", layout.buildDirectory.file("libs/remap.jar")) { 42 | builtBy("remap") 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /nms/1_21_R6/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import io.github.patrick.gradle.remapper.RemapTask 2 | 3 | plugins { 4 | id("io.github.patrick.remapper") version "1.4.2" 5 | } 6 | 7 | repositories { 8 | maven("https://libraries.minecraft.net") 9 | } 10 | 11 | dependencies { 12 | // Local Dependencies 13 | compileOnly(project(":nms:abstract")) 14 | compileOnly(project(":nms:modern-nbt")) 15 | 16 | // SpigotMC Mojang Mapped NMS 17 | compileOnly("org.spigotmc:spigot:1.21.10-R0.1-SNAPSHOT:remapped-mojang") 18 | } 19 | 20 | tasks { 21 | named("remap") { 22 | version.set("1.21.10") 23 | action.set(RemapTask.Action.MOJANG_TO_SPIGOT) 24 | inputTask.set(named("jar")) 25 | archiveName.set("remap.jar") 26 | } 27 | 28 | named("assemble") { 29 | dependsOn("remap") 30 | } 31 | } 32 | 33 | configurations { 34 | create("remap") { 35 | isCanBeConsumed = true 36 | isCanBeResolved = true 37 | } 38 | } 39 | 40 | artifacts { 41 | add("remap", layout.buildDirectory.file("libs/remap.jar")) { 42 | builtBy("remap") 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /nms/1_21_R7/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import io.github.patrick.gradle.remapper.RemapTask 2 | 3 | plugins { 4 | id("io.github.patrick.remapper") version "1.4.2" 5 | } 6 | 7 | repositories { 8 | maven("https://libraries.minecraft.net") 9 | } 10 | 11 | dependencies { 12 | // Local Dependencies 13 | compileOnly(project(":nms:abstract")) 14 | compileOnly(project(":nms:modern-nbt")) 15 | 16 | // SpigotMC Mojang Mapped NMS 17 | compileOnly("org.spigotmc:spigot:1.21.11-R0.1-SNAPSHOT:remapped-mojang") 18 | } 19 | 20 | tasks { 21 | named("remap") { 22 | version.set("1.21.11") 23 | action.set(RemapTask.Action.MOJANG_TO_SPIGOT) 24 | inputTask.set(named("jar")) 25 | archiveName.set("remap.jar") 26 | } 27 | 28 | named("assemble") { 29 | dependsOn("remap") 30 | } 31 | } 32 | 33 | configurations { 34 | create("remap") { 35 | isCanBeConsumed = true 36 | isCanBeResolved = true 37 | } 38 | } 39 | 40 | artifacts { 41 | add("remap", layout.buildDirectory.file("libs/remap.jar")) { 42 | builtBy("remap") 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /nms/1_21_R5/src/main/java/com/github/sirblobman/api/nms/ProblemReporter_1_21_R5.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import java.util.logging.Logger; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import org.bukkit.plugin.Plugin; 8 | 9 | import net.minecraft.util.ProblemReporter; 10 | 11 | public final class ProblemReporter_1_21_R5 implements ProblemReporter { 12 | private final Plugin plugin; 13 | 14 | public ProblemReporter_1_21_R5(@NotNull Plugin plugin) { 15 | this.plugin = plugin; 16 | } 17 | 18 | @Override 19 | public ProblemReporter forChild(PathElement pathElement) { 20 | return this; 21 | } 22 | 23 | @Override 24 | public void report(Problem problem) { 25 | Logger logger = getLogger(); 26 | String description = problem.description(); 27 | logger.warning("A problem has occurred:"); 28 | logger.warning(description); 29 | } 30 | 31 | private @NotNull Plugin getPlugin() { 32 | return this.plugin; 33 | } 34 | 35 | private @NotNull Logger getLogger() { 36 | return getPlugin().getLogger(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /nms/1_21_R6/src/main/java/com/github/sirblobman/api/nms/ProblemReporter_1_21_R6.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import java.util.logging.Logger; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import org.bukkit.plugin.Plugin; 8 | 9 | import net.minecraft.util.ProblemReporter; 10 | 11 | public final class ProblemReporter_1_21_R6 implements ProblemReporter { 12 | private final Plugin plugin; 13 | 14 | public ProblemReporter_1_21_R6(@NotNull Plugin plugin) { 15 | this.plugin = plugin; 16 | } 17 | 18 | @Override 19 | public ProblemReporter forChild(PathElement pathElement) { 20 | return this; 21 | } 22 | 23 | @Override 24 | public void report(Problem problem) { 25 | Logger logger = getLogger(); 26 | String description = problem.description(); 27 | logger.warning("A problem has occurred:"); 28 | logger.warning(description); 29 | } 30 | 31 | private @NotNull Plugin getPlugin() { 32 | return this.plugin; 33 | } 34 | 35 | private @NotNull Logger getLogger() { 36 | return getPlugin().getLogger(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /nms/1_21_R7/src/main/java/com/github/sirblobman/api/nms/ProblemReporter_1_21_R7.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import java.util.logging.Logger; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import org.bukkit.plugin.Plugin; 8 | 9 | import net.minecraft.util.ProblemReporter; 10 | 11 | public final class ProblemReporter_1_21_R7 implements ProblemReporter { 12 | private final Plugin plugin; 13 | 14 | public ProblemReporter_1_21_R7(@NotNull Plugin plugin) { 15 | this.plugin = plugin; 16 | } 17 | 18 | @Override 19 | public ProblemReporter forChild(PathElement pathElement) { 20 | return this; 21 | } 22 | 23 | @Override 24 | public void report(Problem problem) { 25 | Logger logger = getLogger(); 26 | String description = problem.description(); 27 | logger.warning("A problem has occurred:"); 28 | logger.warning(description); 29 | } 30 | 31 | private @NotNull Plugin getPlugin() { 32 | return this.plugin; 33 | } 34 | 35 | private @NotNull Logger getLogger() { 36 | return getPlugin().getLogger(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/sirblobman/api/core/command/blueslimecore/SubCommandHelp.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.core.command.blueslimecore; 2 | 3 | import java.util.Collections; 4 | import java.util.List; 5 | 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | import org.bukkit.command.CommandSender; 9 | 10 | import com.github.sirblobman.api.command.Command; 11 | import com.github.sirblobman.api.core.CorePlugin; 12 | 13 | public final class SubCommandHelp extends Command { 14 | public SubCommandHelp(@NotNull CorePlugin plugin) { 15 | super(plugin, "help"); 16 | setPermissionName("blue.slime.core.command.blueslimecore.help"); 17 | } 18 | 19 | @Override 20 | protected @NotNull List onTabComplete(@NotNull CommandSender sender, String @NotNull [] args) { 21 | return Collections.emptyList(); 22 | } 23 | 24 | @Override 25 | protected boolean execute(@NotNull CommandSender sender, String @NotNull [] args) { 26 | sendMessage(sender, "command.blueslimecore.help.title"); 27 | sendMessage(sender, "command.blueslimecore.help.command-list"); 28 | return true; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /language/src/main/java/com/github/sirblobman/api/language/Language.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.language; 2 | 3 | import java.util.Locale; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | public final class Language { 8 | private final String languageName; 9 | private final LanguageConfiguration configuration; 10 | private final Locale javaLocale; 11 | 12 | public Language(@NotNull String languageName, @NotNull LanguageConfiguration configuration) { 13 | this.languageName = languageName; 14 | this.configuration = configuration; 15 | 16 | Locale javaLocale = Locale.forLanguageTag(languageName); 17 | if (javaLocale == null) { 18 | this.javaLocale = Locale.US; 19 | } else { 20 | this.javaLocale = javaLocale; 21 | } 22 | } 23 | 24 | public @NotNull String getLanguageName() { 25 | return this.languageName; 26 | } 27 | 28 | public @NotNull LanguageConfiguration getConfiguration() { 29 | return this.configuration; 30 | } 31 | 32 | public @NotNull Locale getJavaLocale() { 33 | return this.javaLocale; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/sirblobman/api/core/command/blueslimecore/SubCommandReload.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.core.command.blueslimecore; 2 | 3 | import java.util.Collections; 4 | import java.util.List; 5 | 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | import org.bukkit.command.CommandSender; 9 | import org.bukkit.plugin.java.JavaPlugin; 10 | 11 | import com.github.sirblobman.api.command.Command; 12 | import com.github.sirblobman.api.core.CorePlugin; 13 | 14 | public final class SubCommandReload extends Command { 15 | public SubCommandReload(@NotNull CorePlugin plugin) { 16 | super(plugin, "reload"); 17 | setPermissionName("blue.slime.core.command.blueslimecore.reload"); 18 | } 19 | 20 | @Override 21 | protected @NotNull List onTabComplete(@NotNull CommandSender sender, String @NotNull [] args) { 22 | return Collections.emptyList(); 23 | } 24 | 25 | @Override 26 | protected boolean execute(@NotNull CommandSender sender, String @NotNull [] args) { 27 | JavaPlugin plugin = getPlugin(); 28 | plugin.reloadConfig(); 29 | 30 | sendMessage(sender, "command.blueslimecore.reload-success"); 31 | return true; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /nms/1_16_R3/src/main/java/com/github/sirblobman/api/nms/PlayerHandler_1_16_R3.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.Material; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.plugin.java.JavaPlugin; 8 | 9 | public final class PlayerHandler_1_16_R3 extends PlayerHandler { 10 | public PlayerHandler_1_16_R3(@NotNull JavaPlugin plugin) { 11 | super(plugin); 12 | } 13 | 14 | @Override 15 | public void forceRespawn(@NotNull Player player) { 16 | if (!player.isDead()) { 17 | return; 18 | } 19 | 20 | Player.Spigot spigot = player.spigot(); 21 | spigot.respawn(); 22 | } 23 | 24 | @Override 25 | public double getAbsorptionHearts(@NotNull Player player) { 26 | return player.getAbsorptionAmount(); 27 | } 28 | 29 | @Override 30 | public void setAbsorptionHearts(@NotNull Player player, double hearts) { 31 | player.setAbsorptionAmount(hearts); 32 | } 33 | 34 | @Override 35 | public void sendCooldownPacket(@NotNull Player player, @NotNull Material material, int ticksLeft) { 36 | player.setCooldown(material, ticksLeft); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /nms/1_17_R1/src/main/java/com/github/sirblobman/api/nms/PlayerHandler_1_17_R1.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.Material; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.plugin.java.JavaPlugin; 8 | 9 | public final class PlayerHandler_1_17_R1 extends PlayerHandler { 10 | public PlayerHandler_1_17_R1(@NotNull JavaPlugin plugin) { 11 | super(plugin); 12 | } 13 | 14 | @Override 15 | public void forceRespawn(@NotNull Player player) { 16 | if (!player.isDead()) { 17 | return; 18 | } 19 | 20 | Player.Spigot spigot = player.spigot(); 21 | spigot.respawn(); 22 | } 23 | 24 | @Override 25 | public double getAbsorptionHearts(@NotNull Player player) { 26 | return player.getAbsorptionAmount(); 27 | } 28 | 29 | @Override 30 | public void setAbsorptionHearts(@NotNull Player player, double hearts) { 31 | player.setAbsorptionAmount(hearts); 32 | } 33 | 34 | @Override 35 | public void sendCooldownPacket(@NotNull Player player, @NotNull Material material, int ticksLeft) { 36 | player.setCooldown(material, ticksLeft); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /nms/1_18_R2/src/main/java/com/github/sirblobman/api/nms/PlayerHandler_1_18_R2.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.Material; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.plugin.java.JavaPlugin; 8 | 9 | public final class PlayerHandler_1_18_R2 extends PlayerHandler { 10 | public PlayerHandler_1_18_R2(@NotNull JavaPlugin plugin) { 11 | super(plugin); 12 | } 13 | 14 | @Override 15 | public void forceRespawn(@NotNull Player player) { 16 | if (!player.isDead()) { 17 | return; 18 | } 19 | 20 | Player.Spigot spigot = player.spigot(); 21 | spigot.respawn(); 22 | } 23 | 24 | @Override 25 | public double getAbsorptionHearts(@NotNull Player player) { 26 | return player.getAbsorptionAmount(); 27 | } 28 | 29 | @Override 30 | public void setAbsorptionHearts(@NotNull Player player, double hearts) { 31 | player.setAbsorptionAmount(hearts); 32 | } 33 | 34 | @Override 35 | public void sendCooldownPacket(@NotNull Player player, @NotNull Material material, int ticksLeft) { 36 | player.setCooldown(material, ticksLeft); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /nms/1_19_R3/src/main/java/com/github/sirblobman/api/nms/PlayerHandler_1_19_R3.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.Material; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.plugin.java.JavaPlugin; 8 | 9 | public final class PlayerHandler_1_19_R3 extends PlayerHandler { 10 | public PlayerHandler_1_19_R3(@NotNull JavaPlugin plugin) { 11 | super(plugin); 12 | } 13 | 14 | @Override 15 | public void forceRespawn(@NotNull Player player) { 16 | if (!player.isDead()) { 17 | return; 18 | } 19 | 20 | Player.Spigot spigot = player.spigot(); 21 | spigot.respawn(); 22 | } 23 | 24 | @Override 25 | public double getAbsorptionHearts(@NotNull Player player) { 26 | return player.getAbsorptionAmount(); 27 | } 28 | 29 | @Override 30 | public void setAbsorptionHearts(@NotNull Player player, double hearts) { 31 | player.setAbsorptionAmount(hearts); 32 | } 33 | 34 | @Override 35 | public void sendCooldownPacket(@NotNull Player player, @NotNull Material material, int ticksLeft) { 36 | player.setCooldown(material, ticksLeft); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /nms/1_20_R1/src/main/java/com/github/sirblobman/api/nms/PlayerHandler_1_20_R1.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.Material; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.plugin.java.JavaPlugin; 8 | 9 | public final class PlayerHandler_1_20_R1 extends PlayerHandler { 10 | public PlayerHandler_1_20_R1(@NotNull JavaPlugin plugin) { 11 | super(plugin); 12 | } 13 | 14 | @Override 15 | public void forceRespawn(@NotNull Player player) { 16 | if (!player.isDead()) { 17 | return; 18 | } 19 | 20 | Player.Spigot spigot = player.spigot(); 21 | spigot.respawn(); 22 | } 23 | 24 | @Override 25 | public double getAbsorptionHearts(@NotNull Player player) { 26 | return player.getAbsorptionAmount(); 27 | } 28 | 29 | @Override 30 | public void setAbsorptionHearts(@NotNull Player player, double hearts) { 31 | player.setAbsorptionAmount(hearts); 32 | } 33 | 34 | @Override 35 | public void sendCooldownPacket(@NotNull Player player, @NotNull Material material, int ticksLeft) { 36 | player.setCooldown(material, ticksLeft); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /nms/1_20_R3/src/main/java/com/github/sirblobman/api/nms/PlayerHandler_1_20_R3.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.Material; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.plugin.java.JavaPlugin; 8 | 9 | public final class PlayerHandler_1_20_R3 extends PlayerHandler { 10 | public PlayerHandler_1_20_R3(@NotNull JavaPlugin plugin) { 11 | super(plugin); 12 | } 13 | 14 | @Override 15 | public void forceRespawn(@NotNull Player player) { 16 | if (!player.isDead()) { 17 | return; 18 | } 19 | 20 | Player.Spigot spigot = player.spigot(); 21 | spigot.respawn(); 22 | } 23 | 24 | @Override 25 | public double getAbsorptionHearts(@NotNull Player player) { 26 | return player.getAbsorptionAmount(); 27 | } 28 | 29 | @Override 30 | public void setAbsorptionHearts(@NotNull Player player, double hearts) { 31 | player.setAbsorptionAmount(hearts); 32 | } 33 | 34 | @Override 35 | public void sendCooldownPacket(@NotNull Player player, @NotNull Material material, int ticksLeft) { 36 | player.setCooldown(material, ticksLeft); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /nms/1_20_R4/src/main/java/com/github/sirblobman/api/nms/PlayerHandler_1_20_R4.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.Material; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.plugin.java.JavaPlugin; 8 | 9 | public final class PlayerHandler_1_20_R4 extends PlayerHandler { 10 | public PlayerHandler_1_20_R4(@NotNull JavaPlugin plugin) { 11 | super(plugin); 12 | } 13 | 14 | @Override 15 | public void forceRespawn(@NotNull Player player) { 16 | if (!player.isDead()) { 17 | return; 18 | } 19 | 20 | Player.Spigot spigot = player.spigot(); 21 | spigot.respawn(); 22 | } 23 | 24 | @Override 25 | public double getAbsorptionHearts(@NotNull Player player) { 26 | return player.getAbsorptionAmount(); 27 | } 28 | 29 | @Override 30 | public void setAbsorptionHearts(@NotNull Player player, double hearts) { 31 | player.setAbsorptionAmount(hearts); 32 | } 33 | 34 | @Override 35 | public void sendCooldownPacket(@NotNull Player player, @NotNull Material material, int ticksLeft) { 36 | player.setCooldown(material, ticksLeft); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /nms/1_21_R3/src/main/java/com/github/sirblobman/api/nms/PlayerHandler_1_21_R3.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.Material; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.plugin.java.JavaPlugin; 8 | 9 | public final class PlayerHandler_1_21_R3 extends PlayerHandler { 10 | public PlayerHandler_1_21_R3(@NotNull JavaPlugin plugin) { 11 | super(plugin); 12 | } 13 | 14 | @Override 15 | public void forceRespawn(@NotNull Player player) { 16 | if (!player.isDead()) { 17 | return; 18 | } 19 | 20 | Player.Spigot spigot = player.spigot(); 21 | spigot.respawn(); 22 | } 23 | 24 | @Override 25 | public double getAbsorptionHearts(@NotNull Player player) { 26 | return player.getAbsorptionAmount(); 27 | } 28 | 29 | @Override 30 | public void setAbsorptionHearts(@NotNull Player player, double hearts) { 31 | player.setAbsorptionAmount(hearts); 32 | } 33 | 34 | @Override 35 | public void sendCooldownPacket(@NotNull Player player, @NotNull Material material, int ticksLeft) { 36 | player.setCooldown(material, ticksLeft); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /nms/1_21_R4/src/main/java/com/github/sirblobman/api/nms/PlayerHandler_1_21_R4.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.Material; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.plugin.java.JavaPlugin; 8 | 9 | public final class PlayerHandler_1_21_R4 extends PlayerHandler { 10 | public PlayerHandler_1_21_R4(@NotNull JavaPlugin plugin) { 11 | super(plugin); 12 | } 13 | 14 | @Override 15 | public void forceRespawn(@NotNull Player player) { 16 | if (!player.isDead()) { 17 | return; 18 | } 19 | 20 | Player.Spigot spigot = player.spigot(); 21 | spigot.respawn(); 22 | } 23 | 24 | @Override 25 | public double getAbsorptionHearts(@NotNull Player player) { 26 | return player.getAbsorptionAmount(); 27 | } 28 | 29 | @Override 30 | public void setAbsorptionHearts(@NotNull Player player, double hearts) { 31 | player.setAbsorptionAmount(hearts); 32 | } 33 | 34 | @Override 35 | public void sendCooldownPacket(@NotNull Player player, @NotNull Material material, int ticksLeft) { 36 | player.setCooldown(material, ticksLeft); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /nms/1_21_R5/src/main/java/com/github/sirblobman/api/nms/PlayerHandler_1_21_R5.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.Material; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.plugin.java.JavaPlugin; 8 | 9 | public final class PlayerHandler_1_21_R5 extends PlayerHandler { 10 | public PlayerHandler_1_21_R5(@NotNull JavaPlugin plugin) { 11 | super(plugin); 12 | } 13 | 14 | @Override 15 | public void forceRespawn(@NotNull Player player) { 16 | if (!player.isDead()) { 17 | return; 18 | } 19 | 20 | Player.Spigot spigot = player.spigot(); 21 | spigot.respawn(); 22 | } 23 | 24 | @Override 25 | public double getAbsorptionHearts(@NotNull Player player) { 26 | return player.getAbsorptionAmount(); 27 | } 28 | 29 | @Override 30 | public void setAbsorptionHearts(@NotNull Player player, double hearts) { 31 | player.setAbsorptionAmount(hearts); 32 | } 33 | 34 | @Override 35 | public void sendCooldownPacket(@NotNull Player player, @NotNull Material material, int ticksLeft) { 36 | player.setCooldown(material, ticksLeft); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /nms/1_21_R6/src/main/java/com/github/sirblobman/api/nms/PlayerHandler_1_21_R6.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.Material; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.plugin.java.JavaPlugin; 8 | 9 | public final class PlayerHandler_1_21_R6 extends PlayerHandler { 10 | public PlayerHandler_1_21_R6(@NotNull JavaPlugin plugin) { 11 | super(plugin); 12 | } 13 | 14 | @Override 15 | public void forceRespawn(@NotNull Player player) { 16 | if (!player.isDead()) { 17 | return; 18 | } 19 | 20 | Player.Spigot spigot = player.spigot(); 21 | spigot.respawn(); 22 | } 23 | 24 | @Override 25 | public double getAbsorptionHearts(@NotNull Player player) { 26 | return player.getAbsorptionAmount(); 27 | } 28 | 29 | @Override 30 | public void setAbsorptionHearts(@NotNull Player player, double hearts) { 31 | player.setAbsorptionAmount(hearts); 32 | } 33 | 34 | @Override 35 | public void sendCooldownPacket(@NotNull Player player, @NotNull Material material, int ticksLeft) { 36 | player.setCooldown(material, ticksLeft); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /nms/1_21_R7/src/main/java/com/github/sirblobman/api/nms/PlayerHandler_1_21_R6.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.Material; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.plugin.java.JavaPlugin; 8 | 9 | public final class PlayerHandler_1_21_R6 extends PlayerHandler { 10 | public PlayerHandler_1_21_R6(@NotNull JavaPlugin plugin) { 11 | super(plugin); 12 | } 13 | 14 | @Override 15 | public void forceRespawn(@NotNull Player player) { 16 | if (!player.isDead()) { 17 | return; 18 | } 19 | 20 | Player.Spigot spigot = player.spigot(); 21 | spigot.respawn(); 22 | } 23 | 24 | @Override 25 | public double getAbsorptionHearts(@NotNull Player player) { 26 | return player.getAbsorptionAmount(); 27 | } 28 | 29 | @Override 30 | public void setAbsorptionHearts(@NotNull Player player, double hearts) { 31 | player.setAbsorptionAmount(hearts); 32 | } 33 | 34 | @Override 35 | public void sendCooldownPacket(@NotNull Player player, @NotNull Material material, int ticksLeft) { 36 | player.setCooldown(material, ticksLeft); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /menu/src/main/java/com/github/sirblobman/api/menu/task/AdvancedMenuRefreshLoopTask.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.menu.task; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.entity.Player; 6 | import org.bukkit.plugin.Plugin; 7 | 8 | import com.github.sirblobman.api.folia.details.EntityTaskDetails; 9 | import com.github.sirblobman.api.menu.AdvancedAbstractMenu; 10 | 11 | public final class AdvancedMenuRefreshLoopTask extends EntityTaskDetails { 12 | private final AdvancedAbstractMenu menu; 13 | 14 | public AdvancedMenuRefreshLoopTask(@NotNull Plugin plugin, @NotNull Player player, 15 | @NotNull AdvancedAbstractMenu menu) { 16 | super(plugin, player); 17 | setDelay(20L); 18 | setPeriod(20L); 19 | this.menu = menu; 20 | } 21 | 22 | private @NotNull AdvancedAbstractMenu getMenu() { 23 | return this.menu; 24 | } 25 | 26 | @Override 27 | public void run() { 28 | Player player = getEntity(); 29 | if (player == null) { 30 | cancel(); 31 | return; 32 | } 33 | 34 | AdvancedAbstractMenu menu = getMenu(); 35 | menu.run(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /plugin/src/main/java/com/github/sirblobman/api/plugin/listener/PluginListener.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.plugin.listener; 2 | 3 | import java.util.logging.Logger; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import org.bukkit.Bukkit; 8 | import org.bukkit.event.HandlerList; 9 | import org.bukkit.event.Listener; 10 | import org.bukkit.plugin.PluginManager; 11 | import org.bukkit.plugin.java.JavaPlugin; 12 | 13 | public abstract class PluginListener implements Listener { 14 | private final JP plugin; 15 | 16 | public PluginListener(@NotNull JP plugin) { 17 | this.plugin = plugin; 18 | } 19 | 20 | public final void register() { 21 | unregister(); 22 | 23 | JP plugin = getPlugin(); 24 | PluginManager pluginManager = Bukkit.getPluginManager(); 25 | pluginManager.registerEvents(this, plugin); 26 | } 27 | 28 | public final void unregister() { 29 | HandlerList.unregisterAll(this); 30 | } 31 | 32 | protected final @NotNull JP getPlugin() { 33 | return this.plugin; 34 | } 35 | 36 | protected final @NotNull Logger getLogger() { 37 | JP plugin = getPlugin(); 38 | return plugin.getLogger(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/sirblobman/api/core/command/blueslimecore/CommandBlueSlimeCore.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.core.command.blueslimecore; 2 | 3 | import java.util.Collections; 4 | import java.util.List; 5 | 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | import org.bukkit.command.CommandSender; 9 | 10 | import com.github.sirblobman.api.command.Command; 11 | import com.github.sirblobman.api.core.CorePlugin; 12 | 13 | public final class CommandBlueSlimeCore extends Command { 14 | public CommandBlueSlimeCore(@NotNull CorePlugin plugin) { 15 | super(plugin, "blueslimecore"); 16 | setPermissionName("blue.slime.core.command.blueslimecore"); 17 | addSubCommand(new SubCommandHelp(plugin)); 18 | addSubCommand(new SubCommandLanguageTest(plugin)); 19 | addSubCommand(new SubCommandReload(plugin)); 20 | addSubCommand(new SubCommandVersion(plugin)); 21 | } 22 | 23 | @Override 24 | protected @NotNull List onTabComplete(@NotNull CommandSender sender, String @NotNull [] args) { 25 | return Collections.emptyList(); 26 | } 27 | 28 | @Override 29 | protected boolean execute(@NotNull CommandSender sender, String @NotNull [] args) { 30 | return false; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /language/src/main/java/com/github/sirblobman/api/language/listener/UpdateLocaleTask.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.language.listener; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.entity.Player; 6 | import org.bukkit.plugin.Plugin; 7 | 8 | import com.github.sirblobman.api.folia.details.EntityTaskDetails; 9 | import com.github.sirblobman.api.language.LanguageManager; 10 | 11 | public class UpdateLocaleTask extends EntityTaskDetails { 12 | private final LanguageManager languageManager; 13 | 14 | public UpdateLocaleTask(@NotNull Plugin plugin, @NotNull Player player, @NotNull LanguageManager languageManager) { 15 | super(plugin, player); 16 | this.languageManager = languageManager; 17 | } 18 | 19 | private @NotNull LanguageManager getLanguageManager() { 20 | return this.languageManager; 21 | } 22 | 23 | @Override 24 | public void run() { 25 | Player player = getEntity(); 26 | if (player == null) { 27 | cancel(); 28 | return; 29 | } 30 | 31 | String playerLocale = player.getLocale(); 32 | LanguageManager languageManager = getLanguageManager(); 33 | languageManager.setLocale(player, playerLocale); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /bungeecord/abstract/src/main/java/com/github/sirblobman/api/bungeecord/configuration/WrapperPluginResourceHolder.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.bungeecord.configuration; 2 | 3 | import net.md_5.bungee.api.plugin.Plugin; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.jetbrains.annotations.Nullable; 6 | 7 | import java.io.File; 8 | import java.io.InputStream; 9 | import java.util.logging.Logger; 10 | 11 | public final class WrapperPluginResourceHolder implements IResourceHolder { 12 | private final Plugin plugin; 13 | 14 | public WrapperPluginResourceHolder(@NotNull Plugin plugin) { 15 | this.plugin = plugin; 16 | } 17 | 18 | @Override 19 | public @NotNull File getDataFolder() { 20 | Plugin plugin = getPlugin(); 21 | return plugin.getDataFolder(); 22 | } 23 | 24 | @Override 25 | public @Nullable InputStream getResource(@NotNull String name) { 26 | Plugin plugin = getPlugin(); 27 | return plugin.getResourceAsStream(name); 28 | } 29 | 30 | @Override 31 | public @NotNull Logger getLogger() { 32 | Plugin plugin = getPlugin(); 33 | return plugin.getLogger(); 34 | } 35 | 36 | private @NotNull Plugin getPlugin() { 37 | return this.plugin; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /utility/src/main/java/com/github/sirblobman/api/language/ComponentBungeeConverter.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.language; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import net.md_5.bungee.api.chat.BaseComponent; 6 | 7 | import com.github.sirblobman.api.utility.VersionUtility; 8 | import com.github.sirblobman.api.shaded.adventure.text.Component; 9 | import com.github.sirblobman.api.shaded.adventure.text.serializer.bungeecord.BungeeComponentSerializer; 10 | 11 | public final class ComponentBungeeConverter { 12 | public static @NotNull BungeeComponentSerializer getSerializer() { 13 | int minorVersion = VersionUtility.getMinorVersion(); 14 | if (minorVersion < 16) { 15 | return BungeeComponentSerializer.legacy(); 16 | } 17 | 18 | return BungeeComponentSerializer.get(); 19 | } 20 | 21 | public static BaseComponent @NotNull [] toBungee(@NotNull Component component) { 22 | BungeeComponentSerializer serializer = getSerializer(); 23 | return serializer.serialize(component); 24 | } 25 | 26 | public static @NotNull Component fromBungee(@NotNull BaseComponent @NotNull ... componentArray) { 27 | BungeeComponentSerializer serializer = getSerializer(); 28 | return serializer.deserialize(componentArray); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /menu/src/main/java/com/github/sirblobman/api/menu/button/ExitButton.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.menu.button; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.entity.Player; 6 | import org.bukkit.plugin.Plugin; 7 | 8 | import com.github.sirblobman.api.folia.scheduler.TaskScheduler; 9 | import com.github.sirblobman.api.menu.IMenu; 10 | import com.github.sirblobman.api.menu.task.CloseMenuTask; 11 | 12 | public final class ExitButton extends QuickButton { 13 | private final IMenu menu; 14 | 15 | public ExitButton(@NotNull IMenu menu) { 16 | this.menu = menu; 17 | } 18 | 19 | private @NotNull IMenu getMenu() { 20 | return this.menu; 21 | } 22 | 23 | private @NotNull Plugin getPlugin() { 24 | IMenu menu = getMenu(); 25 | return menu.getPlugin(); 26 | } 27 | 28 | private @NotNull TaskScheduler getTaskScheduler() { 29 | IMenu menu = getMenu(); 30 | return menu.getTaskScheduler(); 31 | } 32 | 33 | @Override 34 | public void onLeftClick(@NotNull Player player, boolean shift) { 35 | Plugin plugin = getPlugin(); 36 | CloseMenuTask task = new CloseMenuTask(plugin, player); 37 | TaskScheduler scheduler = getTaskScheduler(); 38 | scheduler.scheduleEntityTask(task); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /menu/src/main/java/com/github/sirblobman/api/menu/task/AdvancedMenuInternalOpenTask.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.menu.task; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.entity.Player; 6 | import org.bukkit.inventory.Inventory; 7 | import org.bukkit.plugin.Plugin; 8 | 9 | import com.github.sirblobman.api.folia.details.EntityTaskDetails; 10 | import com.github.sirblobman.api.menu.AdvancedAbstractMenu; 11 | 12 | public final class AdvancedMenuInternalOpenTask extends EntityTaskDetails { 13 | private final AdvancedAbstractMenu menu; 14 | 15 | public AdvancedMenuInternalOpenTask(@NotNull Plugin plugin, @NotNull Player player, 16 | @NotNull AdvancedAbstractMenu menu) { 17 | super(plugin, player); 18 | this.menu = menu; 19 | } 20 | 21 | private @NotNull AdvancedAbstractMenu getMenu() { 22 | return this.menu; 23 | } 24 | 25 | @Override 26 | public void run() { 27 | Player player = getEntity(); 28 | if (player == null) { 29 | return; 30 | } 31 | 32 | AdvancedAbstractMenu menu = getMenu(); 33 | menu.registerListeners(); 34 | 35 | Inventory inventory = menu.getInventory(); 36 | player.openInventory(inventory); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /nms/abstract/src/main/java/com/github/sirblobman/api/nbt/CustomNbtType.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nbt; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | public interface CustomNbtType { 6 | /** 7 | * Returns the primitive data type of this tag. 8 | * 9 | * @return the class 10 | */ 11 | @NotNull Class getPrimitiveType(); 12 | 13 | /** 14 | * Returns the complex object type the primitive value resembles. 15 | * 16 | * @return the class type 17 | */ 18 | @NotNull Class getComplexType(); 19 | 20 | /** 21 | * Returns the primitive data that resembles the complex object passed to 22 | * this method. 23 | * 24 | * @param complex the complex object instance 25 | * @param context the context this operation is running in 26 | * @return the primitive value 27 | */ 28 | @NotNull T toPrimitive(@NotNull Z complex, @NotNull CustomNbtContext context); 29 | 30 | /** 31 | * Creates a complex object based of the passed primitive value 32 | * 33 | * @param primitive the primitive value 34 | * @param context the context this operation is running in 35 | * @return the complex object instance 36 | */ 37 | @NotNull Z fromPrimitive(@NotNull T primitive, @NotNull CustomNbtContext context); 38 | } 39 | -------------------------------------------------------------------------------- /language/src/main/java/com/github/sirblobman/api/language/replacer/TranslatableReplacer.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.language.replacer; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import com.github.sirblobman.api.shaded.adventure.text.Component; 6 | import com.github.sirblobman.api.shaded.adventure.text.ComponentLike; 7 | import com.github.sirblobman.api.shaded.adventure.text.serializer.plain.PlainTextComponentSerializer; 8 | 9 | public final class TranslatableReplacer extends Replacer { 10 | private final String translationKey; 11 | private final ComponentLike[] args; 12 | 13 | public TranslatableReplacer(@NotNull String target, @NotNull String translationKey, 14 | ComponentLike @NotNull ... args) { 15 | super(target); 16 | this.translationKey = translationKey; 17 | this.args = args; 18 | } 19 | 20 | @Override 21 | public @NotNull Component getReplacement() { 22 | return Component.translatable(this.translationKey, this.args); 23 | } 24 | 25 | @Override 26 | public @NotNull String getReplacementString() { 27 | Component replacement = getReplacement(); 28 | PlainTextComponentSerializer serializer = PlainTextComponentSerializer.plainText(); 29 | return serializer.serialize(replacement); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /language/src/main/java/com/github/sirblobman/api/language/replacer/Replacer.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.language.replacer; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import com.github.sirblobman.api.shaded.adventure.text.Component; 6 | import com.github.sirblobman.api.shaded.adventure.text.TextReplacementConfig; 7 | 8 | public abstract class Replacer { 9 | private final String target; 10 | 11 | public Replacer(@NotNull String target) { 12 | this.target = target; 13 | } 14 | 15 | public @NotNull String getTarget() { 16 | return this.target; 17 | } 18 | 19 | public abstract @NotNull Component getReplacement(); 20 | 21 | public abstract @NotNull String getReplacementString(); 22 | 23 | public final @NotNull String replaceString(@NotNull String original) { 24 | String target = getTarget(); 25 | String replacement = getReplacementString(); 26 | return original.replace(target, replacement); 27 | } 28 | 29 | public final @NotNull TextReplacementConfig asReplacementConfig() { 30 | String target = getTarget(); 31 | Component replacement = getReplacement(); 32 | TextReplacementConfig.Builder builder = TextReplacementConfig.builder(); 33 | return builder.matchLiteral(target).replacement(replacement).build(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /language/src/main/java/com/github/sirblobman/api/language/LanguageConfigurationComparator.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.language; 2 | 3 | import java.util.Comparator; 4 | import java.util.Objects; 5 | 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | import org.bukkit.configuration.ConfigurationSection; 9 | 10 | public final class LanguageConfigurationComparator implements Comparator { 11 | @Override 12 | public int compare(@NotNull ConfigurationSection section1, @NotNull ConfigurationSection section2) { 13 | String languageName1 = section1.getString("language-name"); 14 | String languageName2 = section2.getString("language-name"); 15 | String parentName1 = section1.getString("parent"); 16 | String parentName2 = section2.getString("parent"); 17 | 18 | if (Objects.equals(parentName2, languageName2) && Objects.equals(parentName2, languageName1)) { 19 | throw new IllegalStateException("Cyclic Language Dependency: " + languageName1 + ", " + languageName2); 20 | } 21 | 22 | if (Objects.equals(parentName1, languageName2)) { 23 | return 1; 24 | } 25 | 26 | if (Objects.equals(parentName2, languageName1)) { 27 | return -1; 28 | } 29 | 30 | return languageName1.compareToIgnoreCase(languageName2); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /configuration/src/main/java/com/github/sirblobman/api/configuration/IConfigurable.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.configuration; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.configuration.ConfigurationSection; 6 | 7 | public interface IConfigurable { 8 | /** 9 | * Load the values from a configuration. 10 | * 11 | * @param section The configuration that contains the values. 12 | */ 13 | void load(@NotNull ConfigurationSection section); 14 | 15 | /** 16 | * Save the values to a configuration. 17 | * 18 | * @param section The configuration that wil contain the values. 19 | */ 20 | default void save(@NotNull ConfigurationSection section) { 21 | // Do Nothing 22 | } 23 | 24 | /** 25 | * Get or create a configuration section. 26 | * 27 | * @param parent The parent section. 28 | * @param path The path to check. 29 | * @return The original section at the path, or a new one if a section did not exist. 30 | */ 31 | default ConfigurationSection getOrCreateSection(@NotNull ConfigurationSection parent, @NotNull String path) { 32 | ConfigurationSection oldSection = parent.getConfigurationSection(path); 33 | if (oldSection != null) { 34 | return oldSection; 35 | } 36 | 37 | return parent.createSection(path); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /nms/paper/src/main/java/com/github/sirblobman/api/nms/PlayerHandler_Paper.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import java.util.logging.Logger; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import org.bukkit.Material; 8 | import org.bukkit.entity.Player; 9 | import org.bukkit.entity.Player.Spigot; 10 | import org.bukkit.plugin.java.JavaPlugin; 11 | 12 | 13 | public final class PlayerHandler_Paper extends PlayerHandler { 14 | public PlayerHandler_Paper(@NotNull JavaPlugin plugin) { 15 | super(plugin); 16 | Logger logger = getLogger(); 17 | logger.info("Using non-NMS Paper PlayerHandler"); 18 | } 19 | 20 | @Override 21 | public void forceRespawn(@NotNull Player player) { 22 | if (!player.isDead()) { 23 | return; 24 | } 25 | 26 | Spigot spigot = player.spigot(); 27 | spigot.respawn(); 28 | } 29 | 30 | @Override 31 | public double getAbsorptionHearts(@NotNull Player player) { 32 | return player.getAbsorptionAmount(); 33 | } 34 | 35 | @Override 36 | public void setAbsorptionHearts(@NotNull Player player, double hearts) { 37 | player.setAbsorptionAmount(hearts); 38 | } 39 | 40 | @Override 41 | public void sendCooldownPacket(@NotNull Player player, @NotNull Material material, int ticksLeft) { 42 | player.setCooldown(material, ticksLeft); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /item/src/main/java/com/github/sirblobman/api/item/LeatherArmorBuilder.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.item; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.Color; 6 | import org.bukkit.inventory.ItemStack; 7 | import org.bukkit.inventory.meta.ItemMeta; 8 | import org.bukkit.inventory.meta.LeatherArmorMeta; 9 | 10 | public final class LeatherArmorBuilder extends ItemBuilder { 11 | public LeatherArmorBuilder(@NotNull ArmorType armorType) { 12 | super(armorType.getArmorMaterial(ArmorMaterialType.LEATHER)); 13 | } 14 | 15 | public @NotNull LeatherArmorBuilder withColor(@NotNull Color color) { 16 | ItemStack finalItem = getFinalItem(); 17 | ItemMeta itemMeta = finalItem.getItemMeta(); 18 | if (!(itemMeta instanceof LeatherArmorMeta)) { 19 | return this; 20 | } 21 | 22 | LeatherArmorMeta leatherArmorMeta = (LeatherArmorMeta) itemMeta; 23 | leatherArmorMeta.setColor(color); 24 | 25 | return (LeatherArmorBuilder) withItemMeta(itemMeta); 26 | } 27 | 28 | public @NotNull LeatherArmorBuilder withColor(int red, int green, int blue) { 29 | Color color = Color.fromRGB(red, green, blue); 30 | return withColor(color); 31 | } 32 | 33 | public @NotNull LeatherArmorBuilder withColor(int rgb) { 34 | Color color = Color.fromRGB(rgb); 35 | return withColor(color); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /nms/abstract/src/main/java/com/github/sirblobman/api/nbt/custom/CustomNbtTypeUUID.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nbt.custom; 2 | 3 | import java.nio.ByteBuffer; 4 | import java.util.UUID; 5 | 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | import com.github.sirblobman.api.nbt.CustomNbtContext; 9 | import com.github.sirblobman.api.nbt.CustomNbtType; 10 | 11 | public final class CustomNbtTypeUUID implements CustomNbtType { 12 | @Override 13 | public @NotNull Class getPrimitiveType() { 14 | return byte[].class; 15 | } 16 | 17 | @Override 18 | public @NotNull Class getComplexType() { 19 | return UUID.class; 20 | } 21 | 22 | @Override 23 | public byte @NotNull [] toPrimitive(@NotNull UUID complex, @NotNull CustomNbtContext context) { 24 | ByteBuffer byteBuffer = ByteBuffer.wrap(new byte[16]); 25 | byteBuffer.putLong(complex.getMostSignificantBits()); 26 | byteBuffer.putLong(complex.getLeastSignificantBits()); 27 | return byteBuffer.array(); 28 | } 29 | 30 | @Override 31 | public @NotNull UUID fromPrimitive(byte @NotNull [] primitive, @NotNull CustomNbtContext context) { 32 | ByteBuffer byteBuffer = ByteBuffer.wrap(primitive); 33 | long mostSignificantBits = byteBuffer.getLong(); 34 | long leastSignificantBits = byteBuffer.getLong(); 35 | return new UUID(mostSignificantBits, leastSignificantBits); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /utility/src/main/java/com/github/sirblobman/api/utility/Validate.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.utility; 2 | 3 | import java.util.Collection; 4 | import java.util.Map; 5 | 6 | import org.jetbrains.annotations.NotNull; 7 | import org.jetbrains.annotations.Nullable; 8 | 9 | public final class Validate { 10 | public static @NotNull O notNull(@Nullable O value, @NotNull String message) { 11 | if (value == null) { 12 | throw new IllegalArgumentException(message); 13 | } 14 | 15 | return value; 16 | } 17 | 18 | public static @NotNull String notEmpty(@Nullable String value, @NotNull String message) { 19 | notNull(value, message); 20 | 21 | if (value.isEmpty()) { 22 | throw new IllegalArgumentException(message); 23 | } 24 | 25 | return value; 26 | } 27 | 28 | public static > @NotNull C notEmpty(@Nullable C value, @NotNull String message) { 29 | notNull(value, message); 30 | 31 | if (value.isEmpty()) { 32 | throw new IllegalArgumentException(message); 33 | } 34 | 35 | return value; 36 | } 37 | 38 | public static > @NotNull M notEmpty(@Nullable M value, @NotNull String message) { 39 | notNull(value, message); 40 | 41 | if (value.isEmpty()) { 42 | throw new IllegalArgumentException(message); 43 | } 44 | 45 | return value; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /menu/src/main/java/com/github/sirblobman/api/menu/button/OpenParentMenuButton.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.menu.button; 2 | 3 | import java.util.Optional; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import org.bukkit.entity.Player; 8 | import org.bukkit.plugin.Plugin; 9 | 10 | import com.github.sirblobman.api.folia.scheduler.TaskScheduler; 11 | import com.github.sirblobman.api.menu.IMenu; 12 | import com.github.sirblobman.api.menu.task.MenuOpenTask; 13 | 14 | public final class OpenParentMenuButton

extends QuickButton { 15 | private final IMenu menu; 16 | 17 | public OpenParentMenuButton(@NotNull IMenu menu) { 18 | this.menu = menu; 19 | } 20 | 21 | private @NotNull IMenu getMenu() { 22 | return this.menu; 23 | } 24 | 25 | private @NotNull Optional getParentMenu() { 26 | IMenu menu = getMenu(); 27 | return menu.getParentMenu(); 28 | } 29 | 30 | @Override 31 | public void onLeftClick(@NotNull Player player, boolean shift) { 32 | Optional optionalParentMenu = getParentMenu(); 33 | if (!optionalParentMenu.isPresent()) { 34 | return; 35 | } 36 | 37 | IMenu parentMenu = optionalParentMenu.get(); 38 | Plugin plugin = parentMenu.getPlugin(); 39 | 40 | MenuOpenTask task = new MenuOpenTask(plugin, player, parentMenu); 41 | TaskScheduler scheduler = parentMenu.getTaskScheduler(); 42 | scheduler.scheduleEntityTask(task); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /menu/src/main/java/com/github/sirblobman/api/menu/button/QuickButton.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.menu.button; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.entity.HumanEntity; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.event.inventory.ClickType; 8 | import org.bukkit.event.inventory.InventoryClickEvent; 9 | 10 | public class QuickButton implements IButton { 11 | @Override 12 | public void onClick(@NotNull InventoryClickEvent e) { 13 | HumanEntity human = e.getWhoClicked(); 14 | if (!(human instanceof Player)) { 15 | return; 16 | } 17 | 18 | Player player = (Player) human; 19 | ClickType clickType = e.getClick(); 20 | boolean shift = clickType.isShiftClick(); 21 | 22 | if (clickType.isLeftClick()) { 23 | onLeftClick(player, shift); 24 | return; 25 | } 26 | 27 | if (clickType.isRightClick()) { 28 | onRightClick(player, shift); 29 | return; 30 | } 31 | 32 | if (clickType == ClickType.MIDDLE) { 33 | onMiddleClick(player, shift); 34 | } 35 | } 36 | 37 | public void onLeftClick(@NotNull Player player, boolean shift) { 38 | // Do Nothing 39 | } 40 | 41 | public void onRightClick(@NotNull Player player, boolean shift) { 42 | // Do Nothing 43 | } 44 | 45 | public void onMiddleClick(@NotNull Player player, boolean shift) { 46 | // Do Nothing 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /menu/src/main/java/com/github/sirblobman/api/menu/task/AbstractMenuInternalOpenTask.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.menu.task; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.Bukkit; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.inventory.Inventory; 8 | import org.bukkit.plugin.Plugin; 9 | import org.bukkit.plugin.PluginManager; 10 | 11 | import com.github.sirblobman.api.folia.details.EntityTaskDetails; 12 | import com.github.sirblobman.api.menu.AbstractMenu; 13 | 14 | public final class AbstractMenuInternalOpenTask extends EntityTaskDetails { 15 | private final AbstractMenu menu; 16 | 17 | public AbstractMenuInternalOpenTask(@NotNull Plugin plugin, @NotNull Player player, 18 | @NotNull AbstractMenu menu) { 19 | super(plugin, player); 20 | this.menu = menu; 21 | } 22 | 23 | private @NotNull AbstractMenu getMenu() { 24 | return this.menu; 25 | } 26 | 27 | @Override 28 | public void run() { 29 | Player player = getEntity(); 30 | if (player == null) { 31 | return; 32 | } 33 | 34 | AbstractMenu menu = getMenu(); 35 | menu.resetButtons(); 36 | 37 | Plugin plugin = getPlugin(); 38 | PluginManager pluginManager = Bukkit.getPluginManager(); 39 | pluginManager.registerEvents(menu, plugin); 40 | 41 | Inventory inventory = menu.getInventory(); 42 | player.openInventory(inventory); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /item/src/main/java/com/github/sirblobman/api/item/ArmorType.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.item; 2 | 3 | import java.util.EnumMap; 4 | import java.util.Map; 5 | 6 | import org.jetbrains.annotations.NotNull; 7 | import org.jetbrains.annotations.Nullable; 8 | 9 | import org.bukkit.inventory.EquipmentSlot; 10 | 11 | import com.github.sirblobman.api.shaded.xseries.XMaterial; 12 | 13 | public enum ArmorType { 14 | HELMET(EquipmentSlot.HEAD), 15 | CHESTPLATE(EquipmentSlot.CHEST), 16 | LEGGINGS(EquipmentSlot.LEGS), 17 | BOOTS(EquipmentSlot.FEET); 18 | 19 | private static final Map BY_SLOT; 20 | 21 | static { 22 | BY_SLOT = new EnumMap<>(EquipmentSlot.class); 23 | ArmorType[] values = values(); 24 | for (ArmorType armorType : values) { 25 | EquipmentSlot slot = armorType.getEquipmentSlot(); 26 | BY_SLOT.put(slot, armorType); 27 | } 28 | } 29 | 30 | public static @Nullable ArmorType getBySlot(@NotNull EquipmentSlot slot) { 31 | return BY_SLOT.get(slot); 32 | } 33 | 34 | private final EquipmentSlot equipmentSlot; 35 | 36 | ArmorType(@NotNull EquipmentSlot equipmentSlot) { 37 | this.equipmentSlot = equipmentSlot; 38 | } 39 | 40 | public @NotNull EquipmentSlot getEquipmentSlot() { 41 | return this.equipmentSlot; 42 | } 43 | 44 | public @NotNull XMaterial getArmorMaterial(@NotNull ArmorMaterialType materialType) { 45 | return materialType.getArmorMaterial(this); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /nms/1_18_R2/src/main/java/com/github/sirblobman/api/nms/ServerHandler_1_18_R2.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import java.util.Arrays; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import org.bukkit.Server; 8 | import org.bukkit.command.CommandMap; 9 | import org.bukkit.plugin.java.JavaPlugin; 10 | 11 | import net.minecraft.server.MinecraftServer; 12 | import org.bukkit.craftbukkit.v1_18_R2.CraftServer; 13 | 14 | public final class ServerHandler_1_18_R2 extends ServerHandler { 15 | public ServerHandler_1_18_R2(JavaPlugin plugin) { 16 | super(plugin); 17 | } 18 | 19 | @Override 20 | public int getMaxWorldSize() { 21 | Server server = getServer(); 22 | return server.getMaxWorldSize(); 23 | } 24 | 25 | @Override 26 | public double @NotNull [] getServerTpsValues() { 27 | Server server = getServer(); 28 | if (!(server instanceof CraftServer craftServer)) { 29 | return new double[] {20.0D, 20.0D, 20.0D}; 30 | } 31 | 32 | MinecraftServer minecraftServer = craftServer.getServer(); 33 | return Arrays.copyOf(minecraftServer.recentTps, 3); 34 | } 35 | 36 | @Override 37 | public @NotNull CommandMap getCommandMap() { 38 | Server server = getServer(); 39 | if (!(server instanceof CraftServer craftServer)) { 40 | throw new UnsupportedOperationException("Server implementation is not the correct class."); 41 | } 42 | 43 | return craftServer.getCommandMap(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /nms/1_19_R3/src/main/java/com/github/sirblobman/api/nms/ServerHandler_1_19_R3.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import java.util.Arrays; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import org.bukkit.Server; 8 | import org.bukkit.command.CommandMap; 9 | import org.bukkit.plugin.java.JavaPlugin; 10 | 11 | import net.minecraft.server.MinecraftServer; 12 | import org.bukkit.craftbukkit.v1_19_R3.CraftServer; 13 | 14 | public final class ServerHandler_1_19_R3 extends ServerHandler { 15 | public ServerHandler_1_19_R3(JavaPlugin plugin) { 16 | super(plugin); 17 | } 18 | 19 | @Override 20 | public int getMaxWorldSize() { 21 | Server server = getServer(); 22 | return server.getMaxWorldSize(); 23 | } 24 | 25 | @Override 26 | public double @NotNull [] getServerTpsValues() { 27 | Server server = getServer(); 28 | if (!(server instanceof CraftServer craftServer)) { 29 | return new double[] {20.0D, 20.0D, 20.0D}; 30 | } 31 | 32 | MinecraftServer minecraftServer = craftServer.getServer(); 33 | return Arrays.copyOf(minecraftServer.recentTps, 3); 34 | } 35 | 36 | @Override 37 | public @NotNull CommandMap getCommandMap() { 38 | Server server = getServer(); 39 | if (!(server instanceof CraftServer craftServer)) { 40 | throw new UnsupportedOperationException("Server implementation is not the correct class."); 41 | } 42 | 43 | return craftServer.getCommandMap(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /nms/1_20_R1/src/main/java/com/github/sirblobman/api/nms/ServerHandler_1_20_R1.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import java.util.Arrays; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import org.bukkit.Server; 8 | import org.bukkit.command.CommandMap; 9 | import org.bukkit.plugin.java.JavaPlugin; 10 | 11 | import net.minecraft.server.MinecraftServer; 12 | import org.bukkit.craftbukkit.v1_20_R1.CraftServer; 13 | 14 | public final class ServerHandler_1_20_R1 extends ServerHandler { 15 | public ServerHandler_1_20_R1(JavaPlugin plugin) { 16 | super(plugin); 17 | } 18 | 19 | @Override 20 | public int getMaxWorldSize() { 21 | Server server = getServer(); 22 | return server.getMaxWorldSize(); 23 | } 24 | 25 | @Override 26 | public double @NotNull [] getServerTpsValues() { 27 | Server server = getServer(); 28 | if (!(server instanceof CraftServer craftServer)) { 29 | return new double[] {20.0D, 20.0D, 20.0D}; 30 | } 31 | 32 | MinecraftServer minecraftServer = craftServer.getServer(); 33 | return Arrays.copyOf(minecraftServer.recentTps, 3); 34 | } 35 | 36 | @Override 37 | public @NotNull CommandMap getCommandMap() { 38 | Server server = getServer(); 39 | if (!(server instanceof CraftServer craftServer)) { 40 | throw new UnsupportedOperationException("Server implementation is not the correct class."); 41 | } 42 | 43 | return craftServer.getCommandMap(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /nms/1_20_R3/src/main/java/com/github/sirblobman/api/nms/ServerHandler_1_20_R3.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import java.util.Arrays; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import org.bukkit.Server; 8 | import org.bukkit.command.CommandMap; 9 | import org.bukkit.plugin.java.JavaPlugin; 10 | 11 | import net.minecraft.server.MinecraftServer; 12 | import org.bukkit.craftbukkit.v1_20_R3.CraftServer; 13 | 14 | public final class ServerHandler_1_20_R3 extends ServerHandler { 15 | public ServerHandler_1_20_R3(JavaPlugin plugin) { 16 | super(plugin); 17 | } 18 | 19 | @Override 20 | public int getMaxWorldSize() { 21 | Server server = getServer(); 22 | return server.getMaxWorldSize(); 23 | } 24 | 25 | @Override 26 | public double @NotNull [] getServerTpsValues() { 27 | Server server = getServer(); 28 | if (!(server instanceof CraftServer craftServer)) { 29 | return new double[] {20.0D, 20.0D, 20.0D}; 30 | } 31 | 32 | MinecraftServer minecraftServer = craftServer.getServer(); 33 | return Arrays.copyOf(minecraftServer.recentTps, 3); 34 | } 35 | 36 | @Override 37 | public @NotNull CommandMap getCommandMap() { 38 | Server server = getServer(); 39 | if (!(server instanceof CraftServer craftServer)) { 40 | throw new UnsupportedOperationException("Server implementation is not the correct class."); 41 | } 42 | 43 | return craftServer.getCommandMap(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /nms/1_20_R4/src/main/java/com/github/sirblobman/api/nms/ServerHandler_1_20_R4.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import java.util.Arrays; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import org.bukkit.Server; 8 | import org.bukkit.command.CommandMap; 9 | import org.bukkit.plugin.java.JavaPlugin; 10 | 11 | import net.minecraft.server.MinecraftServer; 12 | import org.bukkit.craftbukkit.v1_20_R4.CraftServer; 13 | 14 | public final class ServerHandler_1_20_R4 extends ServerHandler { 15 | public ServerHandler_1_20_R4(JavaPlugin plugin) { 16 | super(plugin); 17 | } 18 | 19 | @Override 20 | public int getMaxWorldSize() { 21 | Server server = getServer(); 22 | return server.getMaxWorldSize(); 23 | } 24 | 25 | @Override 26 | public double @NotNull [] getServerTpsValues() { 27 | Server server = getServer(); 28 | if (!(server instanceof CraftServer craftServer)) { 29 | return new double[] {20.0D, 20.0D, 20.0D}; 30 | } 31 | 32 | MinecraftServer minecraftServer = craftServer.getServer(); 33 | return Arrays.copyOf(minecraftServer.recentTps, 3); 34 | } 35 | 36 | @Override 37 | public @NotNull CommandMap getCommandMap() { 38 | Server server = getServer(); 39 | if (!(server instanceof CraftServer craftServer)) { 40 | throw new UnsupportedOperationException("Server implementation is not the correct class."); 41 | } 42 | 43 | return craftServer.getCommandMap(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /nms/1_21_R3/src/main/java/com/github/sirblobman/api/nms/ServerHandler_1_21_R3.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import java.util.Arrays; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import org.bukkit.Server; 8 | import org.bukkit.command.CommandMap; 9 | import org.bukkit.plugin.java.JavaPlugin; 10 | 11 | import net.minecraft.server.MinecraftServer; 12 | import org.bukkit.craftbukkit.v1_21_R3.CraftServer; 13 | 14 | public final class ServerHandler_1_21_R3 extends ServerHandler { 15 | public ServerHandler_1_21_R3(JavaPlugin plugin) { 16 | super(plugin); 17 | } 18 | 19 | @Override 20 | public int getMaxWorldSize() { 21 | Server server = getServer(); 22 | return server.getMaxWorldSize(); 23 | } 24 | 25 | @Override 26 | public double @NotNull [] getServerTpsValues() { 27 | Server server = getServer(); 28 | if (!(server instanceof CraftServer craftServer)) { 29 | return new double[] {20.0D, 20.0D, 20.0D}; 30 | } 31 | 32 | MinecraftServer minecraftServer = craftServer.getServer(); 33 | return Arrays.copyOf(minecraftServer.recentTps, 3); 34 | } 35 | 36 | @Override 37 | public @NotNull CommandMap getCommandMap() { 38 | Server server = getServer(); 39 | if (!(server instanceof CraftServer craftServer)) { 40 | throw new UnsupportedOperationException("Server implementation is not the correct class."); 41 | } 42 | 43 | return craftServer.getCommandMap(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /nms/1_21_R4/src/main/java/com/github/sirblobman/api/nms/ServerHandler_1_21_R4.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import java.util.Arrays; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import org.bukkit.Server; 8 | import org.bukkit.command.CommandMap; 9 | import org.bukkit.plugin.java.JavaPlugin; 10 | 11 | import net.minecraft.server.MinecraftServer; 12 | import org.bukkit.craftbukkit.v1_21_R4.CraftServer; 13 | 14 | public final class ServerHandler_1_21_R4 extends ServerHandler { 15 | public ServerHandler_1_21_R4(JavaPlugin plugin) { 16 | super(plugin); 17 | } 18 | 19 | @Override 20 | public int getMaxWorldSize() { 21 | Server server = getServer(); 22 | return server.getMaxWorldSize(); 23 | } 24 | 25 | @Override 26 | public double @NotNull [] getServerTpsValues() { 27 | Server server = getServer(); 28 | if (!(server instanceof CraftServer craftServer)) { 29 | return new double[] {20.0D, 20.0D, 20.0D}; 30 | } 31 | 32 | MinecraftServer minecraftServer = craftServer.getServer(); 33 | return Arrays.copyOf(minecraftServer.recentTps, 3); 34 | } 35 | 36 | @Override 37 | public @NotNull CommandMap getCommandMap() { 38 | Server server = getServer(); 39 | if (!(server instanceof CraftServer craftServer)) { 40 | throw new UnsupportedOperationException("Server implementation is not the correct class."); 41 | } 42 | 43 | return craftServer.getCommandMap(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /nms/1_21_R5/src/main/java/com/github/sirblobman/api/nms/ServerHandler_1_21_R5.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import java.util.Arrays; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import org.bukkit.Server; 8 | import org.bukkit.command.CommandMap; 9 | import org.bukkit.plugin.java.JavaPlugin; 10 | 11 | import net.minecraft.server.MinecraftServer; 12 | import org.bukkit.craftbukkit.v1_21_R5.CraftServer; 13 | 14 | public final class ServerHandler_1_21_R5 extends ServerHandler { 15 | public ServerHandler_1_21_R5(JavaPlugin plugin) { 16 | super(plugin); 17 | } 18 | 19 | @Override 20 | public int getMaxWorldSize() { 21 | Server server = getServer(); 22 | return server.getMaxWorldSize(); 23 | } 24 | 25 | @Override 26 | public double @NotNull [] getServerTpsValues() { 27 | Server server = getServer(); 28 | if (!(server instanceof CraftServer craftServer)) { 29 | return new double[] {20.0D, 20.0D, 20.0D}; 30 | } 31 | 32 | MinecraftServer minecraftServer = craftServer.getServer(); 33 | return Arrays.copyOf(minecraftServer.recentTps, 3); 34 | } 35 | 36 | @Override 37 | public @NotNull CommandMap getCommandMap() { 38 | Server server = getServer(); 39 | if (!(server instanceof CraftServer craftServer)) { 40 | throw new UnsupportedOperationException("Server implementation is not the correct class."); 41 | } 42 | 43 | return craftServer.getCommandMap(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /nms/1_21_R6/src/main/java/com/github/sirblobman/api/nms/ServerHandler_1_21_R6.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import java.util.Arrays; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import org.bukkit.Server; 8 | import org.bukkit.command.CommandMap; 9 | import org.bukkit.plugin.java.JavaPlugin; 10 | 11 | import net.minecraft.server.MinecraftServer; 12 | import org.bukkit.craftbukkit.v1_21_R6.CraftServer; 13 | 14 | public final class ServerHandler_1_21_R6 extends ServerHandler { 15 | public ServerHandler_1_21_R6(JavaPlugin plugin) { 16 | super(plugin); 17 | } 18 | 19 | @Override 20 | public int getMaxWorldSize() { 21 | Server server = getServer(); 22 | return server.getMaxWorldSize(); 23 | } 24 | 25 | @Override 26 | public double @NotNull [] getServerTpsValues() { 27 | Server server = getServer(); 28 | if (!(server instanceof CraftServer craftServer)) { 29 | return new double[] {20.0D, 20.0D, 20.0D}; 30 | } 31 | 32 | MinecraftServer minecraftServer = craftServer.getServer(); 33 | return Arrays.copyOf(minecraftServer.recentTps, 3); 34 | } 35 | 36 | @Override 37 | public @NotNull CommandMap getCommandMap() { 38 | Server server = getServer(); 39 | if (!(server instanceof CraftServer craftServer)) { 40 | throw new UnsupportedOperationException("Server implementation is not the correct class."); 41 | } 42 | 43 | return craftServer.getCommandMap(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /nms/1_21_R7/src/main/java/com/github/sirblobman/api/nms/ServerHandler_1_21_R7.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import java.util.Arrays; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import org.bukkit.Server; 8 | import org.bukkit.command.CommandMap; 9 | import org.bukkit.plugin.java.JavaPlugin; 10 | 11 | import net.minecraft.server.MinecraftServer; 12 | import org.bukkit.craftbukkit.v1_21_R7.CraftServer; 13 | 14 | public final class ServerHandler_1_21_R7 extends ServerHandler { 15 | public ServerHandler_1_21_R7(JavaPlugin plugin) { 16 | super(plugin); 17 | } 18 | 19 | @Override 20 | public int getMaxWorldSize() { 21 | Server server = getServer(); 22 | return server.getMaxWorldSize(); 23 | } 24 | 25 | @Override 26 | public double @NotNull [] getServerTpsValues() { 27 | Server server = getServer(); 28 | if (!(server instanceof CraftServer craftServer)) { 29 | return new double[] {20.0D, 20.0D, 20.0D}; 30 | } 31 | 32 | MinecraftServer minecraftServer = craftServer.getServer(); 33 | return Arrays.copyOf(minecraftServer.recentTps, 3); 34 | } 35 | 36 | @Override 37 | public @NotNull CommandMap getCommandMap() { 38 | Server server = getServer(); 39 | if (!(server instanceof CraftServer craftServer)) { 40 | throw new UnsupportedOperationException("Server implementation is not the correct class."); 41 | } 42 | 43 | return craftServer.getCommandMap(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /nms/modern-nbt/src/main/java/com/github/sirblobman/api/nbt/modern/PersistentDataConverter.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nbt.modern; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.persistence.PersistentDataAdapterContext; 6 | import org.bukkit.persistence.PersistentDataContainer; 7 | import org.bukkit.persistence.PersistentDataType; 8 | import org.bukkit.plugin.Plugin; 9 | 10 | import com.github.sirblobman.api.nbt.CustomNbtContainer; 11 | import com.github.sirblobman.api.nbt.CustomNbtContext; 12 | import com.github.sirblobman.api.nbt.CustomNbtType; 13 | 14 | public final class PersistentDataConverter { 15 | public static @NotNull PersistentDataType convertType(@NotNull Plugin plugin, 16 | @NotNull CustomNbtType customNbtType) { 17 | return new CustomNbtPersistentDataTypeWrapper<>(plugin, customNbtType); 18 | } 19 | 20 | public static @NotNull CustomNbtContext convertContext(@NotNull Plugin plugin, 21 | @NotNull PersistentDataAdapterContext context) { 22 | return new CustomNbtPersistentDataAdapterContextWrapper(plugin, context); 23 | } 24 | 25 | public static @NotNull CustomNbtContainer convertContainer(@NotNull Plugin plugin, 26 | @NotNull PersistentDataContainer container) { 27 | return new CustomNbtPersistentDataContainerWrapper(plugin, container); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /nms/1_17_R1/src/main/java/com/github/sirblobman/api/nms/ServerHandler_1_17_R1.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import java.util.Arrays; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import org.bukkit.Server; 8 | import org.bukkit.command.CommandMap; 9 | import org.bukkit.plugin.java.JavaPlugin; 10 | 11 | import net.minecraft.server.MinecraftServer; 12 | import org.bukkit.craftbukkit.v1_17_R1.CraftServer; 13 | 14 | public final class ServerHandler_1_17_R1 extends ServerHandler { 15 | public ServerHandler_1_17_R1(@NotNull JavaPlugin plugin) { 16 | super(plugin); 17 | } 18 | 19 | @Override 20 | public int getMaxWorldSize() { 21 | Server server = getServer(); 22 | return server.getMaxWorldSize(); 23 | } 24 | 25 | @Override 26 | public double @NotNull [] getServerTpsValues() { 27 | Server server = getServer(); 28 | if (!(server instanceof CraftServer craftServer)) { 29 | return new double[] {20.0D, 20.0D, 20.0D}; 30 | } 31 | 32 | MinecraftServer minecraftServer = craftServer.getServer(); 33 | return Arrays.copyOf(minecraftServer.recentTps, 3); 34 | } 35 | 36 | @Override 37 | public @NotNull CommandMap getCommandMap() { 38 | Server server = getServer(); 39 | if (!(server instanceof CraftServer craftServer)) { 40 | throw new UnsupportedOperationException("Server implementation is not the correct class."); 41 | } 42 | 43 | return craftServer.getCommandMap(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /bungeecord/core/src/main/java/com/github/sirblobman/api/bungeecord/core/command/CommandSBCoreReload.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.bungeecord.core.command; 2 | 3 | import java.util.Collections; 4 | import java.util.List; 5 | 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | import net.md_5.bungee.api.ChatColor; 9 | import net.md_5.bungee.api.CommandSender; 10 | import net.md_5.bungee.api.chat.TextComponent; 11 | import net.md_5.bungee.api.plugin.Command; 12 | import net.md_5.bungee.api.plugin.TabExecutor; 13 | 14 | import com.github.sirblobman.api.bungeecord.core.CorePlugin; 15 | 16 | public final class CommandSBCoreReload extends Command implements TabExecutor { 17 | private final CorePlugin plugin; 18 | 19 | public CommandSBCoreReload(@NotNull CorePlugin plugin) { 20 | super("sbcorereload", "sbcore.reload", "sbcore-reload", "sbc-reload"); 21 | this.plugin = plugin; 22 | } 23 | 24 | @Override 25 | public List onTabComplete(@NotNull CommandSender sender, String @NotNull [] args) { 26 | return Collections.emptyList(); 27 | } 28 | 29 | @Override 30 | public void execute(@NotNull CommandSender sender, String @NotNull [] args) { 31 | CorePlugin plugin = getPlugin(); 32 | plugin.onReload(); 33 | 34 | TextComponent message = new TextComponent("Successfully reloaded the configuration."); 35 | message.setColor(ChatColor.GREEN); 36 | sender.sendMessage(message); 37 | } 38 | 39 | private @NotNull CorePlugin getPlugin() { 40 | return this.plugin; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /configuration/src/main/java/com/github/sirblobman/api/configuration/WrapperPluginResourceHolder.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.configuration; 2 | 3 | import java.io.File; 4 | import java.io.InputStream; 5 | import java.util.Locale; 6 | import java.util.logging.Logger; 7 | 8 | import org.jetbrains.annotations.NotNull; 9 | import org.jetbrains.annotations.Nullable; 10 | 11 | import org.bukkit.plugin.Plugin; 12 | 13 | public final class WrapperPluginResourceHolder implements IResourceHolder { 14 | private final Plugin plugin; 15 | 16 | public WrapperPluginResourceHolder(@NotNull Plugin plugin) { 17 | this.plugin = plugin; 18 | } 19 | 20 | @Override 21 | public @NotNull String getName() { 22 | Plugin plugin = getPlugin(); 23 | return plugin.getName(); 24 | } 25 | 26 | @Override 27 | public @NotNull String getKeyName() { 28 | String pluginName = getName(); 29 | return pluginName.toLowerCase(Locale.US); 30 | } 31 | 32 | @Override 33 | public @NotNull File getDataFolder() { 34 | Plugin plugin = getPlugin(); 35 | return plugin.getDataFolder(); 36 | } 37 | 38 | @Override 39 | public @Nullable InputStream getResource(@NotNull String name) { 40 | Plugin plugin = getPlugin(); 41 | return plugin.getResource(name); 42 | } 43 | 44 | @Override 45 | public @NotNull Logger getLogger() { 46 | Plugin plugin = getPlugin(); 47 | return plugin.getLogger(); 48 | } 49 | 50 | public @NotNull Plugin getPlugin() { 51 | return this.plugin; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /bungeecord/abstract/src/main/java/com/github/sirblobman/api/bungeecord/hook/vanish/IVanishHook.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.bungeecord.hook.vanish; 2 | 3 | import java.util.UUID; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import net.md_5.bungee.api.connection.ProxiedPlayer; 8 | 9 | import com.github.sirblobman.api.bungeecord.hook.IHook; 10 | 11 | public interface IVanishHook extends IHook { 12 | /** 13 | * Check if a player is currently vanished. 14 | * 15 | * @param player The {@link ProxiedPlayer} to check. 16 | * @return {@code true} if the player is vanished, otherwise {@code false}. 17 | */ 18 | boolean isHidden(@NotNull ProxiedPlayer player); 19 | 20 | /** 21 | * Check if a player is currently vanished. 22 | * 23 | * @param playerId The {@link UUID} of the player to check. 24 | * @return {@code true} if the player is vanished, otherwise {@code false}. 25 | */ 26 | boolean isHidden(@NotNull UUID playerId); 27 | 28 | /** 29 | * Set the hide value of a player. 30 | * 31 | * @param player The {@link ProxiedPlayer} to hide/unhide. 32 | * @param hidden {@code true} to hide the player, {@code false} to unhide the player. 33 | */ 34 | void setHidden(@NotNull ProxiedPlayer player, boolean hidden); 35 | 36 | /** 37 | * Set the hide value of a player. 38 | * 39 | * @param playerId The {@link UUID} of the player to hide/unhide. 40 | * @param hidden {@code true} to hide the player, {@code false} to unhide the player. 41 | */ 42 | void setHidden(@NotNull UUID playerId, boolean hidden); 43 | } 44 | -------------------------------------------------------------------------------- /nms/1_16_R3/src/main/java/com/github/sirblobman/api/nms/ServerHandler_1_16_R3.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import java.util.Arrays; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import org.bukkit.Server; 8 | import org.bukkit.command.CommandMap; 9 | import org.bukkit.plugin.java.JavaPlugin; 10 | 11 | import net.minecraft.server.v1_16_R3.MinecraftServer; 12 | import org.bukkit.craftbukkit.v1_16_R3.CraftServer; 13 | 14 | public final class ServerHandler_1_16_R3 extends ServerHandler { 15 | public ServerHandler_1_16_R3(@NotNull JavaPlugin plugin) { 16 | super(plugin); 17 | } 18 | 19 | @Override 20 | public int getMaxWorldSize() { 21 | Server server = getServer(); 22 | return server.getMaxWorldSize(); 23 | } 24 | 25 | @Override 26 | public double @NotNull [] getServerTpsValues() { 27 | Server server = getServer(); 28 | if (!(server instanceof CraftServer)) { 29 | return new double[] {20.0D, 20.0D, 20.0D}; 30 | } 31 | 32 | CraftServer craftServer = (CraftServer) server; 33 | MinecraftServer minecraftServer = craftServer.getServer(); 34 | return Arrays.copyOf(minecraftServer.recentTps, 3); 35 | } 36 | 37 | @Override 38 | public @NotNull CommandMap getCommandMap() { 39 | Server server = getServer(); 40 | if (!(server instanceof CraftServer)) { 41 | throw new UnsupportedOperationException("Server implementation is not the correct class."); 42 | } 43 | 44 | CraftServer craftServer = (CraftServer) server; 45 | return craftServer.getCommandMap(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /nms/modern-nbt/src/main/java/com/github/sirblobman/api/nbt/modern/CustomNbtPersistentDataAdapterContextWrapper.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nbt.modern; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.persistence.PersistentDataAdapterContext; 6 | import org.bukkit.persistence.PersistentDataContainer; 7 | import org.bukkit.plugin.Plugin; 8 | 9 | import com.github.sirblobman.api.nbt.CustomNbtContainer; 10 | import com.github.sirblobman.api.nbt.CustomNbtContext; 11 | 12 | import static com.github.sirblobman.api.nbt.modern.PersistentDataConverter.convertContainer; 13 | 14 | public final class CustomNbtPersistentDataAdapterContextWrapper implements CustomNbtContext { 15 | private final Plugin plugin; 16 | private final PersistentDataAdapterContext context; 17 | 18 | public CustomNbtPersistentDataAdapterContextWrapper(@NotNull Plugin plugin, 19 | @NotNull PersistentDataAdapterContext context) { 20 | this.plugin = plugin; 21 | this.context = context; 22 | } 23 | 24 | @Override 25 | public @NotNull CustomNbtContainer newCustomNbtContainer() { 26 | Plugin plugin = getPlugin(); 27 | PersistentDataAdapterContext context = getContext(); 28 | PersistentDataContainer persistentDataContainer = context.newPersistentDataContainer(); 29 | return convertContainer(plugin, persistentDataContainer); 30 | } 31 | 32 | private @NotNull Plugin getPlugin() { 33 | return this.plugin; 34 | } 35 | 36 | private @NotNull PersistentDataAdapterContext getContext() { 37 | return this.context; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ############################## 2 | ## Java 3 | ############################## 4 | .mtj.tmp/ 5 | *.class 6 | *.jar 7 | *.war 8 | *.ear 9 | *.nar 10 | hs_err_pid* 11 | 12 | ############################## 13 | ## Maven 14 | ############################## 15 | target/ 16 | pom.xml.tag 17 | pom.xml.releaseBackup 18 | pom.xml.versionsBackup 19 | pom.xml.next 20 | pom.xml.bak 21 | release.properties 22 | dependency-reduced-pom.xml 23 | buildNumber.properties 24 | .mvn/timing.properties 25 | .mvn/wrapper/maven-wrapper.jar 26 | 27 | ############################## 28 | ## Gradle 29 | ############################## 30 | bin/ 31 | build/ 32 | .gradle 33 | .gradletasknamecache 34 | gradle-app.setting 35 | !gradle-wrapper.jar 36 | 37 | ############################## 38 | ## IntelliJ 39 | ############################## 40 | out/ 41 | .idea/ 42 | .idea_modules/ 43 | *.iml 44 | *.ipr 45 | *.iws 46 | 47 | ############################## 48 | ## Eclipse 49 | ############################## 50 | .settings/ 51 | tmp/ 52 | .metadata 53 | .classpath 54 | .project 55 | *.tmp 56 | *.bak 57 | *.swp 58 | *~.nib 59 | local.properties 60 | .loadpath 61 | .factorypath 62 | 63 | ############################## 64 | ## NetBeans 65 | ############################## 66 | nbproject/private/ 67 | nbbuild/ 68 | dist/ 69 | nbdist/ 70 | nbactions.xml 71 | nb-configuration.xml 72 | 73 | ############################## 74 | ## Visual Studio Code 75 | ############################## 76 | .vscode/ 77 | .code-workspace 78 | 79 | ############################## 80 | ## OS X 81 | ############################## 82 | .DS_Store 83 | ._* 84 | 85 | ############################## 86 | ## Windows 87 | ############################## 88 | ~$* 89 | -------------------------------------------------------------------------------- /core/src/main/java/com/github/sirblobman/api/core/command/CommandItemToYML.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.core.command; 2 | 3 | import java.util.Collections; 4 | import java.util.List; 5 | import java.util.regex.Pattern; 6 | 7 | import org.jetbrains.annotations.NotNull; 8 | 9 | import org.bukkit.configuration.file.YamlConfiguration; 10 | import org.bukkit.entity.Player; 11 | import org.bukkit.inventory.ItemStack; 12 | 13 | import com.github.sirblobman.api.command.PlayerCommand; 14 | import com.github.sirblobman.api.core.CorePlugin; 15 | import com.github.sirblobman.api.utility.ItemUtility; 16 | 17 | public final class CommandItemToYML extends PlayerCommand { 18 | public CommandItemToYML(@NotNull CorePlugin plugin) { 19 | super(plugin, "item-to-yml"); 20 | setPermissionName("blue.slime.core.command.item-to-yml"); 21 | } 22 | 23 | @Override 24 | public @NotNull List onTabComplete(@NotNull Player player, String @NotNull [] args) { 25 | return Collections.emptyList(); 26 | } 27 | 28 | @Override 29 | public boolean execute(@NotNull Player player, String @NotNull [] args) { 30 | ItemStack item = getHeldItem(player); 31 | if (ItemUtility.isAir(item)) { 32 | sendMessage(player, "error.invalid-held-item"); 33 | return true; 34 | } 35 | 36 | YamlConfiguration configuration = new YamlConfiguration(); 37 | configuration.set("item", item); 38 | 39 | String configurationString = configuration.saveToString(); 40 | String[] split = configurationString.split(Pattern.quote("\n")); 41 | player.sendMessage(split); 42 | return true; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /nms/abstract/src/main/java/com/github/sirblobman/api/nms/ServerHandler.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.Server; 6 | import org.bukkit.command.CommandMap; 7 | import org.bukkit.plugin.java.JavaPlugin; 8 | 9 | /** 10 | * Abstract NMS Server Handler 11 | * @author SirBlobman 12 | */ 13 | public abstract class ServerHandler extends Handler { 14 | /** 15 | * Create a new instance of this handler. 16 | * @param plugin The plugin that owns this instance. 17 | */ 18 | public ServerHandler(@NotNull JavaPlugin plugin) { 19 | super(plugin); 20 | } 21 | 22 | /** 23 | * @return The server instance. 24 | */ 25 | public final Server getServer() { 26 | JavaPlugin plugin = getPlugin(); 27 | return plugin.getServer(); 28 | } 29 | 30 | /** 31 | * @return The server TPS value for 1m 32 | */ 33 | public double getServerTps1m() { 34 | double[] serverTpsValues = getServerTpsValues(); 35 | return serverTpsValues[0]; 36 | } 37 | 38 | /** 39 | * @return The radius for the maximum world size of the server. 40 | */ 41 | public abstract int getMaxWorldSize(); 42 | 43 | /** 44 | * @return An array that contains the three server TPS values of [1m, 5m, 15m] 45 | */ 46 | public abstract double @NotNull [] getServerTpsValues(); 47 | 48 | /** 49 | * @return The Bukkit command map for the server. 50 | * @throws UnsupportedOperationException when the current server version is not supported by the plugin. 51 | */ 52 | public abstract @NotNull CommandMap getCommandMap(); 53 | } 54 | -------------------------------------------------------------------------------- /shaded/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar 2 | 3 | plugins { 4 | id("java") 5 | id("com.gradleup.shadow") version "9.3.0" 6 | } 7 | 8 | repositories { 9 | maven("https://nexus.sirblobman.xyz/public/") 10 | maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") 11 | } 12 | 13 | dependencies { 14 | // XSeries 15 | implementation("com.github.cryptomorin:XSeries:13.6.0") 16 | 17 | // Adventure 18 | implementation("net.kyori:adventure-platform-bukkit:4.4.1") 19 | implementation("net.kyori:adventure-platform-bungeecord:4.4.1") 20 | implementation("net.kyori:adventure-text-minimessage:4.25.0") 21 | implementation("net.kyori:adventure-text-serializer-plain:4.25.0") 22 | 23 | // bStats 24 | implementation("org.bstats:bstats-bukkit:3.1.0") 25 | implementation("org.bstats:bstats-bungeecord:3.1.0") 26 | 27 | // Folia Helper 28 | implementation("com.github.sirblobman.api:folia-helper:1.0.2-SNAPSHOT") 29 | } 30 | 31 | tasks { 32 | named("jar") { 33 | enabled = false 34 | } 35 | 36 | named("shadowJar") { 37 | archiveClassifier.set(null as String?) 38 | val shadePrefix = "com.github.sirblobman.api.shaded" 39 | relocate("com.cryptomorin.xseries", "$shadePrefix.xseries") 40 | relocate("net.kyori.adventure", "$shadePrefix.adventure") 41 | relocate("net.kyori.examination", "$shadePrefix.examination") 42 | relocate("net.kyori.option", "$shadePrefix.option") 43 | relocate("org.bstats", "$shadePrefix.bstats") 44 | } 45 | 46 | named("build") { 47 | dependsOn("shadowJar") 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /nms/fallback/src/main/java/com/github/sirblobman/api/nms/ServerHandler_Fallback.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import java.util.logging.Logger; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import org.bukkit.command.CommandMap; 8 | import org.bukkit.plugin.java.JavaPlugin; 9 | 10 | import com.github.sirblobman.api.utility.VersionUtility; 11 | 12 | public final class ServerHandler_Fallback extends ServerHandler { 13 | public ServerHandler_Fallback(@NotNull JavaPlugin plugin) { 14 | super(plugin); 15 | 16 | String minecraftVersion = VersionUtility.getMinecraftVersion(); 17 | String nmsVersion = VersionUtility.getNetMinecraftServerVersion(); 18 | 19 | Logger logger = getLogger(); 20 | logger.warning("Using fallback ServerHandler."); 21 | logger.warning("Version '" + minecraftVersion + "' and NMS '" + nmsVersion + "' combo is not supported."); 22 | logger.warning("Please contact SirBlobman if you believe this is a mistake."); 23 | logger.warning("https://github.com/SirBlobman/BlueSlimeCore/issues/new/choose"); 24 | } 25 | 26 | @Override 27 | public int getMaxWorldSize() { 28 | // Not supported, assume server.properties default value. 29 | return 29_999_984; 30 | } 31 | 32 | @Override 33 | public double @NotNull [] getServerTpsValues() { 34 | // Not Supported, assume everything is fine. 35 | return new double[] {20.0D, 20.0D, 20.0D}; 36 | } 37 | 38 | @Override 39 | public @NotNull CommandMap getCommandMap() { 40 | // Not Supported 41 | throw new UnsupportedOperationException("Fallback handler does not support command map."); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /nms/1_12_R1/src/main/java/com/github/sirblobman/api/nbt/Adapter_1_12_R1.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nbt; 2 | 3 | import java.util.function.Function; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import net.minecraft.server.v1_12_R1.NBTBase; 8 | 9 | import org.apache.commons.lang3.Validate; 10 | 11 | public final class Adapter_1_12_R1 { 12 | private final Function builder; 13 | private final Function extractor; 14 | private final Class primitiveType; 15 | private final Class complexType; 16 | 17 | public Adapter_1_12_R1(@NotNull Class primitiveType, @NotNull Class complexType, 18 | @NotNull Function builder, @NotNull Function extractor) { 19 | this.primitiveType = primitiveType; 20 | this.complexType = complexType; 21 | this.builder = builder; 22 | this.extractor = extractor; 23 | } 24 | 25 | @NotNull T extract(@NotNull NBTBase base) { 26 | Validate.isInstanceOf(this.complexType, base, "The provided NBTBase was of the type %s. " + 27 | "Expected type %s", base.getClass().getSimpleName(), this.complexType.getSimpleName()); 28 | return this.extractor.apply(this.complexType.cast(base)); 29 | } 30 | 31 | @NotNull Z build(@NotNull Object value) { 32 | Validate.isInstanceOf(this.primitiveType, value, "The provided value was of the type %s. " + 33 | "Expected type %s", value.getClass().getSimpleName(), this.primitiveType.getSimpleName()); 34 | return this.builder.apply(this.primitiveType.cast(value)); 35 | } 36 | 37 | boolean isInstance(@NotNull NBTBase base) { 38 | return this.complexType.isInstance(base); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /item/src/main/java/com/github/sirblobman/api/item/SkullBuilder.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.item; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.OfflinePlayer; 6 | import org.bukkit.inventory.ItemStack; 7 | 8 | import com.github.sirblobman.api.nms.HeadHandler; 9 | import com.github.sirblobman.api.utility.Validate; 10 | 11 | public final class SkullBuilder { 12 | private final HeadHandler headHandler; 13 | 14 | public SkullBuilder(HeadHandler headHandler) { 15 | this.headHandler = Validate.notNull(headHandler, "headHandler must not be null!"); 16 | } 17 | 18 | public @NotNull HeadHandler getHeadHandler() { 19 | return this.headHandler; 20 | } 21 | 22 | public ItemBuilder withTextureUrl(@NotNull String url) { 23 | HeadHandler headHandler = getHeadHandler(); 24 | ItemStack playerHead = headHandler.getTextureHead(url); 25 | return new ItemBuilder(playerHead); 26 | } 27 | 28 | public ItemBuilder withTextureBase64(@NotNull String base64) { 29 | HeadHandler headHandler = getHeadHandler(); 30 | ItemStack playerHead = headHandler.getBase64Head(base64); 31 | return new ItemBuilder(playerHead); 32 | } 33 | 34 | @SuppressWarnings("deprecation") 35 | public ItemBuilder withOwner(@NotNull String playerName) { 36 | HeadHandler headHandler = getHeadHandler(); 37 | ItemStack playerHead = headHandler.getPlayerHead(playerName); 38 | return new ItemBuilder(playerHead); 39 | } 40 | 41 | public ItemBuilder withOwner(@NotNull OfflinePlayer player) { 42 | HeadHandler headHandler = getHeadHandler(); 43 | ItemStack playerHead = headHandler.getPlayerHead(player); 44 | return new ItemBuilder(playerHead); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /bungeecord/abstract/src/main/java/com/github/sirblobman/api/bungeecord/hook/permission/IPermissionHook.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.bungeecord.hook.permission; 2 | 3 | import java.util.UUID; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | import org.jetbrains.annotations.Nullable; 7 | 8 | import com.github.sirblobman.api.bungeecord.hook.IHook; 9 | 10 | public interface IPermissionHook extends IHook { 11 | /** 12 | * Get the prefix text for a specific player. 13 | * 14 | * @param playerId The {@link UUID} of the player. 15 | * @return The prefix for the player, or an empty string if they do not have one. 16 | */ 17 | @Nullable String getPrefix(@NotNull UUID playerId); 18 | 19 | /** 20 | * Get the suffix text for a specific player. 21 | * 22 | * @param playerId The {@link UUID} of the player. 23 | * @return The suffix for the player, or an empty string if they do not have one. 24 | */ 25 | @Nullable String getSuffix(@NotNull UUID playerId); 26 | 27 | /** 28 | * Get the current primary group name for a player. 29 | * 30 | * @param playerId The {@link UUID} of the player. 31 | * @return The primary group name for the player, or an empty string if they do not have one. 32 | */ 33 | @Nullable String getPrimaryGroupName(@NotNull UUID playerId); 34 | 35 | /** 36 | * Get the current LuckPerms primary group weight for a player. 37 | * 38 | * @param playerId The {@link UUID} of the player. 39 | * @param defaultWeight The default weight to use if the player doesn't have a group or weight. 40 | * @return The weight for the player's primary group, or the value of {@code defaultWeight}. 41 | */ 42 | int getPrimaryGroupWeight(@NotNull UUID playerId, int defaultWeight); 43 | } 44 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.name = "BlueSlimeCore" 2 | 3 | // Utilities 4 | include("shaded") 5 | include("utility") 6 | include("paper-helper") 7 | 8 | // BossBar 9 | include("bossbar") 10 | 11 | // NMS Abstract 12 | include("nms") 13 | include("nms:abstract") 14 | include("nms:modern-nbt") 15 | 16 | // NMS Versions 17 | include("nms:fallback") 18 | include("nms:paper") 19 | include("nms:1_8_R3") 20 | include("nms:1_12_R1") 21 | include("nms:1_16_R3") 22 | include("nms:1_17_R1") 23 | include("nms:1_18_R2") 24 | include("nms:1_19_R3") 25 | include("nms:1_20_R1") 26 | include("nms:1_20_R3") 27 | include("nms:1_20_R4") 28 | include("nms:1_21_R3") 29 | include("nms:1_21_R4") 30 | include("nms:1_21_R5") 31 | include("nms:1_21_R6") 32 | include("nms:1_21_R7") 33 | 34 | // NMS Handler 35 | include("nms:scoreboard") 36 | include("nms:handler") 37 | 38 | // Factions 39 | include("factions") 40 | include("factions:abstract") 41 | 42 | // Factions Versions 43 | include("factions:LegacyFactions") 44 | include("factions:MassiveCore-Factions") 45 | include("factions:SaberFactions") 46 | include("factions:FactionsUUID") 47 | include("factions:FactionsUUID-Legacy") 48 | include("factions:FactionsUUID-4") 49 | include("factions:FactionsX") 50 | 51 | // Factions Handler 52 | include("factions:handler") 53 | 54 | // Regular Modules 55 | include("configuration") 56 | include("language") 57 | include("update") 58 | include("item") 59 | include("plugin") 60 | include("command") 61 | 62 | // Menu Handler 63 | include("menu") 64 | include("menu:modern") 65 | 66 | // Core / Plugin 67 | include("core") 68 | 69 | // BungeeCord 70 | include("bungeecord") 71 | include("bungeecord:abstract") 72 | 73 | // BungeeCord Hooks 74 | include("bungeecord:BungeePerms") 75 | include("bungeecord:LuckPerms") 76 | include("bungeecord:PremiumVanish") 77 | 78 | // BungeeCord Core 79 | include("bungeecord:core") 80 | -------------------------------------------------------------------------------- /nms/fallback/src/main/java/com/github/sirblobman/api/nms/PlayerHandler_Fallback.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import java.util.logging.Logger; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import org.bukkit.Material; 8 | import org.bukkit.entity.Player; 9 | import org.bukkit.entity.Player.Spigot; 10 | import org.bukkit.plugin.java.JavaPlugin; 11 | 12 | import com.github.sirblobman.api.utility.VersionUtility; 13 | 14 | 15 | public final class PlayerHandler_Fallback extends PlayerHandler { 16 | public PlayerHandler_Fallback(@NotNull JavaPlugin plugin) { 17 | super(plugin); 18 | 19 | String minecraftVersion = VersionUtility.getMinecraftVersion(); 20 | String nmsVersion = VersionUtility.getNetMinecraftServerVersion(); 21 | 22 | Logger logger = getLogger(); 23 | logger.warning("Using fallback PlayerHandler."); 24 | logger.warning("Version '" + minecraftVersion + "' and NMS '" + nmsVersion + "' combo is not supported."); 25 | logger.warning("Please contact SirBlobman if you believe this is a mistake."); 26 | logger.warning("https://github.com/SirBlobman/BlueSlimeCore/issues/new/choose"); 27 | } 28 | 29 | @Override 30 | public void forceRespawn(@NotNull Player player) { 31 | if (!player.isDead()) { 32 | return; 33 | } 34 | 35 | Spigot spigot = player.spigot(); 36 | spigot.respawn(); 37 | } 38 | 39 | @Override 40 | public double getAbsorptionHearts(@NotNull Player player) { 41 | return 0.0D; 42 | } 43 | 44 | @Override 45 | public void setAbsorptionHearts(@NotNull Player player, double hearts) { 46 | // Not Supported 47 | } 48 | 49 | @Override 50 | public void sendCooldownPacket(@NotNull Player player, @NotNull Material material, int ticksLeft) { 51 | // Not Supported 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /nms/1_8_R3/src/main/java/com/github/sirblobman/api/nms/PlayerHandler_1_8_R3.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.Material; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.plugin.java.JavaPlugin; 8 | 9 | import net.minecraft.server.v1_8_R3.EntityPlayer; 10 | import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; 11 | 12 | public final class PlayerHandler_1_8_R3 extends PlayerHandler { 13 | public PlayerHandler_1_8_R3(@NotNull JavaPlugin plugin) { 14 | super(plugin); 15 | } 16 | 17 | @Override 18 | public void forceRespawn(@NotNull Player player) { 19 | if (!player.isDead()) { 20 | return; 21 | } 22 | 23 | Player.Spigot spigot = player.spigot(); 24 | spigot.respawn(); 25 | } 26 | 27 | @Override 28 | public double getAbsorptionHearts(@NotNull Player player) { 29 | if (!(player instanceof CraftPlayer)) { 30 | throw new IllegalArgumentException("player must be a valid bukkit player."); 31 | } 32 | 33 | CraftPlayer craftPlayer = (CraftPlayer) player; 34 | EntityPlayer nmsPlayer = craftPlayer.getHandle(); 35 | return nmsPlayer.getAbsorptionHearts(); 36 | } 37 | 38 | @Override 39 | public void setAbsorptionHearts(@NotNull Player player, double hearts) { 40 | if (!(player instanceof CraftPlayer)) { 41 | throw new IllegalArgumentException("player must be a valid bukkit player."); 42 | } 43 | 44 | CraftPlayer craftPlayer = (CraftPlayer) player; 45 | EntityPlayer nmsPlayer = craftPlayer.getHandle(); 46 | nmsPlayer.setAbsorptionHearts((float) hearts); 47 | } 48 | 49 | @Override 50 | public void sendCooldownPacket(@NotNull Player player, @NotNull Material material, int ticksLeft) { 51 | // Empty Method 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /nms/fallback/src/main/java/com/github/sirblobman/api/nbt/CustomNbtContainer_Fallback.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nbt; 2 | 3 | import java.util.Collections; 4 | import java.util.Set; 5 | 6 | import org.jetbrains.annotations.NotNull; 7 | import org.jetbrains.annotations.Nullable; 8 | 9 | import org.bukkit.plugin.Plugin; 10 | 11 | public final class CustomNbtContainer_Fallback implements CustomNbtContainer { 12 | private final Plugin plugin; 13 | 14 | public CustomNbtContainer_Fallback(@NotNull Plugin plugin) { 15 | this.plugin = plugin; 16 | } 17 | 18 | public @NotNull Plugin getPlugin() { 19 | return this.plugin; 20 | } 21 | 22 | @Override 23 | public void set(@NotNull String key, @NotNull CustomNbtType type, @NotNull Z value) { 24 | // Do Nothing 25 | } 26 | 27 | @Override 28 | public boolean has(@NotNull String key, @NotNull CustomNbtType type) { 29 | return false; 30 | } 31 | 32 | @Override 33 | public @Nullable Z get(@NotNull String key, @NotNull CustomNbtType type) { 34 | return null; 35 | } 36 | 37 | @Override 38 | public @Nullable Z getOrDefault(@NotNull String key, @NotNull CustomNbtType type, 39 | @Nullable Z defaultValue) { 40 | return defaultValue; 41 | } 42 | 43 | @Override 44 | public @NotNull Set getKeys() { 45 | return Collections.emptySet(); 46 | } 47 | 48 | @Override 49 | public void remove(@NotNull String key) { 50 | // Do Nothing 51 | } 52 | 53 | @Override 54 | public boolean isEmpty() { 55 | return false; 56 | } 57 | 58 | @Override 59 | public @NotNull CustomNbtContext getContext() { 60 | Plugin plugin = getPlugin(); 61 | return new CustomNbtContext_Fallback(plugin); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /nms/1_12_R1/src/main/java/com/github/sirblobman/api/nms/PlayerHandler_1_12_R1.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.Material; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.plugin.java.JavaPlugin; 8 | 9 | import net.minecraft.server.v1_12_R1.EntityPlayer; 10 | import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer; 11 | 12 | public final class PlayerHandler_1_12_R1 extends PlayerHandler { 13 | public PlayerHandler_1_12_R1(@NotNull JavaPlugin plugin) { 14 | super(plugin); 15 | } 16 | 17 | @Override 18 | public void forceRespawn(@NotNull Player player) { 19 | if (!player.isDead()) { 20 | return; 21 | } 22 | 23 | Player.Spigot spigot = player.spigot(); 24 | spigot.respawn(); 25 | } 26 | 27 | @Override 28 | public double getAbsorptionHearts(@NotNull Player player) { 29 | if (!(player instanceof CraftPlayer)) { 30 | throw new IllegalArgumentException("player must be a valid bukkit player."); 31 | } 32 | 33 | CraftPlayer craftPlayer = (CraftPlayer) player; 34 | EntityPlayer nmsPlayer = craftPlayer.getHandle(); 35 | return nmsPlayer.getAbsorptionHearts(); 36 | } 37 | 38 | @Override 39 | public void setAbsorptionHearts(@NotNull Player player, double hearts) { 40 | if (!(player instanceof CraftPlayer)) { 41 | throw new IllegalArgumentException("player must be a valid bukkit player."); 42 | } 43 | 44 | CraftPlayer craftPlayer = (CraftPlayer) player; 45 | EntityPlayer nmsPlayer = craftPlayer.getHandle(); 46 | nmsPlayer.setAbsorptionHearts((float) hearts); 47 | } 48 | 49 | @Override 50 | public void sendCooldownPacket(@NotNull Player player, @NotNull Material material, int ticksLeft) { 51 | player.setCooldown(material, ticksLeft); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /language/src/main/java/com/github/sirblobman/api/language/replacer/FloatReplacer.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.language.replacer; 2 | 3 | import java.text.DecimalFormat; 4 | import java.text.DecimalFormatSymbols; 5 | 6 | import org.jetbrains.annotations.NotNull; 7 | import org.jetbrains.annotations.Nullable; 8 | 9 | import com.github.sirblobman.api.shaded.adventure.text.Component; 10 | 11 | public final class FloatReplacer extends Replacer { 12 | private final float replacement; 13 | private final DecimalFormat format; 14 | private final DecimalFormatSymbols symbols; 15 | 16 | public FloatReplacer(@NotNull String target, float replacement) { 17 | this(target, replacement, null); 18 | } 19 | 20 | public FloatReplacer(@NotNull String target, float replacement, @Nullable DecimalFormat format) { 21 | this(target, replacement, format, null); 22 | } 23 | 24 | public FloatReplacer(@NotNull String target, float replacement, 25 | @Nullable DecimalFormat format, @Nullable DecimalFormatSymbols symbols) { 26 | super(target); 27 | this.replacement = replacement; 28 | this.format = format; 29 | this.symbols = symbols; 30 | } 31 | 32 | @Override 33 | public @NotNull Component getReplacement() { 34 | String replacement = getReplacementString(); 35 | return Component.text(replacement); 36 | } 37 | 38 | @Override 39 | public @NotNull String getReplacementString() { 40 | if (this.format == null) { 41 | return Double.toString(this.replacement); 42 | } 43 | 44 | DecimalFormat decimalFormat = this.format; 45 | if (this.symbols != null) { 46 | decimalFormat = (DecimalFormat) decimalFormat.clone(); 47 | decimalFormat.setDecimalFormatSymbols(this.symbols); 48 | } 49 | 50 | return decimalFormat.format(this.replacement); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /command/src/main/java/com/github/sirblobman/api/command/PlayerCommand.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.command; 2 | 3 | import java.util.Collections; 4 | import java.util.List; 5 | 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | import org.bukkit.command.CommandSender; 9 | import org.bukkit.entity.Player; 10 | import org.bukkit.plugin.java.JavaPlugin; 11 | 12 | public abstract class PlayerCommand extends Command { 13 | public PlayerCommand(JavaPlugin plugin, String commandName) { 14 | super(plugin, commandName); 15 | } 16 | 17 | @Override 18 | protected @NotNull List onTabComplete(@NotNull CommandSender sender, String @NotNull [] args) { 19 | if (sender instanceof Player player) { 20 | return onTabComplete(player, args); 21 | } 22 | 23 | return Collections.emptyList(); 24 | } 25 | 26 | @Override 27 | protected boolean execute(@NotNull CommandSender sender, String @NotNull [] args) { 28 | if (sender instanceof Player player) { 29 | return execute(player, args); 30 | } 31 | 32 | sendMessage(sender, "error.player-only"); 33 | return true; 34 | } 35 | 36 | /** 37 | * @param player The {@link Player} that is tab-completing this command. 38 | * @param args An array of command arguments. 39 | * @return The list of tab completions for this combination of sender and command arguments. 40 | */ 41 | protected abstract @NotNull List onTabComplete(@NotNull Player player, String @NotNull [] args); 42 | 43 | /** 44 | * @param player The {@link Player} that is executing this command. 45 | * @param args An array of command arguments. 46 | * @return {@code true} if the command was executed correctly, {@code false} if the sender needs to see the command 47 | * usage. 48 | */ 49 | protected abstract boolean execute(@NotNull Player player, @NotNull String @NotNull [] args); 50 | } 51 | -------------------------------------------------------------------------------- /item/src/main/java/com/github/sirblobman/api/item/BottleType.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.item; 2 | 3 | import java.util.EnumMap; 4 | import java.util.Map; 5 | 6 | import org.jetbrains.annotations.NotNull; 7 | import org.jetbrains.annotations.Nullable; 8 | 9 | import org.bukkit.inventory.ItemStack; 10 | 11 | import com.github.sirblobman.api.shaded.xseries.XMaterial; 12 | 13 | public enum BottleType { 14 | /** 15 | * A regular potion bottle that players can drink. 16 | */ 17 | BOTTLE(XMaterial.POTION), 18 | 19 | /** 20 | * A potion that can be thrown on the ground. 21 | */ 22 | SPLASH(XMaterial.SPLASH_POTION), 23 | 24 | /** 25 | * A potion that can be thrown on the ground and stays there for a bit. 26 | */ 27 | LINGERING(XMaterial.LINGERING_POTION); 28 | 29 | private static final Map BY_MATERIAL; 30 | 31 | static { 32 | BY_MATERIAL = new EnumMap<>(XMaterial.class); 33 | BottleType[] values = values(); 34 | for (BottleType bottleType : values) { 35 | XMaterial material = bottleType.getMaterial(); 36 | BY_MATERIAL.put(material, bottleType); 37 | } 38 | } 39 | 40 | public static @Nullable BottleType getByMaterial(@NotNull XMaterial material) { 41 | return BY_MATERIAL.get(material); 42 | } 43 | 44 | private final XMaterial material; 45 | 46 | BottleType(@NotNull XMaterial material) { 47 | this.material = material; 48 | } 49 | 50 | /** 51 | * @return A {@link XMaterial} value that matches this potion type. 52 | */ 53 | public @NotNull XMaterial getMaterial() { 54 | return this.material; 55 | } 56 | 57 | /** 58 | * @return An {@link ItemStack} that matches this potion type, or {@code null}. 59 | */ 60 | public @Nullable ItemStack getItem() { 61 | XMaterial material = getMaterial(); 62 | return material.parseItem(); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /paper-helper/src/main/java/com/github/sirblobman/api/utility/paper/ComponentConverter.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.utility.paper; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import com.github.sirblobman.api.shaded.adventure.text.Component; 6 | import com.github.sirblobman.api.shaded.adventure.text.serializer.gson.GsonComponentSerializer; 7 | 8 | public final class ComponentConverter { 9 | public static @NotNull Component normalToShaded(@NotNull net.kyori.adventure.text.Component component) { 10 | String gson = normalToGSON(component); 11 | return gsonToShaded(gson); 12 | } 13 | 14 | public static @NotNull net.kyori.adventure.text.Component shadedToNormal(@NotNull Component component) { 15 | String gson = shadedToGSON(component); 16 | return gsonToNormal(gson); 17 | } 18 | 19 | public static @NotNull String normalToGSON(@NotNull net.kyori.adventure.text.Component component) { 20 | net.kyori.adventure.text.serializer.gson.GsonComponentSerializer serializer = 21 | net.kyori.adventure.text.serializer.gson.GsonComponentSerializer.gson(); 22 | return serializer.serialize(component); 23 | } 24 | 25 | public static @NotNull net.kyori.adventure.text.Component gsonToNormal(@NotNull String gson) { 26 | net.kyori.adventure.text.serializer.gson.GsonComponentSerializer serializer = 27 | net.kyori.adventure.text.serializer.gson.GsonComponentSerializer.gson(); 28 | return serializer.deserialize(gson); 29 | } 30 | 31 | public static @NotNull String shadedToGSON(@NotNull Component component) { 32 | GsonComponentSerializer serializer = GsonComponentSerializer.gson(); 33 | return serializer.serialize(component); 34 | } 35 | 36 | public static @NotNull Component gsonToShaded(@NotNull String gson) { 37 | GsonComponentSerializer serializer = GsonComponentSerializer.gson(); 38 | return serializer.deserialize(gson); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /bungeecord/core/src/main/java/com/github/sirblobman/api/bungeecord/core/hook/DefaultVanishHook.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.bungeecord.core.hook; 2 | 3 | import java.util.UUID; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import net.md_5.bungee.api.connection.ProxiedPlayer; 8 | import net.md_5.bungee.config.Configuration; 9 | 10 | import com.github.sirblobman.api.bungeecord.configuration.ConfigurationManager; 11 | import com.github.sirblobman.api.bungeecord.core.CorePlugin; 12 | import com.github.sirblobman.api.bungeecord.hook.vanish.IVanishHook; 13 | 14 | public record DefaultVanishHook(@NotNull CorePlugin plugin) implements IVanishHook { 15 | @Override 16 | public boolean isDisabled() { 17 | return false; 18 | } 19 | 20 | @Override 21 | public boolean isHidden(@NotNull ProxiedPlayer player) { 22 | UUID playerId = player.getUniqueId(); 23 | return isHidden(playerId); 24 | } 25 | 26 | @Override 27 | public boolean isHidden(@NotNull UUID playerId) { 28 | CorePlugin plugin = plugin(); 29 | ConfigurationManager configurationManager = plugin.getConfigurationManager(); 30 | Configuration configuration = configurationManager.get("hidden.yml"); 31 | 32 | String playerIdString = playerId.toString(); 33 | return configuration.getBoolean(playerIdString, false); 34 | } 35 | 36 | @Override 37 | public void setHidden(@NotNull ProxiedPlayer player, boolean hidden) { 38 | UUID playerId = player.getUniqueId(); 39 | setHidden(playerId, hidden); 40 | } 41 | 42 | @Override 43 | public void setHidden(@NotNull UUID playerId, boolean hidden) { 44 | CorePlugin plugin = plugin(); 45 | ConfigurationManager configurationManager = plugin.getConfigurationManager(); 46 | Configuration configuration = configurationManager.get("hidden.yml"); 47 | 48 | String playerIdString = playerId.toString(); 49 | configuration.set(playerIdString, hidden); 50 | configurationManager.save("hidden.yml"); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /nms/1_8_R3/src/main/java/com/github/sirblobman/api/nms/ServerHandler_1_8_R3.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import java.util.Arrays; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import org.bukkit.Server; 8 | import org.bukkit.command.CommandMap; 9 | import org.bukkit.plugin.java.JavaPlugin; 10 | 11 | import net.minecraft.server.v1_8_R3.MinecraftServer; 12 | import net.minecraft.server.v1_8_R3.PropertyManager; 13 | import org.bukkit.craftbukkit.v1_8_R3.CraftServer; 14 | 15 | public final class ServerHandler_1_8_R3 extends ServerHandler { 16 | public ServerHandler_1_8_R3(@NotNull JavaPlugin plugin) { 17 | super(plugin); 18 | } 19 | 20 | @Override 21 | public int getMaxWorldSize() { 22 | Server server = getServer(); 23 | int defaultValue = 29_999_984; 24 | if (!(server instanceof CraftServer)) { 25 | return defaultValue; 26 | } 27 | 28 | CraftServer craftServer = (CraftServer) server; 29 | MinecraftServer nmsServer = craftServer.getServer(); 30 | PropertyManager propertyManager = nmsServer.getPropertyManager(); 31 | return propertyManager.getInt("max-world-size", defaultValue); 32 | } 33 | 34 | @Override 35 | public double @NotNull [] getServerTpsValues() { 36 | Server server = getServer(); 37 | if (!(server instanceof CraftServer)) { 38 | return new double[] {20.0D, 20.0D, 20.0D}; 39 | } 40 | 41 | CraftServer craftServer = (CraftServer) server; 42 | MinecraftServer nmsServer = craftServer.getServer(); 43 | return Arrays.copyOf(nmsServer.recentTps, 3); 44 | } 45 | 46 | @Override 47 | public @NotNull CommandMap getCommandMap() { 48 | Server server = getServer(); 49 | if (!(server instanceof CraftServer)) { 50 | throw new UnsupportedOperationException("Server implementation is not the correct class."); 51 | } 52 | 53 | CraftServer craftServer = (CraftServer) server; 54 | return craftServer.getCommandMap(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /bungeecord/PremiumVanish/src/main/java/com/github/sirblobman/api/bungeecord/premiumvanish/PremiumVanishListener.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.bungeecord.premiumvanish; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import net.md_5.bungee.api.ProxyServer; 6 | import net.md_5.bungee.api.connection.ProxiedPlayer; 7 | import net.md_5.bungee.api.plugin.Listener; 8 | import net.md_5.bungee.api.plugin.PluginManager; 9 | import net.md_5.bungee.event.EventHandler; 10 | 11 | import com.github.sirblobman.api.bungeecord.configuration.ConfigurablePlugin; 12 | import com.github.sirblobman.api.bungeecord.configuration.IHookPlugin; 13 | import com.github.sirblobman.api.bungeecord.hook.vanish.IVanishHook; 14 | 15 | import de.myzelyam.api.vanish.BungeePlayerHideEvent; 16 | import de.myzelyam.api.vanish.BungeePlayerShowEvent; 17 | 18 | public final class PremiumVanishListener implements Listener { 19 | private final ConfigurablePlugin plugin; 20 | 21 | public PremiumVanishListener(@NotNull ConfigurablePlugin plugin) { 22 | this.plugin = plugin; 23 | } 24 | 25 | @EventHandler 26 | public void onVanish(BungeePlayerHideEvent e) { 27 | ProxiedPlayer player = e.getPlayer(); 28 | getDefaultVanishHook().setHidden(player, true); 29 | } 30 | 31 | @EventHandler 32 | public void onShow(BungeePlayerShowEvent e) { 33 | ProxiedPlayer player = e.getPlayer(); 34 | getDefaultVanishHook().setHidden(player, false); 35 | } 36 | 37 | private @NotNull ConfigurablePlugin getPlugin() { 38 | return this.plugin; 39 | } 40 | 41 | private @NotNull ProxyServer getProxy() { 42 | ConfigurablePlugin plugin = getPlugin(); 43 | return plugin.getProxy(); 44 | } 45 | 46 | private @NotNull IVanishHook getDefaultVanishHook() { 47 | ProxyServer proxy = getProxy(); 48 | PluginManager pluginManager = proxy.getPluginManager(); 49 | IHookPlugin corePlugin = (IHookPlugin) pluginManager.getPlugin("BlueSlimeBungeeCore"); 50 | return corePlugin.getDefaultVanishHook(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /nms/1_12_R1/src/main/java/com/github/sirblobman/api/nms/ServerHandler_1_12_R1.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import java.util.Arrays; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import org.bukkit.Server; 8 | import org.bukkit.command.CommandMap; 9 | import org.bukkit.plugin.java.JavaPlugin; 10 | 11 | import net.minecraft.server.v1_12_R1.MinecraftServer; 12 | import net.minecraft.server.v1_12_R1.PropertyManager; 13 | import org.bukkit.craftbukkit.v1_12_R1.CraftServer; 14 | 15 | public final class ServerHandler_1_12_R1 extends ServerHandler { 16 | public ServerHandler_1_12_R1(@NotNull JavaPlugin plugin) { 17 | super(plugin); 18 | } 19 | 20 | @Override 21 | public int getMaxWorldSize() { 22 | Server server = getServer(); 23 | int defaultValue = 29_999_984; 24 | if (!(server instanceof CraftServer)) { 25 | return defaultValue; 26 | } 27 | 28 | CraftServer craftServer = (CraftServer) server; 29 | MinecraftServer nmsServer = craftServer.getServer(); 30 | PropertyManager propertyManager = nmsServer.getPropertyManager(); 31 | return propertyManager.getInt("max-world-size", defaultValue); 32 | } 33 | 34 | @Override 35 | public double @NotNull [] getServerTpsValues() { 36 | Server server = getServer(); 37 | if (!(server instanceof CraftServer)) { 38 | return new double[] {20.0D, 20.0D, 20.0D}; 39 | } 40 | 41 | CraftServer craftServer = (CraftServer) server; 42 | MinecraftServer nmsServer = craftServer.getServer(); 43 | return Arrays.copyOf(nmsServer.recentTps, 3); 44 | } 45 | 46 | @Override 47 | public @NotNull CommandMap getCommandMap() { 48 | Server server = getServer(); 49 | if (!(server instanceof CraftServer)) { 50 | throw new UnsupportedOperationException("Server implementation is not the correct class."); 51 | } 52 | 53 | CraftServer craftServer = (CraftServer) server; 54 | return craftServer.getCommandMap(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /command/src/main/java/com/github/sirblobman/api/command/ConsoleCommand.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.command; 2 | 3 | import java.util.Collections; 4 | import java.util.List; 5 | 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | import org.bukkit.command.CommandSender; 9 | import org.bukkit.command.ConsoleCommandSender; 10 | import org.bukkit.plugin.java.JavaPlugin; 11 | 12 | public abstract class ConsoleCommand extends Command { 13 | public ConsoleCommand(@NotNull JavaPlugin plugin, @NotNull String commandName) { 14 | super(plugin, commandName); 15 | } 16 | 17 | @Override 18 | protected @NotNull List onTabComplete(@NotNull CommandSender sender, String @NotNull [] args) { 19 | if (sender instanceof ConsoleCommandSender console) { 20 | return onTabComplete(console, args); 21 | } 22 | 23 | return Collections.emptyList(); 24 | } 25 | 26 | @Override 27 | protected boolean execute(@NotNull CommandSender sender, String @NotNull [] args) { 28 | if (sender instanceof ConsoleCommandSender console) { 29 | return execute(console, args); 30 | } 31 | 32 | sendMessage(sender, "error.console-only"); 33 | return true; 34 | } 35 | 36 | /** 37 | * @param console The console that is tab-completing this command. 38 | * @param args An array of command arguments. 39 | * @return The list of tab completions for this combination of sender and command arguments. 40 | */ 41 | protected abstract @NotNull List onTabComplete(@NotNull ConsoleCommandSender console, 42 | String @NotNull [] args); 43 | 44 | /** 45 | * @param console The console that is executing this command. 46 | * @param args An array of command arguments. 47 | * @return {@code true} if the command was executed correctly, {@code false} if the sender needs to see the command 48 | * usage. 49 | */ 50 | protected abstract boolean execute(@NotNull ConsoleCommandSender console, String @NotNull [] args); 51 | } 52 | -------------------------------------------------------------------------------- /spigot.overview.phpBB: -------------------------------------------------------------------------------- 1 | [SIZE=5][B]Supported Versions:[/B][/SIZE] 2 | The recommended versions are currently 1.19.4, 1.20.6, and 1.21.4. 3 | Other Minecraft versions may work, but they are not being tested. 4 | 5 | [SIZE=5][B]Description:[/B][/SIZE] 6 | BlueSlimeCore is an library plugin with many features that are necessary for my other plugins. This library is also free for other developers to use. 7 | 8 | [SIZE=5][B]Features for Servers:[/B][/SIZE] 9 | [LIST] 10 | [*]Support for Spigot, Paper, and Folia 11 | [*]'/item-to-nbt' command to view NBT data tags on items. 12 | [*]'/item-to-base64' command to convert items to Base64 strings. 13 | [*]'/debug-event' command to find plugins and listeners for events. 14 | [/LIST] 15 | 16 | [SIZE=5][B]Features for Developers:[/B][/SIZE] 17 | [LIST] 18 | [*]Configuration management system for saving and loading of multiple files. 19 | [*]Language management system with support for per-player languages, MiniMessage, and PlaceholderAPI. 20 | [*]Ability to send action bars, titles, and sounds through the language API. 21 | [*]Command system with player checking and sub commands. 22 | [*]Plugin update checking with SpigotMC or Hangar. 23 | [*]Menu API for creation of menus with buttons or pages and a configurable item format. 24 | [*]Factions Handler API to aid support with many different Factions plugin. 25 | [*]Item builders to quickly create items, leather armor, potions, and player heads. 26 | [*]Multiple version handler for spawning entities, changing max health, checking absorption. 27 | [*]Multiple version handler for sending cooldown packets and checking server TPS. 28 | [*]Utility methods for dealing with block/entity locations, items, experience, hex colors, and versions. 29 | [/LIST] 30 | 31 | [SIZE=5][B]Help and Support:[/B][/SIZE] 32 | Click the image to join my discord for support. You can also join if you have feature requests or if you just want to chat with other users. 33 | [URL='https://discord.gg/XMq2agT'][IMG]https://discordapp.com/assets/fc0b01fe10a0b8c602fb0106d8189d9b.png[/IMG][/URL] 34 | 35 | [SIZE=5][B]Extra Information:[/B][/SIZE] 36 | Please do not use a review to leave bug reports or errors. I am not able to help you through a review. 37 | -------------------------------------------------------------------------------- /nms/1_8_R3/src/main/java/com/github/sirblobman/api/nbt/Adapter_1_8_R3.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nbt; 2 | 3 | import java.util.function.Function; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import net.minecraft.server.v1_8_R3.NBTBase; 8 | 9 | import org.apache.commons.lang3.Validate; 10 | 11 | public final class Adapter_1_8_R3 { 12 | private final Function builder; 13 | private final Function extractor; 14 | private final Class primitiveType; 15 | private final Class complexType; 16 | 17 | public Adapter_1_8_R3(@NotNull Class primitiveType, @NotNull Class complexType, 18 | @NotNull Function builder, Function extractor) { 19 | this.primitiveType = primitiveType; 20 | this.complexType = complexType; 21 | this.builder = builder; 22 | this.extractor = extractor; 23 | } 24 | 25 | @NotNull T extract(@NotNull NBTBase base) { 26 | Class baseClass = base.getClass(); 27 | String baseClassName = baseClass.getSimpleName(); 28 | String complexTypeName = this.complexType.getSimpleName(); 29 | 30 | String message = "The provided NBT Base was one of the type %s. Expected type %s."; 31 | Validate.isInstanceOf(this.complexType, base, message, baseClassName, complexTypeName); 32 | 33 | Z castedValue = this.complexType.cast(base); 34 | return this.extractor.apply(castedValue); 35 | } 36 | 37 | @NotNull Z build(@NotNull Object value) { 38 | Class valueClass = value.getClass(); 39 | String valueClassName = valueClass.getSimpleName(); 40 | String primitiveClassName = this.primitiveType.getSimpleName(); 41 | 42 | String message = "The provided value was of the type %s. Expected type %s."; 43 | Validate.isInstanceOf(this.primitiveType, value, message, valueClassName, primitiveClassName); 44 | 45 | T castedValue = this.primitiveType.cast(value); 46 | return this.builder.apply(castedValue); 47 | } 48 | 49 | boolean isInstance(@NotNull NBTBase base) { 50 | return this.complexType.isInstance(base); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /nms/abstract/src/main/java/com/github/sirblobman/api/nms/PlayerHandler.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.Material; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.plugin.java.JavaPlugin; 8 | 9 | /** 10 | * Abstract NMS Player Handler Class 11 | * @author SirBlobman 12 | */ 13 | public abstract class PlayerHandler extends Handler { 14 | /** 15 | * Create a new instance of this handler. 16 | * @param plugin The plugin that owns this instance. 17 | */ 18 | public PlayerHandler(@NotNull JavaPlugin plugin) { 19 | super(plugin); 20 | } 21 | 22 | /** 23 | * Force a player to respawn. 24 | * This method can be used to skip the "Respawn or Title Screen" menu. 25 | * @param player the player that will be respawned. 26 | */ 27 | public abstract void forceRespawn(@NotNull Player player); 28 | 29 | /** 30 | * Get the amount of yellow absorption health for a player. 31 | * The name is misleading, the value returned is in health. 32 | * @param player the player that will be checked. 33 | * @return the amount of yellow absorption health for a player. 34 | */ 35 | public abstract double getAbsorptionHearts(@NotNull Player player); 36 | 37 | /** 38 | * Set the amount of yellow absorption health for a player. 39 | * The name is misleading, the value is in health. 40 | * @param player the player that will be changed. 41 | * @param hearts the amount of yellow absorption health to set. 42 | */ 43 | public abstract void setAbsorptionHearts(@NotNull Player player, double hearts); 44 | 45 | /** 46 | * Send an item cooldown packet to a player. 47 | * The cooldown displays on an item the amount of time left before the player can use that type of item again. 48 | * @param player The player that will receive the packet. 49 | * @param material The type of item that will be on cooldown. 50 | * @param ticksLeft The amount of ticks left before the item can be used again. 51 | */ 52 | public abstract void sendCooldownPacket(@NotNull Player player, @NotNull Material material, int ticksLeft); 53 | } 54 | -------------------------------------------------------------------------------- /item/src/main/java/com/github/sirblobman/api/item/PotionBuilder.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.item; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.Color; 6 | import org.bukkit.inventory.meta.ItemMeta; 7 | import org.bukkit.inventory.meta.PotionMeta; 8 | import org.bukkit.potion.PotionData; 9 | import org.bukkit.potion.PotionEffect; 10 | import org.bukkit.potion.PotionType; 11 | 12 | public final class PotionBuilder extends ItemBuilder { 13 | public PotionBuilder(@NotNull BottleType bottleType) { 14 | super(bottleType.getMaterial()); 15 | } 16 | 17 | public @NotNull PotionBuilder withMainEffect(@NotNull PotionType potionType, boolean extended, boolean upgraded) { 18 | ItemMeta itemMeta = getItemMeta(); 19 | if (!(itemMeta instanceof PotionMeta)) { 20 | return this; 21 | } 22 | 23 | PotionMeta potionMeta = (PotionMeta) itemMeta; 24 | PotionData potionData = new PotionData(potionType, extended, upgraded); 25 | potionMeta.setBasePotionData(potionData); 26 | 27 | return (PotionBuilder) withItemMeta(potionMeta); 28 | } 29 | 30 | public @NotNull PotionBuilder withExtraEffect(@NotNull PotionEffect potionEffect) { 31 | ItemMeta itemMeta = getItemMeta(); 32 | if (!(itemMeta instanceof PotionMeta)) { 33 | return this; 34 | } 35 | 36 | PotionMeta potionMeta = (PotionMeta) itemMeta; 37 | potionMeta.addCustomEffect(potionEffect, true); 38 | 39 | return (PotionBuilder) withItemMeta(potionMeta); 40 | } 41 | 42 | public @NotNull PotionBuilder withColor(@NotNull Color color) { 43 | ItemMeta itemMeta = getItemMeta(); 44 | if (!(itemMeta instanceof PotionMeta)) { 45 | return this; 46 | } 47 | 48 | PotionMeta potionMeta = (PotionMeta) itemMeta; 49 | potionMeta.setColor(color); 50 | 51 | return (PotionBuilder) withItemMeta(potionMeta); 52 | } 53 | 54 | public @NotNull PotionBuilder withColor(int red, int green, int blue) { 55 | Color color = Color.fromRGB(red, green, blue); 56 | return withColor(color); 57 | } 58 | 59 | public @NotNull PotionBuilder withColor(int rgb) { 60 | Color color = Color.fromRGB(rgb); 61 | return withColor(color); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /language/src/main/java/com/github/sirblobman/api/language/replacer/DoubleReplacer.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.language.replacer; 2 | 3 | import java.text.DecimalFormat; 4 | import java.text.DecimalFormatSymbols; 5 | 6 | import org.jetbrains.annotations.NotNull; 7 | import org.jetbrains.annotations.Nullable; 8 | 9 | import com.github.sirblobman.api.shaded.adventure.text.Component; 10 | 11 | public final class DoubleReplacer extends Replacer { 12 | private final double replacement; 13 | private final DecimalFormat format; 14 | private final DecimalFormatSymbols symbols; 15 | 16 | public DoubleReplacer(@NotNull String target, double replacement) { 17 | this(target, replacement, null); 18 | } 19 | 20 | public DoubleReplacer(@NotNull String target, double replacement, @Nullable DecimalFormat format) { 21 | this(target, replacement, format, null); 22 | } 23 | 24 | public DoubleReplacer(@NotNull String target, double replacement, @Nullable DecimalFormat format, 25 | @Nullable DecimalFormatSymbols symbols) { 26 | super(target); 27 | this.replacement = replacement; 28 | this.format = format; 29 | this.symbols = symbols; 30 | } 31 | 32 | @Override 33 | public @NotNull Component getReplacement() { 34 | if (this.format == null) { 35 | return Component.text(this.replacement); 36 | } 37 | 38 | DecimalFormat decimalFormat = this.format; 39 | if (this.symbols != null) { 40 | decimalFormat = (DecimalFormat) decimalFormat.clone(); 41 | decimalFormat.setDecimalFormatSymbols(this.symbols); 42 | } 43 | 44 | String formatted = decimalFormat.format(this.replacement); 45 | return Component.text(formatted); 46 | } 47 | 48 | @Override 49 | public @NotNull String getReplacementString() { 50 | if (this.format == null) { 51 | return Double.toString(this.replacement); 52 | } 53 | 54 | DecimalFormat decimalFormat = this.format; 55 | if (this.symbols != null) { 56 | decimalFormat = (DecimalFormat) decimalFormat.clone(); 57 | decimalFormat.setDecimalFormatSymbols(this.symbols); 58 | } 59 | 60 | return decimalFormat.format(this.replacement); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /nms/modern-nbt/src/main/java/com/github/sirblobman/api/nbt/modern/CustomNbtPersistentDataTypeWrapper.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nbt.modern; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import org.bukkit.persistence.PersistentDataAdapterContext; 6 | import org.bukkit.persistence.PersistentDataType; 7 | import org.bukkit.plugin.Plugin; 8 | 9 | import com.github.sirblobman.api.nbt.CustomNbtContext; 10 | import com.github.sirblobman.api.nbt.CustomNbtType; 11 | 12 | import static com.github.sirblobman.api.nbt.modern.PersistentDataConverter.convertContext; 13 | 14 | public final class CustomNbtPersistentDataTypeWrapper implements PersistentDataType { 15 | private final Plugin plugin; 16 | private final CustomNbtType customNbtType; 17 | 18 | public CustomNbtPersistentDataTypeWrapper(@NotNull Plugin plugin, @NotNull CustomNbtType customNbtType) { 19 | this.plugin = plugin; 20 | this.customNbtType = customNbtType; 21 | } 22 | 23 | @Override 24 | public @NotNull Class getPrimitiveType() { 25 | CustomNbtType customNbtType = getCustomNbtType(); 26 | return customNbtType.getPrimitiveType(); 27 | } 28 | 29 | @Override 30 | public @NotNull Class getComplexType() { 31 | CustomNbtType customNbtType = getCustomNbtType(); 32 | return customNbtType.getComplexType(); 33 | } 34 | 35 | @Override 36 | public @NotNull T toPrimitive(@NotNull Z complex, @NotNull PersistentDataAdapterContext context) { 37 | Plugin plugin = getPlugin(); 38 | CustomNbtType customNbtType = getCustomNbtType(); 39 | CustomNbtContext convertedContext = convertContext(plugin, context); 40 | return customNbtType.toPrimitive(complex, convertedContext); 41 | } 42 | 43 | @Override 44 | public @NotNull Z fromPrimitive(@NotNull T primitive, @NotNull PersistentDataAdapterContext context) { 45 | Plugin plugin = getPlugin(); 46 | CustomNbtType customNbtType = getCustomNbtType(); 47 | CustomNbtContext convertedContext = convertContext(plugin, context); 48 | return customNbtType.fromPrimitive(primitive, convertedContext); 49 | } 50 | 51 | private @NotNull Plugin getPlugin() { 52 | return this.plugin; 53 | } 54 | 55 | private @NotNull CustomNbtType getCustomNbtType() { 56 | return this.customNbtType; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /menu/src/main/java/com/github/sirblobman/api/menu/AbstractPagedMenu.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.menu; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.plugin.Plugin; 8 | 9 | import com.github.sirblobman.api.shaded.adventure.text.Component; 10 | import com.github.sirblobman.api.shaded.adventure.text.TextReplacementConfig; 11 | 12 | public abstract class AbstractPagedMenu

extends AbstractMenu

{ 13 | private int currentPage; 14 | 15 | public AbstractPagedMenu(@NotNull P plugin, @NotNull Player player) { 16 | this(null, plugin, player); 17 | } 18 | 19 | public AbstractPagedMenu(@Nullable IMenu parentMenu, @NotNull P plugin, @NotNull Player player) { 20 | super(parentMenu, plugin, player); 21 | this.currentPage = 1; 22 | } 23 | 24 | @Override 25 | public Component getTitle() { 26 | Component titleFormat = getTitleFormat(); 27 | if (titleFormat == null) { 28 | return null; 29 | } 30 | 31 | TextReplacementConfig.Builder replacementBuilder = TextReplacementConfig.builder(); 32 | replacementBuilder.matchLiteral("{page}").replacement(Component.text(currentPage)); 33 | TextReplacementConfig replacementConfig = replacementBuilder.build(); 34 | return titleFormat.replaceText(replacementConfig); 35 | } 36 | 37 | public final int getCurrentPage() { 38 | return this.currentPage; 39 | } 40 | 41 | public void setCurrentPage(int page) { 42 | this.currentPage = page; 43 | } 44 | 45 | public final void openNextPage() { 46 | int currentPage = getCurrentPage(); 47 | int maximumPage = getMaxPages(); 48 | 49 | int newPage = Math.min(currentPage + 1, maximumPage); 50 | if (currentPage == newPage) { 51 | return; 52 | } 53 | 54 | setCurrentPage(newPage); 55 | open(); 56 | } 57 | 58 | public final void openPreviousPage() { 59 | int currentPage = getCurrentPage(); 60 | int newPage = Math.max(currentPage - 1, 1); 61 | if (currentPage == newPage) { 62 | return; 63 | } 64 | 65 | setCurrentPage(newPage); 66 | open(); 67 | } 68 | 69 | public abstract int getMaxPages(); 70 | 71 | public abstract Component getTitleFormat(); 72 | } 73 | -------------------------------------------------------------------------------- /bungeecord/core/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar 2 | 3 | fun getEnvOrProp(variableName: String, propertyName: String): String { 4 | val environmentProvider = providers.environmentVariable(variableName) 5 | val propertyProvider = providers.gradleProperty(propertyName) 6 | return environmentProvider.orElse(propertyProvider).orElse("").get() 7 | } 8 | 9 | fun getProp(propertyName: String): String { 10 | val propertyProvider = providers.gradleProperty(propertyName) 11 | return propertyProvider.get() 12 | } 13 | 14 | val pluginVersion = rootProject.version.toString() 15 | 16 | plugins { 17 | id("maven-publish") 18 | id("com.github.johnrengelman.shadow") version "8.1.1" 19 | id("de.eldoria.plugin-yml.bungee") version "0.8.0" 20 | } 21 | 22 | bungee { 23 | name = "BlueSlimeCore" 24 | author = "SirBlobman" 25 | version = pluginVersion 26 | main = "com.github.sirblobman.api.bungeecord.core.CorePlugin" 27 | } 28 | 29 | dependencies { 30 | // Local Dependencies 31 | implementation(project(path = ":shaded", configuration = "shadow")) 32 | implementation(project(":utility")) 33 | 34 | // BungeeCord Modules 35 | implementation(project(":bungeecord:abstract")) 36 | implementation(project(":bungeecord:BungeePerms")) 37 | implementation(project(":bungeecord:LuckPerms")) 38 | implementation(project(":bungeecord:PremiumVanish")) 39 | } 40 | 41 | tasks { 42 | named("jar") { 43 | enabled = false 44 | } 45 | 46 | named("shadowJar") { 47 | archiveFileName.set("BlueSlimeBungeeCore-$pluginVersion.jar") 48 | archiveClassifier.set(null as String?) 49 | } 50 | 51 | named("build") { 52 | dependsOn("shadowJar") 53 | } 54 | } 55 | 56 | publishing { 57 | repositories { 58 | maven("https://nexus.sirblobman.xyz/public/") { 59 | credentials { 60 | username = getEnvOrProp("MAVEN_DEPLOY_USR", "maven.username.sirblobman") 61 | password = getEnvOrProp("MAVEN_DEPLOY_PSW", "maven.password.sirblobman") 62 | } 63 | } 64 | } 65 | 66 | publications { 67 | create("maven") { 68 | groupId = "com.github.sirblobman.api.bungeecord" 69 | artifactId = "core" 70 | version = getProp("version.api") 71 | artifact(tasks["shadowJar"]) 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /nms/fallback/src/main/java/com/github/sirblobman/api/nms/EntityHandler_Fallback.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import java.util.function.Consumer; 4 | import java.util.logging.Logger; 5 | 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | import org.bukkit.Location; 9 | import org.bukkit.World; 10 | import org.bukkit.entity.Entity; 11 | import org.bukkit.entity.LivingEntity; 12 | import org.bukkit.plugin.java.JavaPlugin; 13 | 14 | import com.github.sirblobman.api.utility.VersionUtility; 15 | 16 | public final class EntityHandler_Fallback extends EntityHandler { 17 | public EntityHandler_Fallback(@NotNull JavaPlugin plugin) { 18 | super(plugin); 19 | 20 | String minecraftVersion = VersionUtility.getMinecraftVersion(); 21 | String nmsVersion = VersionUtility.getNetMinecraftServerVersion(); 22 | 23 | Logger logger = getLogger(); 24 | logger.warning("Using fallback EntityHandler."); 25 | logger.warning("Version '" + minecraftVersion + "' and NMS '" + nmsVersion + "' combo is not supported."); 26 | logger.warning("Please contact SirBlobman if you believe this is a mistake."); 27 | logger.warning("https://github.com/SirBlobman/BlueSlimeCore/issues/new/choose"); 28 | } 29 | 30 | @Override 31 | public @NotNull String getName(@NotNull Entity entity) { 32 | return entity.getName(); 33 | } 34 | 35 | @Override 36 | public void setCustomNameTextOnly(@NotNull Entity entity, String text, boolean visible) { 37 | entity.setCustomName(text); 38 | entity.setCustomNameVisible(false); 39 | } 40 | 41 | @Override 42 | public double getMaxHealth(@NotNull LivingEntity entity) { 43 | return entity.getMaxHealth(); 44 | } 45 | 46 | @Override 47 | public void setMaxHealth(@NotNull LivingEntity entity, double maxHealth) { 48 | entity.setMaxHealth(maxHealth); 49 | } 50 | 51 | @Override 52 | public @NotNull T spawnEntity(@NotNull Location location, @NotNull Class entityClass, 53 | @NotNull Consumer beforeSpawn) { 54 | World world = location.getWorld(); 55 | if (world == null) { 56 | throw new IllegalArgumentException("location must not have a null world."); 57 | } 58 | 59 | T entity = world.spawn(location, entityClass); 60 | beforeSpawn.accept(entity); 61 | return entity; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /utility/src/main/java/com/github/sirblobman/api/utility/ConfigurationHelper.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.utility; 2 | 3 | import java.util.Collection; 4 | import java.util.Collections; 5 | import java.util.EnumSet; 6 | import java.util.HashSet; 7 | import java.util.Locale; 8 | import java.util.Set; 9 | 10 | import org.jetbrains.annotations.Contract; 11 | import org.jetbrains.annotations.NotNull; 12 | import org.jetbrains.annotations.Nullable; 13 | 14 | public final class ConfigurationHelper { 15 | @Contract("_, _, !null -> !null") 16 | public static > E parseEnum(@NotNull Class enumClass, @NotNull String value, 17 | @Nullable E defaultValue) { 18 | String uppercaseValue = value.toUpperCase(Locale.US); 19 | String fixedValue = uppercaseValue.replace(' ', '_').replace('-', '_'); 20 | 21 | E[] enumValues = enumClass.getEnumConstants(); 22 | for (E enumValue : enumValues) { 23 | String enumName = enumValue.name(); 24 | if (enumName.equals(fixedValue)) { 25 | return enumValue; 26 | } 27 | } 28 | 29 | return defaultValue; 30 | } 31 | 32 | public static > @NotNull Set parseEnums(@NotNull Collection items, 33 | @NotNull Class enumClass) { 34 | if (items.isEmpty()) { 35 | return EnumSet.noneOf(enumClass); 36 | } 37 | 38 | if (items.contains("*")) { 39 | return EnumSet.allOf(enumClass); 40 | } 41 | 42 | E[] enumValues = enumClass.getEnumConstants(); 43 | Set enumSet = EnumSet.noneOf(enumClass); 44 | 45 | for (E enumValue : enumValues) { 46 | String enumName = enumValue.name(); 47 | if (items.contains(enumName)) { 48 | enumSet.add(enumValue); 49 | } 50 | } 51 | 52 | return enumSet; 53 | } 54 | 55 | public static > @NotNull Set getEnumNames(@NotNull Class enumClass) { 56 | E[] enumArray = enumClass.getEnumConstants(); 57 | Set enumNameSet = new HashSet<>(); 58 | 59 | for (E enumValue : enumArray) { 60 | String enumName = enumValue.name(); 61 | enumNameSet.add(enumName); 62 | } 63 | 64 | return Collections.unmodifiableSet(enumNameSet); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /nms/handler/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar 2 | 3 | plugins { 4 | id("com.github.johnrengelman.shadow") version "8.1.1" 5 | } 6 | 7 | repositories { 8 | maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") 9 | maven("https://oss.sonatype.org/service/local/repositories/snapshots/content/") 10 | } 11 | 12 | dependencies { 13 | // Spigot API 14 | compileOnly("org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT") 15 | 16 | // Local Dependencies 17 | compileOnly(project(":paper-helper")) 18 | 19 | // NMS Abstract + Modern NBT 20 | implementation(project(":nms:abstract")) 21 | implementation(project(":nms:modern-nbt")) 22 | 23 | // NMS BossBar + Scoreboard 24 | implementation(project(":bossbar")) 25 | implementation(project(":nms:scoreboard")) 26 | 27 | // NMS Versions 28 | implementation(project(":nms:fallback")) // NMS Fallback 29 | implementation(project(":nms:paper")) // NMS Paper 30 | implementation(project(":nms:1_8_R3")) // NMS 1.8.8 31 | implementation(project(":nms:1_12_R1")) // NMS 1.12.2 32 | implementation(project(":nms:1_16_R3")) // NMS 1.16.5 33 | implementation(project(path = ":nms:1_17_R1", configuration = "remap")) // NMS 1.17.1 34 | implementation(project(path = ":nms:1_18_R2", configuration = "remap")) // NMS 1.18.2 35 | implementation(project(path = ":nms:1_19_R3", configuration = "remap")) // NMS 1.19.4 36 | implementation(project(path = ":nms:1_20_R1", configuration = "remap")) // NMS 1.20.1 37 | implementation(project(path = ":nms:1_20_R3", configuration = "remap")) // NMS 1.20.4 38 | implementation(project(path = ":nms:1_20_R4", configuration = "remap")) // NMS 1.20.6 39 | implementation(project(path = ":nms:1_21_R3", configuration = "remap")) // NMS 1.21.4 40 | implementation(project(path = ":nms:1_21_R4", configuration = "remap")) // NMS 1.21.5 41 | implementation(project(path = ":nms:1_21_R5", configuration = "remap")) // NMS 1.21.8 42 | implementation(project(path = ":nms:1_21_R6", configuration = "remap")) // NMS 1.21.10 43 | implementation(project(path = ":nms:1_21_R7", configuration = "remap")) // NMS 1.21.11 44 | } 45 | 46 | tasks { 47 | named("jar") { 48 | enabled = false 49 | } 50 | 51 | named("shadowJar") { 52 | archiveClassifier.set(null as String?) 53 | } 54 | 55 | named("build") { 56 | dependsOn("shadowJar") 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /nms/abstract/src/main/java/com/github/sirblobman/api/nbt/CustomNbtTypes.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nbt; 2 | 3 | import com.github.sirblobman.api.nbt.custom.CustomNbtTypeBoolean; 4 | import com.github.sirblobman.api.nbt.custom.CustomNbtTypeUUID; 5 | 6 | public final class CustomNbtTypes { 7 | /* 8 | Java primitive types. 9 | */ 10 | public static CustomNbtType BYTE; 11 | public static CustomNbtType SHORT; 12 | public static CustomNbtType INTEGER; 13 | public static CustomNbtType LONG; 14 | public static CustomNbtType FLOAT; 15 | public static CustomNbtType DOUBLE; 16 | 17 | /* 18 | String. 19 | */ 20 | public static CustomNbtType STRING; 21 | 22 | /* 23 | Primitive Arrays. 24 | */ 25 | public static CustomNbtType BYTE_ARRAY; 26 | public static CustomNbtType INTEGER_ARRAY; 27 | public static CustomNbtType LONG_ARRAY; 28 | 29 | /* 30 | Complex Arrays. 31 | */ 32 | public static CustomNbtType TAG_CONTAINER_ARRAY; 33 | 34 | /* 35 | Nested CustomNbtContainer. 36 | */ 37 | public static CustomNbtType TAG_CONTAINER; 38 | 39 | /* 40 | Built-in Custom Types 41 | */ 42 | public static CustomNbtTypeUUID UUID; 43 | public static CustomNbtTypeBoolean BOOLEAN; 44 | 45 | static { 46 | BYTE = new CustomNbtTypePrimitive<>(Byte.class); 47 | SHORT = new CustomNbtTypePrimitive<>(Short.class); 48 | INTEGER = new CustomNbtTypePrimitive<>(Integer.class); 49 | LONG = new CustomNbtTypePrimitive<>(Long.class); 50 | FLOAT = new CustomNbtTypePrimitive<>(Float.class); 51 | DOUBLE = new CustomNbtTypePrimitive<>(Double.class); 52 | 53 | STRING = new CustomNbtTypePrimitive<>(String.class); 54 | 55 | BYTE_ARRAY = new CustomNbtTypePrimitive<>(byte[].class); 56 | INTEGER_ARRAY = new CustomNbtTypePrimitive<>(int[].class); 57 | LONG_ARRAY = new CustomNbtTypePrimitive<>(long[].class); 58 | 59 | TAG_CONTAINER_ARRAY = new CustomNbtTypePrimitive<>(CustomNbtContainer[].class); 60 | 61 | TAG_CONTAINER = new CustomNbtTypePrimitive<>(CustomNbtContainer.class); 62 | 63 | UUID = new CustomNbtTypeUUID(); 64 | BOOLEAN = new CustomNbtTypeBoolean(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /nms/1_12_R1/src/main/java/com/github/sirblobman/api/nms/EntityHandler_1_12_R1.java: -------------------------------------------------------------------------------- 1 | package com.github.sirblobman.api.nms; 2 | 3 | import java.util.function.Consumer; 4 | 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import org.bukkit.Location; 8 | import org.bukkit.World; 9 | import org.bukkit.attribute.Attribute; 10 | import org.bukkit.attribute.AttributeInstance; 11 | import org.bukkit.entity.Entity; 12 | import org.bukkit.entity.LivingEntity; 13 | import org.bukkit.entity.Player; 14 | import org.bukkit.plugin.java.JavaPlugin; 15 | 16 | import com.github.sirblobman.api.utility.Validate; 17 | 18 | public final class EntityHandler_1_12_R1 extends EntityHandler { 19 | public EntityHandler_1_12_R1(@NotNull JavaPlugin plugin) { 20 | super(plugin); 21 | } 22 | 23 | @Override 24 | public @NotNull String getName(@NotNull Entity entity) { 25 | if (entity instanceof Player) { 26 | Player player = (Player) entity; 27 | return player.getName(); 28 | } 29 | 30 | String customName = entity.getCustomName(); 31 | return (customName != null ? customName : entity.getName()); 32 | } 33 | 34 | @Override 35 | public void setCustomNameTextOnly(@NotNull Entity entity, String text, boolean visible) { 36 | entity.setCustomName(text); 37 | entity.setCustomNameVisible(visible); 38 | } 39 | 40 | @Override 41 | public double getMaxHealth(@NotNull LivingEntity entity) { 42 | AttributeInstance attribute = entity.getAttribute(Attribute.GENERIC_MAX_HEALTH); 43 | if (attribute != null) { 44 | return attribute.getValue(); 45 | } 46 | 47 | return 0.0D; 48 | } 49 | 50 | @Override 51 | public void setMaxHealth(@NotNull LivingEntity entity, double maxHealth) { 52 | AttributeInstance attribute = entity.getAttribute(Attribute.GENERIC_MAX_HEALTH); 53 | if (attribute != null) { 54 | attribute.setBaseValue(maxHealth); 55 | } 56 | } 57 | 58 | @Override 59 | public @NotNull T spawnEntity(@NotNull Location location, @NotNull Class entityClass, 60 | @NotNull Consumer beforeSpawn) { 61 | World world = location.getWorld(); 62 | Validate.notNull(world, "location must have a valid world!"); 63 | 64 | org.bukkit.util.Consumer bukkitConsumer = beforeSpawn::accept; 65 | return world.spawn(location, entityClass, bukkitConsumer); 66 | } 67 | } 68 | --------------------------------------------------------------------------------