diff --git a/README.md b/README.md index ac30a90b..d6832462 100644 --- a/README.md +++ b/README.md @@ -7,12 +7,13 @@ --- > [!IMPORTANT] -> Brewery**X** is based off of an over **decade** old plugin called Brewery. A lot of this code is old and awful to look at. If you see poorly written code, don't assume the worst because chances are, I didn't even write it. Thanks +> Brewery**X** is based off of an over **decade** old plugin, [Brewery](https://github.com/DieReicheErethons/Brewery). +> Bugs and issues are bound to happen, so please report them on our [Discord](https://discord.gg/aV5Am7uxWr) or [GitHub issues](https://github.com/BreweryTeam/BreweryX/issues)! ### Brewery is a Plugin for an alternate brewing process, including alcoholic Potions. -Works with Spigot, Paper, and Folia from `1.21.1` to `1.8.x`! +Works with Spigot, Paper, and Folia from `1.21.4` to `1.8.9`! The somewhat difficult brewing process rewards you with a diversity of Potions, which, through their effects, create a drunkenness that has never existed in Minecraft before. @@ -57,7 +58,7 @@ The somewhat difficult brewing process rewards you with a diversity of Potions, - [Depenizen support](https://github.com/DenizenScript/Depenizen/pull/430) for Denizen Scripters -### For Java developers, use any release jar locally or get any release from [Jitpack](https://jitpack.io/#BreweryTeam/BreweryX) +### For Java developers, find our repository for the BreweryX API [here](https://repo.jsinco.dev/#/releases/com/dre/brewery/BreweryX). Check [the documentation](https://brewery.lumamc.net/api/api/) for more information. diff --git a/build.gradle.kts b/build.gradle.kts index d411941c..15a70a31 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -211,7 +211,7 @@ publishing { if (user != null && pass != null) { create("jsinco") { - groupId = "com.dre.brewery" + groupId = project.group.toString() artifactId = "BreweryX" version = project.version.toString() artifact(tasks.shadowJar.get().archiveFile) { diff --git a/docs/en/api/api.md b/docs/en/api/api.md index 40404590..4eafc7ce 100644 --- a/docs/en/api/api.md +++ b/docs/en/api/api.md @@ -199,21 +199,22 @@ Lombok is recommended for Java developers to reduce boilerplate code. # External Plugin API -For Java developers, use any release jar locally or preferably, use JitPack: +For Java developers, you can use [JitPack](https://jitpack.io/#BreweryTeam/BreweryX) or the [provided repository](https://repo.jsinco.dev/#/releases/com/dre/brewery/BreweryX) to add BreweryX as a dependency: ## Maven ```XML - jitpack.io - https://jitpack.io + jsinco-repo + https://repo.jsinco.dev/releases + -com.github.BreweryTeam -BreweryX -VERSION -provided + com.dre.brewery + BreweryX + VERSION + provided ``` @@ -223,11 +224,11 @@ For Java developers, use any release jar locally or preferably, use JitPack: ``` groovy repositories { - maven { url 'https://jitpack.io' } + maven { url 'https://repo.jsinco.dev/releases' } } dependencies { - implementation 'com.github.BreweryTeam:BreweryX:VERSION' + implementation 'com.dre.brewery:BreweryX:VERSION' } ``` @@ -235,17 +236,17 @@ For Java developers, use any release jar locally or preferably, use JitPack: ``` kotlin repositories { - maven("https://jitpack.io") + maven("https://repo.jsinco.dev/releases") } dependencies { - implementation("com.github.BreweryTeam:BreweryX:VERSION") + implementation("com.dre.brewery:BreweryX:VERSION") } ``` !!! warning - Don't forget to replace `VERSION` with a version [available on JitPack](https://jitpack.io/#BreweryTeam/BreweryX#releasesLink). + Don't forget to replace `VERSION` with an available [version](https://repo.jsinco.dev/#/releases/com/dre/brewery/BreweryX). You also need to add a dependency in the `plugin.yml` or `paper-plugin.yml` file. This ensures BreweryX loads before your plugin. diff --git a/src/main/java/com/dre/brewery/BPlayer.java b/src/main/java/com/dre/brewery/BPlayer.java index 27aa9e7b..3bd7621c 100644 --- a/src/main/java/com/dre/brewery/BPlayer.java +++ b/src/main/java/com/dre/brewery/BPlayer.java @@ -34,6 +34,9 @@ import com.dre.brewery.utility.MinecraftVersion; import com.dre.brewery.utility.PermissionUtil; import com.github.Anon8281.universalScheduler.scheduling.tasks.MyScheduledTask; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.Bukkit; @@ -61,6 +64,9 @@ import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; +@ToString +@Getter +@Setter public class BPlayer { private static final MinecraftVersion VERSION = BreweryPlugin.getMCVersion(); @@ -511,9 +517,8 @@ public int canJoin() { // he may be having a hangover public void join(final Player player) { - if (offlineDrunk == 0) { - return; - } + // TODO: Rewrite part of this class to not use offlinedrunk, a bunch of this overhead boilerplate is completely unnecessary and overcomplicates our code + // Modified this method a bit to just patch wakeups not working but this *REALLY* needs a rewrite if (drunkenness < 10) { if (offlineDrunk > 60) { @@ -529,7 +534,7 @@ public void join(final Player player) { remove(player); } - } else if (offlineDrunk - drunkenness >= 30) { + } else if (offlineDrunk >= 30 || drunkenness >= 30) { if (config.isEnableWake() && !player.hasPermission("brewery.bypass.teleport")) { Location randomLoc = Wakeup.getRandom(player.getLocation()); if (randomLoc != null) { @@ -538,6 +543,7 @@ public void join(final Player player) { } } } + offlineDrunk = 0; } diff --git a/src/main/java/com/dre/brewery/commands/CommandManager.java b/src/main/java/com/dre/brewery/commands/CommandManager.java index a659de97..41bfd115 100644 --- a/src/main/java/com/dre/brewery/commands/CommandManager.java +++ b/src/main/java/com/dre/brewery/commands/CommandManager.java @@ -167,4 +167,10 @@ public static void removeSubCommand(SubCommand subCommand) { subCommands.remove(key); } } + + public static void execute(Class clazz, CommandSender sender, String label, String[] args) { + subCommands.values().stream() + .filter(subCommand -> subCommand.getClass().equals(clazz)) + .forEach(subCommand -> subCommand.execute(plugin, lang, sender, label, args)); + } } diff --git a/src/main/java/com/dre/brewery/commands/subcommands/DataManagerCommand.java b/src/main/java/com/dre/brewery/commands/subcommands/DataManagerCommand.java index 28cbfbc1..19c57028 100644 --- a/src/main/java/com/dre/brewery/commands/subcommands/DataManagerCommand.java +++ b/src/main/java/com/dre/brewery/commands/subcommands/DataManagerCommand.java @@ -21,6 +21,7 @@ package com.dre.brewery.commands.subcommands; import com.dre.brewery.BreweryPlugin; +import com.dre.brewery.commands.CommandManager; import com.dre.brewery.commands.SubCommand; import com.dre.brewery.configuration.ConfigManager; import com.dre.brewery.configuration.files.Config; @@ -43,6 +44,7 @@ public void execute(BreweryPlugin breweryPlugin, Lang lang, CommandSender sender switch (args[1].toLowerCase()) { case "reload" -> BreweryPlugin.getDataManager().exit(true, true, () -> { + CommandManager.execute(ReloadCommand.class, sender, label, args); try { BreweryPlugin.setDataManager(DataManager.createDataManager(ConfigManager.getConfig(Config.class).getStorage())); Logging.msg(sender, "Reloaded the DataManager!"); diff --git a/src/main/java/com/dre/brewery/configuration/files/RecipesFile.java b/src/main/java/com/dre/brewery/configuration/files/RecipesFile.java index 4fdbb62f..e97bebdf 100644 --- a/src/main/java/com/dre/brewery/configuration/files/RecipesFile.java +++ b/src/main/java/com/dre/brewery/configuration/files/RecipesFile.java @@ -69,15 +69,12 @@ public Map getRecipes() { map.putAll(ConfigManager.getConfig(Config.class).getRecipes()); // Filter out the disabled ones now - // TODO: Remove debug - System.out.println("Recipes: " + map.size()); map.values().removeIf(recipe -> { if (recipe.getEnabled() == null) { return false; } return !recipe.getEnabled(); }); - System.out.println("Recipes: " + map.size()); return map; } diff --git a/src/main/resources/languages/es.yml b/src/main/resources/languages/es.yml index ef0e1157..b5a7ee73 100644 --- a/src/main/resources/languages/es.yml +++ b/src/main/resources/languages/es.yml @@ -1,7 +1,7 @@ # Traducción al español for BreweryX # Author: KoCitrusMaker # Brew -Brew_-times: veces +Brew_-times: -veces Brew_BadPotion: Bebida arruinada Brew_BarrelRiped: Añejado en tonel Brew_DistillUndefined: Destilado turbio