diff --git a/src/main/java/net/thenextlvl/tweaks/TweaksPlugin.java b/src/main/java/net/thenextlvl/tweaks/TweaksPlugin.java index faee604..c85c0a7 100644 --- a/src/main/java/net/thenextlvl/tweaks/TweaksPlugin.java +++ b/src/main/java/net/thenextlvl/tweaks/TweaksPlugin.java @@ -76,7 +76,7 @@ public class TweaksPlugin extends JavaPlugin { private final CommandConfig commands = new GsonFile<>( IO.of(getDataFolder(), "commands.json"), new CommandConfig() - ).validate().saveIfAbsent().getRoot(); + ).validate().save().getRoot(); private @Nullable ComponentBundle bundle; private @Nullable FileIO config; @@ -127,9 +127,9 @@ private void registerCommands() { registerItemCommands(registrar); registerPlayerCommands(registrar); registerServerCommands(registrar); - registerTimeCommands(registrar); - registerWeatherCommands(registrar); - registerWorkstationCommands(registrar); + if (features.time()) registerTimeCommands(registrar); + if (features.weather()) registerWeatherCommands(registrar); + if (features.workstation()) registerWorkstationCommands(registrar); if (features.homes()) registerHomeCommands(registrar); if (features.msg()) registerMSGCommands(registrar); if (features.spawn()) registerSpawnCommands(registrar); @@ -140,109 +140,108 @@ private void registerCommands() { } private void registerTimeCommands(Commands registrar) { - new DayCommand(this).register(registrar); - new MidnightCommand(this).register(registrar); - new NightCommand(this).register(registrar); - new NoonCommand(this).register(registrar); - new TimeCommand(this).register(registrar); + if (commands().day().enabled()) new DayCommand(this).register(registrar); + if (commands().midnight().enabled()) new MidnightCommand(this).register(registrar); + if (commands().night().enabled()) new NightCommand(this).register(registrar); + if (commands().noon().enabled()) new NoonCommand(this).register(registrar); + if (commands().time().enabled()) new TimeCommand(this).register(registrar); } private void registerWeatherCommands(Commands registrar) { - new RainCommand(this).register(registrar); - new SunCommand(this).register(registrar); - new ThunderCommand(this).register(registrar); - new WeatherCommand(this).register(registrar); + if (commands().rain().enabled()) new RainCommand(this).register(registrar); + if (commands().sun().enabled()) new SunCommand(this).register(registrar); + if (commands().thunder().enabled()) new ThunderCommand(this).register(registrar); + if (commands().weather().enabled()) new WeatherCommand(this).register(registrar); } private void registerItemCommands(Commands registrar) { - new EnchantCommand(this).register(registrar); - new HeadCommand(this).register(registrar); - new ItemCommand(this).register(registrar); - new LoreCommand(this).register(registrar); - new RenameCommand(this).register(registrar); - new RepairCommand(this).register(registrar); - new UnbreakableCommand(this).register(registrar); - new UnenchantCommand(this).register(registrar); + if (commands().enchant().enabled()) new EnchantCommand(this).register(registrar); + if (commands().head().enabled()) new HeadCommand(this).register(registrar); + if (commands().item().enabled()) new ItemCommand(this).register(registrar); + if (commands().lore().enabled()) new LoreCommand(this).register(registrar); + if (commands().rename().enabled()) new RenameCommand(this).register(registrar); + if (commands().repair().enabled()) new RepairCommand(this).register(registrar); + if (commands().unbreakable().enabled()) new UnbreakableCommand(this).register(registrar); + if (commands().unenchant().enabled()) new UnenchantCommand(this).register(registrar); } private void registerPlayerCommands(Commands registrar) { - new BackCommand(this).register(registrar); - new EnderChestCommand(this).register(registrar); - new FeedCommand(this).register(registrar); - new FlyCommand(this).register(registrar); - new GameModeCommand(this).register(registrar); - new GodCommand(this).register(registrar); - new HatCommand(this).register(registrar); - new HealCommand(this).register(registrar); - new InventoryCommand(this).register(registrar); - new OfflineTeleportCommand(this).register(registrar); - new PingCommand(this).register(registrar); - new SeenCommand(this).register(registrar); - new SpeedCommand(this).register(registrar); - new SuicideCommand(this).register(registrar); - new VanishCommand(this).register(registrar); + if (commands().back().enabled()) new BackCommand(this).register(registrar); + if (commands().enderchest().enabled()) new EnderChestCommand(this).register(registrar); + if (commands().feed().enabled()) new FeedCommand(this).register(registrar); + if (commands().fly().enabled()) new FlyCommand(this).register(registrar); + if (commands().gamemode().enabled()) new GameModeCommand(this).register(registrar); + if (commands().god().enabled()) new GodCommand(this).register(registrar); + if (commands().hat().enabled()) new HatCommand(this).register(registrar); + if (commands().heal().enabled()) new HealCommand(this).register(registrar); + if (commands().inventory().enabled()) new InventoryCommand(this).register(registrar); + if (commands().offlineTeleport().enabled()) new OfflineTeleportCommand(this).register(registrar); + if (commands().ping().enabled()) new PingCommand(this).register(registrar); + if (commands().seen().enabled()) new SeenCommand(this).register(registrar); + if (commands().speed().enabled()) new SpeedCommand(this).register(registrar); + if (commands().suicide().enabled()) new SuicideCommand(this).register(registrar); + if (commands().vanish().enabled()) new VanishCommand(this).register(registrar); } private void registerServerCommands(Commands registrar) { - new BroadcastCommand(this).register(registrar); - if (config().features().lobby()) - new LobbyCommand(this).register(registrar); - new MotdCommand(this).register(registrar); + if (commands().back().enabled()) new BroadcastCommand(this).register(registrar); + if (commands().lobby().enabled()) new LobbyCommand(this).register(registrar); + if (commands().motd().enabled()) new MotdCommand(this).register(registrar); } private void registerWorkstationCommands(Commands registrar) { - new AnvilCommand(this).register(registrar); - new CartographyTableCommand(this).register(registrar); - new EnchantingTableCommand(this).register(registrar); - new GrindstoneCommand(this).register(registrar); - new LoomCommand(this).register(registrar); - new SmithingTableCommand(this).register(registrar); - new StonecutterCommand(this).register(registrar); - new WorkbenchCommand(this).register(registrar); + if (commands().anvil().enabled()) new AnvilCommand(this).register(registrar); + if (commands().cartographyTable().enabled()) new CartographyTableCommand(this).register(registrar); + if (commands().enchantingTable().enabled()) new EnchantingTableCommand(this).register(registrar); + if (commands().grindstone().enabled()) new GrindstoneCommand(this).register(registrar); + if (commands().loom().enabled()) new LoomCommand(this).register(registrar); + if (commands().smithingTable().enabled()) new SmithingTableCommand(this).register(registrar); + if (commands().stonecutter().enabled()) new StonecutterCommand(this).register(registrar); + if (commands().workbench().enabled()) new WorkbenchCommand(this).register(registrar); } private void registerHomeCommands(Commands registrar) { - new DeleteHomeCommand(this).register(registrar); - new HomeCommand(this).register(registrar); - new HomesCommand(this).register(registrar); - new SetHomeCommand(this).register(registrar); + if (commands().deleteHome().enabled()) new DeleteHomeCommand(this).register(registrar); + if (commands().home().enabled()) new HomeCommand(this).register(registrar); + if (commands().homes().enabled()) new HomesCommand(this).register(registrar); + if (commands().setHome().enabled()) new SetHomeCommand(this).register(registrar); } private void registerMSGCommands(Commands registrar) { - new MSGCommand(this).register(registrar); - new MSGToggleCommand(this).register(registrar); - new ReplyCommand(this).register(registrar); + if (commands().msg().enabled()) new MSGCommand(this).register(registrar); + if (commands().msgToggle().enabled()) new MSGToggleCommand(this).register(registrar); + if (commands().reply().enabled()) new ReplyCommand(this).register(registrar); } private void registerSpawnCommands(Commands registrar) { - new SetSpawnCommand(this).register(registrar); - new SpawnCommand(this).register(registrar); + if (commands().setSpawn().enabled()) new SetSpawnCommand(this).register(registrar); + if (commands().spawn().enabled()) new SpawnCommand(this).register(registrar); } private void registerTpaCommands(Commands registrar) { - new TPADenyCommand(this).register(registrar); - new TPAHereCommand(this).register(registrar); - new TPAcceptCommand(this).register(registrar); - new TPAskCommand(this).register(registrar); - new TPAToggleCommand(this).register(registrar); + if (commands().teleportAccept().enabled()) new TPAcceptCommand(this).register(registrar); + if (commands().teleportAsk().enabled()) new TPAskCommand(this).register(registrar); + if (commands().teleportDeny().enabled()) new TPADenyCommand(this).register(registrar); + if (commands().teleportHere().enabled()) new TPAHereCommand(this).register(registrar); + if (commands().teleportToggle().enabled()) new TPAToggleCommand(this).register(registrar); } private void registerWarpCommands(Commands registrar) { - new DeleteWarpCommand(this).register(registrar); - new SetWarpCommand(this).register(registrar); - new WarpCommand(this).register(registrar); - new WarpsCommand(this).register(registrar); + if (commands().deleteWarp().enabled()) new DeleteWarpCommand(this).register(registrar); + if (commands().setWarp().enabled()) new SetWarpCommand(this).register(registrar); + if (commands().warp().enabled()) new WarpCommand(this).register(registrar); + if (commands().warps().enabled()) new WarpsCommand(this).register(registrar); } private void registerLinkCommands(Commands registrar) { - var social = config().features().social(); - if (social.discord()) new DiscordCommand(this).register(registrar); - if (social.reddit()) new RedditCommand(this).register(registrar); - if (social.teamspeak()) new TeamSpeakCommand(this).register(registrar); - if (social.twitch()) new TwitchCommand(this).register(registrar); - if (social.website()) new WebsiteCommand(this).register(registrar); - if (social.x()) new XCommand(this).register(registrar); - if (social.youtube()) new YouTubeCommand(this).register(registrar); + if (commands().discord().enabled()) new DiscordCommand(this).register(registrar); + if (commands().reddit().enabled()) new RedditCommand(this).register(registrar); + if (commands().teamspeak().enabled()) new TeamSpeakCommand(this).register(registrar); + if (commands().tiktok().enabled()) new TikTokCommand(this).register(registrar); + if (commands().twitch().enabled()) new TwitchCommand(this).register(registrar); + if (commands().website().enabled()) new WebsiteCommand(this).register(registrar); + if (commands().x().enabled()) new XCommand(this).register(registrar); + if (commands().youtube().enabled()) new YouTubeCommand(this).register(registrar); } private void registerLinks() { @@ -251,6 +250,7 @@ private void registerLinks() { if (social.discord()) registerLink("url.discord", config().links().discord()); if (social.reddit()) registerLink("url.reddit", config().links().reddit()); + if (social.tiktok()) registerLink("url.tiktok", config().links().tiktok()); if (social.twitch()) registerLink("url.twitch", config().links().twitch()); if (social.x()) registerLink("url.x", config().links().x()); if (social.youtube()) registerLink("url.youtube", config().links().youtube()); @@ -313,6 +313,7 @@ private void initTranslations() { Placeholder.parsed("status", config().links().status()), Placeholder.parsed("support", config().links().support()), Placeholder.parsed("teamspeak", config().links().teamspeak()), + Placeholder.parsed("tiktok", config().links().tiktok()), Placeholder.parsed("twitch", config().links().twitch()), Placeholder.parsed("website", config().links().website()), Placeholder.parsed("x", config().links().x()), diff --git a/src/main/java/net/thenextlvl/tweaks/command/social/TikTokCommand.java b/src/main/java/net/thenextlvl/tweaks/command/social/TikTokCommand.java new file mode 100644 index 0000000..26e82b2 --- /dev/null +++ b/src/main/java/net/thenextlvl/tweaks/command/social/TikTokCommand.java @@ -0,0 +1,22 @@ +package net.thenextlvl.tweaks.command.social; + +import com.mojang.brigadier.Command; +import io.papermc.paper.command.brigadier.Commands; +import lombok.RequiredArgsConstructor; +import net.thenextlvl.tweaks.TweaksPlugin; +import org.jspecify.annotations.NullMarked; + +@NullMarked +@RequiredArgsConstructor +@SuppressWarnings("UnstableApiUsage") +public class TikTokCommand { + private final TweaksPlugin plugin; + + public void register(Commands registrar) { + var command = Commands.literal(plugin.commands().tiktok().command()).executes(context -> { + plugin.bundle().sendMessage(context.getSource().getSender(), "social.tiktok"); + return Command.SINGLE_SUCCESS; + }).build(); + registrar.register(command, "Follow us on TikTok", plugin.commands().tiktok().aliases()); + } +} diff --git a/src/main/java/net/thenextlvl/tweaks/command/social/TwitchCommand.java b/src/main/java/net/thenextlvl/tweaks/command/social/TwitchCommand.java index 770cbf7..a4d5454 100644 --- a/src/main/java/net/thenextlvl/tweaks/command/social/TwitchCommand.java +++ b/src/main/java/net/thenextlvl/tweaks/command/social/TwitchCommand.java @@ -17,6 +17,6 @@ public void register(Commands registrar) { plugin.bundle().sendMessage(context.getSource().getSender(), "social.twitch"); return Command.SINGLE_SUCCESS; }).build(); - registrar.register(command, "Watch us on Twitch", plugin.commands().twitch().aliases()); + registrar.register(command, "Follow us on Twitch", plugin.commands().twitch().aliases()); } } diff --git a/src/main/java/net/thenextlvl/tweaks/model/CommandConfig.java b/src/main/java/net/thenextlvl/tweaks/model/CommandConfig.java index 7294acf..51f64ba 100644 --- a/src/main/java/net/thenextlvl/tweaks/model/CommandConfig.java +++ b/src/main/java/net/thenextlvl/tweaks/model/CommandConfig.java @@ -1,9 +1,10 @@ package net.thenextlvl.tweaks.model; import com.google.gson.annotations.SerializedName; -import lombok.AllArgsConstructor; import lombok.Getter; import lombok.experimental.Accessors; +import net.thenextlvl.tweaks.TweaksPlugin; +import org.bukkit.plugin.java.JavaPlugin; import org.jspecify.annotations.NullMarked; import java.util.Set; @@ -12,91 +13,108 @@ @NullMarked @Accessors(fluent = true, chain = false) public class CommandConfig { - private @SerializedName("day") CommandDefinition day = new CommandDefinition("day", Set.of()); - private @SerializedName("midnight") CommandDefinition midnight = new CommandDefinition("midnight", Set.of()); - private @SerializedName("night") CommandDefinition night = new CommandDefinition("night", Set.of()); - private @SerializedName("noon") CommandDefinition noon = new CommandDefinition("noon", Set.of()); - private @SerializedName("time") CommandDefinition time = new CommandDefinition("time", Set.of()); - - private @SerializedName("rain") CommandDefinition rain = new CommandDefinition("rain", Set.of()); - private @SerializedName("sun") CommandDefinition sun = new CommandDefinition("sun", Set.of()); - private @SerializedName("thunder") CommandDefinition thunder = new CommandDefinition("thunder", Set.of()); - private @SerializedName("weather") CommandDefinition weather = new CommandDefinition("weather", Set.of()); - - private @SerializedName("delete-home") CommandDefinition deleteHome = new CommandDefinition("delete-home", Set.of("delhome")); - private @SerializedName("home") CommandDefinition home = new CommandDefinition("home", Set.of()); - private @SerializedName("homes") CommandDefinition homes = new CommandDefinition("homes", Set.of()); - private @SerializedName("set-home") CommandDefinition setHome = new CommandDefinition("set-home", Set.of("sethome")); - - private @SerializedName("enchant") CommandDefinition enchant = new CommandDefinition("enchant", Set.of()); - private @SerializedName("head") CommandDefinition head = new CommandDefinition("head", Set.of("skull")); - private @SerializedName("item") CommandDefinition item = new CommandDefinition("item", Set.of("i")); - private @SerializedName("lore") CommandDefinition lore = new CommandDefinition("lore", Set.of()); - private @SerializedName("rename") CommandDefinition rename = new CommandDefinition("rename", Set.of()); - private @SerializedName("repair") CommandDefinition repair = new CommandDefinition("repair", Set.of()); - private @SerializedName("unbreakable") CommandDefinition unbreakable = new CommandDefinition("unbreakable", Set.of()); - private @SerializedName("unenchant") CommandDefinition unenchant = new CommandDefinition("unenchant", Set.of()); - - private @SerializedName("msg") CommandDefinition msg = new CommandDefinition("msg", Set.of("tell", "write", "t", "w")); - private @SerializedName("msg-toggle") CommandDefinition msgToggle = new CommandDefinition("msgtoggle", Set.of("togglemsg")); - private @SerializedName("reply") CommandDefinition reply = new CommandDefinition("reply", Set.of("r")); - - private @SerializedName("back") CommandDefinition back = new CommandDefinition("back", Set.of()); - private @SerializedName("enderchest") CommandDefinition enderchest = new CommandDefinition("enderchest", Set.of("ec")); - private @SerializedName("feed") CommandDefinition feed = new CommandDefinition("feed", Set.of()); - private @SerializedName("fly") CommandDefinition fly = new CommandDefinition("fly", Set.of("flight")); - private @SerializedName("gamemode") CommandDefinition gamemode = new CommandDefinition("gamemode", Set.of("gm")); - private @SerializedName("god") CommandDefinition god = new CommandDefinition("god", Set.of("invincible")); - private @SerializedName("hat") CommandDefinition hat = new CommandDefinition("hat", Set.of()); - private @SerializedName("heal") CommandDefinition heal = new CommandDefinition("heal", Set.of()); - private @SerializedName("inventory") CommandDefinition inventory = new CommandDefinition("inventory", Set.of("invsee", "inv")); - private @SerializedName("offline-teleport") CommandDefinition offlineTeleport = new CommandDefinition("offline-teleport", Set.of("offline-tp", "tpo")); - private @SerializedName("ping") CommandDefinition ping = new CommandDefinition("ping", Set.of("latency", "ms")); - private @SerializedName("seen") CommandDefinition seen = new CommandDefinition("seen", Set.of("find")); - private @SerializedName("speed") CommandDefinition speed = new CommandDefinition("speed", Set.of()); - private @SerializedName("suicide") CommandDefinition suicide = new CommandDefinition("suicide", Set.of()); - private @SerializedName("vanish") CommandDefinition vanish = new CommandDefinition("vanish", Set.of("v", "invisible")); - - private @SerializedName("broadcast") CommandDefinition broadcast = new CommandDefinition("broadcast", Set.of("bc")); - private @SerializedName("lobby") CommandDefinition lobby = new CommandDefinition("lobby", Set.of("hub", "l")); - private @SerializedName("motd") CommandDefinition motd = new CommandDefinition("motd", Set.of()); - - private @SerializedName("discord") CommandDefinition discord = new CommandDefinition("discord", Set.of("dc")); - private @SerializedName("reddit") CommandDefinition reddit = new CommandDefinition("reddit", Set.of()); - private @SerializedName("teamspeak") CommandDefinition teamspeak = new CommandDefinition("teamspeak", Set.of("teamspeak3", "ts", "ts3")); - private @SerializedName("twitch") CommandDefinition twitch = new CommandDefinition("twitch", Set.of()); - private @SerializedName("website") CommandDefinition website = new CommandDefinition("website", Set.of()); - private @SerializedName("x") CommandDefinition x = new CommandDefinition("x", Set.of("twitter")); - private @SerializedName("youtube") CommandDefinition youtube = new CommandDefinition("youtube", Set.of("yt")); - - private @SerializedName("set-spawn") CommandDefinition setSpawn = new CommandDefinition("set-spawn", Set.of("setspawn")); - private @SerializedName("spawn") CommandDefinition spawn = new CommandDefinition("spawn", Set.of()); - - private @SerializedName("teleport-accept") CommandDefinition teleportAccept = new CommandDefinition("tpaccept", Set.of()); - private @SerializedName("teleport-ask") CommandDefinition teleportAsk = new CommandDefinition("tpa", Set.of("tpask")); - private @SerializedName("teleport-deny") CommandDefinition teleportDeny = new CommandDefinition("tpadeny", Set.of("tpdeny")); - private @SerializedName("teleport-here") CommandDefinition teleportHere = new CommandDefinition("tpahere", Set.of("tphere")); - private @SerializedName("teleport-toggle") CommandDefinition teleportToggle = new CommandDefinition("tpatoggle", Set.of("toggletpa")); - - private @SerializedName("delete-warp") CommandDefinition deleteWarp = new CommandDefinition("delete-warp", Set.of("delwarp")); - private @SerializedName("set-warp") CommandDefinition setWarp = new CommandDefinition("set-warp", Set.of("setwarp")); - private @SerializedName("warp") CommandDefinition warp = new CommandDefinition("warp", Set.of()); - private @SerializedName("warps") CommandDefinition warps = new CommandDefinition("warps", Set.of()); - - private @SerializedName("anvil") CommandDefinition anvil = new CommandDefinition("anvil", Set.of()); - private @SerializedName("cartography-table") CommandDefinition cartographyTable = new CommandDefinition("cartography-table", Set.of("cartography")); - private @SerializedName("enchanting-table") CommandDefinition enchantingTable = new CommandDefinition("enchanting-table", Set.of("enchanting")); - private @SerializedName("grindstone") CommandDefinition grindstone = new CommandDefinition("grindstone", Set.of()); - private @SerializedName("loom") CommandDefinition loom = new CommandDefinition("loom", Set.of()); - private @SerializedName("smithing-table") CommandDefinition smithingTable = new CommandDefinition("smithing-table", Set.of("smithing")); - private @SerializedName("stonecutter") CommandDefinition stonecutter = new CommandDefinition("stonecutter", Set.of()); - private @SerializedName("workbench") CommandDefinition workbench = new CommandDefinition("workbench", Set.of("wb")); + private @SerializedName("day") CommandDefinition day = new CommandDefinition("day"); + private @SerializedName("midnight") CommandDefinition midnight = new CommandDefinition("midnight"); + private @SerializedName("night") CommandDefinition night = new CommandDefinition("night"); + private @SerializedName("noon") CommandDefinition noon = new CommandDefinition("noon"); + private @SerializedName("time") CommandDefinition time = new CommandDefinition("time"); + + private @SerializedName("rain") CommandDefinition rain = new CommandDefinition("rain"); + private @SerializedName("sun") CommandDefinition sun = new CommandDefinition("sun"); + private @SerializedName("thunder") CommandDefinition thunder = new CommandDefinition("thunder"); + private @SerializedName("weather") CommandDefinition weather = new CommandDefinition("weather"); + + private @SerializedName("delete-home") CommandDefinition deleteHome = new CommandDefinition("delete-home", "delhome"); + private @SerializedName("home") CommandDefinition home = new CommandDefinition("home"); + private @SerializedName("homes") CommandDefinition homes = new CommandDefinition("homes"); + private @SerializedName("set-home") CommandDefinition setHome = new CommandDefinition("set-home", "sethome"); + + private @SerializedName("enchant") CommandDefinition enchant = new CommandDefinition("enchant"); + private @SerializedName("head") CommandDefinition head = new CommandDefinition("head", "skull"); + private @SerializedName("item") CommandDefinition item = new CommandDefinition("item", "i"); + private @SerializedName("lore") CommandDefinition lore = new CommandDefinition("lore"); + private @SerializedName("rename") CommandDefinition rename = new CommandDefinition("rename"); + private @SerializedName("repair") CommandDefinition repair = new CommandDefinition("repair"); + private @SerializedName("unbreakable") CommandDefinition unbreakable = new CommandDefinition("unbreakable"); + private @SerializedName("unenchant") CommandDefinition unenchant = new CommandDefinition("unenchant"); + + private @SerializedName("msg") CommandDefinition msg = new CommandDefinition("msg", "tell", "write", "t", "w"); + private @SerializedName("msg-toggle") CommandDefinition msgToggle = new CommandDefinition("msgtoggle", "togglemsg"); + private @SerializedName("reply") CommandDefinition reply = new CommandDefinition("reply", "r"); + + private @SerializedName("back") CommandDefinition back = new CommandDefinition("back"); + private @SerializedName("enderchest") CommandDefinition enderchest = new CommandDefinition("enderchest", "ec"); + private @SerializedName("feed") CommandDefinition feed = new CommandDefinition("feed"); + private @SerializedName("fly") CommandDefinition fly = new CommandDefinition("fly", "flight"); + private @SerializedName("gamemode") CommandDefinition gamemode = new CommandDefinition("gamemode", "gm"); + private @SerializedName("god") CommandDefinition god = new CommandDefinition("god", "invincible"); + private @SerializedName("hat") CommandDefinition hat = new CommandDefinition("hat"); + private @SerializedName("heal") CommandDefinition heal = new CommandDefinition("heal"); + private @SerializedName("inventory") CommandDefinition inventory = new CommandDefinition("inventory", "invsee", "inv"); + private @SerializedName("offline-teleport") CommandDefinition offlineTeleport = new CommandDefinition("offline-teleport", "offline-tp", "tpo"); + private @SerializedName("ping") CommandDefinition ping = new CommandDefinition("ping", "latency", "ms"); + private @SerializedName("seen") CommandDefinition seen = new CommandDefinition("seen", "find"); + private @SerializedName("speed") CommandDefinition speed = new CommandDefinition("speed"); + private @SerializedName("suicide") CommandDefinition suicide = new CommandDefinition("suicide"); + private @SerializedName("vanish") CommandDefinition vanish = new CommandDefinition("vanish", "v", "invisible"); + + private @SerializedName("broadcast") CommandDefinition broadcast = new CommandDefinition("broadcast", "bc"); + private @SerializedName("lobby") CommandDefinition lobby = new CommandDefinition("lobby", isProxyEnabled(), "hub", "l"); + private @SerializedName("motd") CommandDefinition motd = new CommandDefinition("motd"); + + private @SerializedName("discord") CommandDefinition discord = new CommandDefinition("discord", "dc"); + private @SerializedName("reddit") CommandDefinition reddit = new CommandDefinition("reddit"); + private @SerializedName("teamspeak") CommandDefinition teamspeak = new CommandDefinition("teamspeak", "teamspeak3", "ts", "ts3"); + private @SerializedName("tiktok") CommandDefinition tiktok = new CommandDefinition("tiktok"); + private @SerializedName("twitch") CommandDefinition twitch = new CommandDefinition("twitch"); + private @SerializedName("website") CommandDefinition website = new CommandDefinition("website"); + private @SerializedName("x") CommandDefinition x = new CommandDefinition("x", "twitter"); + private @SerializedName("youtube") CommandDefinition youtube = new CommandDefinition("youtube", "yt"); + + private @SerializedName("set-spawn") CommandDefinition setSpawn = new CommandDefinition("set-spawn", "setspawn"); + private @SerializedName("spawn") CommandDefinition spawn = new CommandDefinition("spawn"); + + private @SerializedName("teleport-accept") CommandDefinition teleportAccept = new CommandDefinition("tpaccept"); + private @SerializedName("teleport-ask") CommandDefinition teleportAsk = new CommandDefinition("tpa", "tpask"); + private @SerializedName("teleport-deny") CommandDefinition teleportDeny = new CommandDefinition("tpadeny", "tpdeny"); + private @SerializedName("teleport-here") CommandDefinition teleportHere = new CommandDefinition("tpahere", "tphere"); + private @SerializedName("teleport-toggle") CommandDefinition teleportToggle = new CommandDefinition("tpatoggle", "toggletpa"); + + private @SerializedName("delete-warp") CommandDefinition deleteWarp = new CommandDefinition("delete-warp", "delwarp"); + private @SerializedName("set-warp") CommandDefinition setWarp = new CommandDefinition("set-warp", "setwarp"); + private @SerializedName("warp") CommandDefinition warp = new CommandDefinition("warp"); + private @SerializedName("warps") CommandDefinition warps = new CommandDefinition("warps"); + + private @SerializedName("anvil") CommandDefinition anvil = new CommandDefinition("anvil"); + private @SerializedName("cartography-table") CommandDefinition cartographyTable = new CommandDefinition("cartography-table", "cartography"); + private @SerializedName("enchanting-table") CommandDefinition enchantingTable = new CommandDefinition("enchanting-table", "enchanting"); + private @SerializedName("grindstone") CommandDefinition grindstone = new CommandDefinition("grindstone"); + private @SerializedName("loom") CommandDefinition loom = new CommandDefinition("loom"); + private @SerializedName("smithing-table") CommandDefinition smithingTable = new CommandDefinition("smithing-table", "smithing"); + private @SerializedName("stonecutter") CommandDefinition stonecutter = new CommandDefinition("stonecutter"); + private @SerializedName("workbench") CommandDefinition workbench = new CommandDefinition("workbench", "wb"); + + private boolean isProxyEnabled() { + var plugin = JavaPlugin.getPlugin(TweaksPlugin.class); + return plugin.getServer().spigot().getPaperConfig().getBoolean("proxies.velocity.enabled") + || plugin.getServer().spigot().getSpigotConfig().getBoolean("settings.bungeecord"); + } @Getter - @AllArgsConstructor @Accessors(fluent = true, chain = false) public static class CommandDefinition { private @SerializedName("command") String command; private @SerializedName("aliases") Set aliases; + private @SerializedName("enabled") boolean enabled; + + public CommandDefinition(String command, boolean enabled, String... aliases) { + this.aliases = Set.of(aliases); + this.command = command; + this.enabled = enabled; + } + + public CommandDefinition(String command, String... aliases) { + this(command, true, aliases); + } } } diff --git a/src/main/java/net/thenextlvl/tweaks/model/PluginConfig.java b/src/main/java/net/thenextlvl/tweaks/model/PluginConfig.java index c38c398..05a0f51 100644 --- a/src/main/java/net/thenextlvl/tweaks/model/PluginConfig.java +++ b/src/main/java/net/thenextlvl/tweaks/model/PluginConfig.java @@ -4,10 +4,8 @@ import lombok.Getter; import lombok.Setter; import lombok.experimental.Accessors; -import net.thenextlvl.tweaks.TweaksPlugin; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.plugin.java.JavaPlugin; import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.Nullable; @@ -139,7 +137,9 @@ public static class FeatureConfig { private @SerializedName("spawn") boolean spawn = true; private @SerializedName("tpa") boolean tpa = true; private @SerializedName("warps") boolean warps = true; - private @SerializedName("lobby") boolean lobby = isProxyEnabled(); + private @SerializedName("workstation") boolean workstation = true; + private @SerializedName("weather") boolean weather = true; + private @SerializedName("time") boolean time = true; private @SerializedName("social") SocialConfig social = new SocialConfig(); @@ -163,16 +163,11 @@ public static class SocialConfig { private @SerializedName("discord") boolean discord = true; private @SerializedName("reddit") boolean reddit = true; private @SerializedName("teamspeak") boolean teamspeak = true; + private @SerializedName("tiktok") boolean tiktok = true; private @SerializedName("twitch") boolean twitch = true; private @SerializedName("x") boolean x = true; private @SerializedName("youtube") boolean youtube = true; } - - private boolean isProxyEnabled() { - var plugin = JavaPlugin.getPlugin(TweaksPlugin.class); - return plugin.getServer().spigot().getPaperConfig().getBoolean("proxies.velocity.enabled") - || plugin.getServer().spigot().getSpigotConfig().getBoolean("settings.bungeecord"); - } } @Getter @@ -192,6 +187,7 @@ public static class LinkConfig { private @SerializedName("discord") String discord = "https://discord.gg/invite/example"; private @SerializedName("reddit") String reddit = "https://www.reddit.com/r/example"; private @SerializedName("teamspeak") String teamspeak = "teamspeak.example.com"; + private @SerializedName("tiktok") String tiktok = "https://www.tiktok.com/@example"; private @SerializedName("twitch") String twitch = "https://www.twitch.tv/example"; private @SerializedName("x") String x = "https://x.com/example"; private @SerializedName("youtube") String youtube = "https://www.youtube.com/example"; diff --git a/src/main/resources/tweaks.properties b/src/main/resources/tweaks.properties index 3cd050e..6cae0ee 100644 --- a/src/main/resources/tweaks.properties +++ b/src/main/resources/tweaks.properties @@ -143,15 +143,17 @@ player.connected= '> player.disconnected= '> left the game player.not.found= The player has never played before prefix=Tweaks » -social.discord= Chat with us on '><#535fee>Discord -social.reddit= Check out our '><#ff4500>Subreddit> +social.discord= Chat with us on '><#535fee>Discord +social.reddit= Check out our '><#ff4500>Subreddit> social.teamspeak= Talk with us on '>'><#1c2837>TeamSpeak -social.twitch= Follow us on '><#8b44f7>Twitch -social.website= Visit our '>Website -social.x= Follow us on '>X -social.youtube= Subscribe to us on '><#ff0808>YouTube +social.tiktok= Follow us on '><#00f7ee>TikTok +social.twitch= Follow us on '><#8b44f7>Twitch +social.website= Visit our '>Website +social.x= Follow us on '>X +social.youtube= Subscribe to us on '><#ff0808>YouTube url.discord=Discord url.reddit=Reddit +url.tiktok=TikTok url.twitch=Twitch url.x=X url.youtube=YouTube \ No newline at end of file diff --git a/src/main/resources/tweaks_german.properties b/src/main/resources/tweaks_german.properties index c977e7f..3d46e66 100644 --- a/src/main/resources/tweaks_german.properties +++ b/src/main/resources/tweaks_german.properties @@ -137,10 +137,11 @@ gui.title.warps=Schnellreisepunkte player.connected= '> ist dem Spiel beigetreten player.disconnected= '> hat das Spiel verlassen player.not.found= Der Spieler war noch nie online -social.discord= Schreibe mit uns auf '><#535fee>Discord -social.reddit= Besuche unseren '><#ff4500>Subreddit +social.discord= Schreibe mit uns auf '><#535fee>Discord +social.reddit= Besuche unseren '><#ff4500>Subreddit social.teamspeak= Rede mit uns auf '>'><#1c2837>TeamSpeak -social.twitch= Folge uns auf '><#8b44f7>Twitch -social.website= Besuche unsere '>Website -social.x= Besuche unsere '>X -social.youtube= Abonniere uns auf '><#ff0808>YouTube \ No newline at end of file +social.tiktok= Folge uns auf '><#00f7ee>TikTok +social.twitch= Folge uns auf '><#8b44f7>Twitch +social.website= Besuche unsere '>Website +social.x= Besuche unsere '>X +social.youtube= Abonniere uns auf '><#ff0808>YouTube \ No newline at end of file