diff --git a/eternalcore-core/src/main/java/com/eternalcode/core/feature/warp/config/WarpConfigItem.java b/eternalcore-core/src/main/java/com/eternalcode/core/configuration/contextual/ConfigItem.java similarity index 52% rename from eternalcore-core/src/main/java/com/eternalcode/core/feature/warp/config/WarpConfigItem.java rename to eternalcore-core/src/main/java/com/eternalcode/core/configuration/contextual/ConfigItem.java index 8db9f2f8c..a07c8a411 100644 --- a/eternalcore-core/src/main/java/com/eternalcode/core/feature/warp/config/WarpConfigItem.java +++ b/eternalcore-core/src/main/java/com/eternalcode/core/configuration/contextual/ConfigItem.java @@ -1,33 +1,36 @@ -package com.eternalcode.core.feature.warp.config; +package com.eternalcode.core.configuration.contextual; import net.dzikoysk.cdn.entity.Contextual; +import net.dzikoysk.cdn.entity.Description; import org.bukkit.Material; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @Contextual -public class WarpConfigItem { - - public String name = "&6Warp"; - public List lore = Collections.singletonList("&7Click to teleport to warp"); +public class ConfigItem { + public String name = "&6Item"; + public List lore = Collections.singletonList("&7Default lore"); public Material material = Material.PLAYER_HEAD; public String texture = "none"; - public boolean glow = true; - - public int slot = 10; + public boolean glow = false; + public int slot = 0; + @Description("What command should be executed when the item is clicked? If it is not to be performed, leave it blank") + public List commands = new ArrayList<>(); - public WarpConfigItem(String name, List lore, Material material, String texture, boolean glow, int slot) { + public ConfigItem(String name, List lore, Material material, String texture, boolean glow, int slot, List commands) { this.name = name; this.lore = lore; this.material = material; this.texture = texture; this.glow = glow; this.slot = slot; + this.commands = commands; } - public WarpConfigItem() { + public ConfigItem() { } @@ -55,52 +58,61 @@ public int slot() { return this.slot; } + public List commands() { + return this.commands; + } + public static Builder builder() { return new Builder(); } public static class Builder { - - private final WarpConfigItem warpConfigItem = new WarpConfigItem(); + private final ConfigItem configItem = new ConfigItem(); public Builder withName(String name) { - this.warpConfigItem.name = name; + this.configItem.name = name; return this; } public Builder withLore(List lore) { - this.warpConfigItem.lore = lore; + this.configItem.lore = lore; return this; } public Builder withMaterial(Material material) { - this.warpConfigItem.material = material; + this.configItem.material = material; return this; } public Builder withTexture(String texture) { - this.warpConfigItem.texture = texture; + this.configItem.texture = texture; return this; } public Builder withGlow(boolean glow) { - this.warpConfigItem.glow = glow; + this.configItem.glow = glow; return this; } public Builder withSlot(int slot) { - this.warpConfigItem.slot = slot; + this.configItem.slot = slot; + + return this; + } + + public Builder withCommands(List commands) { + this.configItem.commands = commands; return this; } - public WarpConfigItem build() { - return this.warpConfigItem; + public ConfigItem build() { + return this.configItem; } } } diff --git a/eternalcore-core/src/main/java/com/eternalcode/core/configuration/implementation/PluginConfiguration.java b/eternalcore-core/src/main/java/com/eternalcode/core/configuration/implementation/PluginConfiguration.java index 27066d831..2c5e6ea16 100644 --- a/eternalcore-core/src/main/java/com/eternalcode/core/configuration/implementation/PluginConfiguration.java +++ b/eternalcore-core/src/main/java/com/eternalcode/core/configuration/implementation/PluginConfiguration.java @@ -1,5 +1,6 @@ package com.eternalcode.core.configuration.implementation; +import com.eternalcode.core.adventure.legacy.LegacyColorProcessor; import com.eternalcode.core.configuration.ReloadableConfig; import com.eternalcode.core.database.DatabaseType; import com.eternalcode.core.feature.afk.AfkSettings; @@ -15,6 +16,7 @@ import net.dzikoysk.cdn.entity.Exclude; import net.dzikoysk.cdn.source.Resource; import net.dzikoysk.cdn.source.Source; +import net.kyori.adventure.text.minimessage.MiniMessage; import org.bukkit.Sound; import java.io.File; @@ -311,7 +313,6 @@ public static class Butcher { @Contextual public static class AutoMessage implements AutoMessageSettings { - @Description("# AutoMessage should be enabled?") public boolean enabled = true; diff --git a/eternalcore-core/src/main/java/com/eternalcode/core/feature/language/LanguageCommand.java b/eternalcore-core/src/main/java/com/eternalcode/core/feature/language/LanguageCommand.java index ad884c5d8..ab6a91626 100644 --- a/eternalcore-core/src/main/java/com/eternalcode/core/feature/language/LanguageCommand.java +++ b/eternalcore-core/src/main/java/com/eternalcode/core/feature/language/LanguageCommand.java @@ -2,6 +2,7 @@ import com.eternalcode.annotations.scan.command.DescriptionDocs; import com.eternalcode.core.injector.annotations.Inject; +import com.eternalcode.core.user.User; import dev.rollczi.litecommands.command.execute.Execute; import dev.rollczi.litecommands.command.permission.Permission; import dev.rollczi.litecommands.command.route.Route; @@ -20,8 +21,8 @@ class LanguageCommand { @Execute @DescriptionDocs(description = "Open language inventory") - void execute(Player player) { - this.languageInventory.open(player); + void execute(Player player, User user) { + this.languageInventory.open(player, user.getLanguage()); } } diff --git a/eternalcore-core/src/main/java/com/eternalcode/core/feature/language/LanguageInventory.java b/eternalcore-core/src/main/java/com/eternalcode/core/feature/language/LanguageInventory.java index f45349947..af95816a4 100644 --- a/eternalcore-core/src/main/java/com/eternalcode/core/feature/language/LanguageInventory.java +++ b/eternalcore-core/src/main/java/com/eternalcode/core/feature/language/LanguageInventory.java @@ -1,22 +1,26 @@ package com.eternalcode.core.feature.language; import com.eternalcode.annotations.scan.feature.FeatureDocs; +import com.eternalcode.core.configuration.contextual.ConfigItem; import com.eternalcode.core.feature.language.config.LanguageConfiguration; import com.eternalcode.core.injector.annotations.Inject; import com.eternalcode.core.injector.annotations.component.Service; import com.eternalcode.core.feature.language.config.LanguageConfigItem; import com.eternalcode.core.notice.NoticeService; +import com.eternalcode.core.translation.Translation; +import com.eternalcode.core.translation.TranslationManager; import com.eternalcode.core.user.User; import com.eternalcode.core.user.UserManager; import com.eternalcode.core.util.AdventureUtil; +import dev.triumphteam.gui.builder.item.BaseItemBuilder; import dev.triumphteam.gui.builder.item.ItemBuilder; import dev.triumphteam.gui.guis.Gui; import dev.triumphteam.gui.guis.GuiItem; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.minimessage.MiniMessage; import org.bukkit.Material; +import org.bukkit.Server; import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; import java.util.List; import java.util.Optional; @@ -30,20 +34,26 @@ class LanguageInventory { private final LanguageConfiguration languageConfiguration; + private final TranslationManager translationManager; private final NoticeService noticeService; private final UserManager userManager; + private final Server server; private final MiniMessage miniMessage; @Inject - LanguageInventory(LanguageConfiguration languageConfiguration, NoticeService noticeService, UserManager userManager, MiniMessage miniMessage) { + LanguageInventory(LanguageConfiguration languageConfiguration, TranslationManager translationManager, NoticeService noticeService, UserManager userManager, Server server, MiniMessage miniMessage) { this.languageConfiguration = languageConfiguration; + this.translationManager = translationManager; this.noticeService = noticeService; this.userManager = userManager; + this.server = server; this.miniMessage = miniMessage; } - void open(Player player) { + void open(Player player, Language language) { LanguageConfiguration.LanguageSelector languageSelector = this.languageConfiguration.languageSelector; + Translation translation = this.translationManager.getMessages(language); + Translation.LanguageSection languageSection = translation.language(); Gui gui = Gui.gui() .title(this.miniMessage.deserialize(languageSelector.title)) @@ -84,30 +94,8 @@ void open(Player player) { } for (LanguageConfigItem languageConfigItem : languageSelector.languageConfigItemMap) { - Component name = AdventureUtil.RESET_ITEM.append(this.miniMessage.deserialize(languageConfigItem.name)); - - List lore = languageConfigItem.lore - .stream() - .map(entry -> AdventureUtil.RESET_ITEM.append(this.miniMessage.deserialize(entry))) - .collect(Collectors.toList()); - - ItemStack item; - - if (languageConfigItem.material == Material.PLAYER_HEAD) { - item = ItemBuilder.skull() - .name(name) - .lore(lore) - .texture(languageConfigItem.texture) - .build(); - } - else { - item = ItemBuilder.from(languageConfigItem.material) - .name(name) - .lore(lore) - .build(); - } - - GuiItem guiItem = new GuiItem(item); + BaseItemBuilder baseItemBuilder = this.createItem(languageConfigItem); + GuiItem guiItem = baseItemBuilder.asGuiItem(); guiItem.setAction(event -> { user.getSettings().setLanguage(languageConfigItem.language); @@ -116,13 +104,53 @@ void open(Player player) { this.noticeService.create() .player(player.getUniqueId()) - .notice(translation -> translation.language().languageChanged()) + .notice(translations -> translations.language().languageChanged()) .send(); }); gui.setItem(languageConfigItem.slot, guiItem); } + for (ConfigItem item : languageSection.decorationItems()) { + BaseItemBuilder baseItemBuilder = this.createItem(item); + GuiItem guiItem = baseItemBuilder.asGuiItem(); + + guiItem.setAction(event -> { + if (item.commands.isEmpty()) { + return; + } + + for (String command : item.commands) { + this.server.dispatchCommand(player, command); + } + + player.closeInventory(); + }); + + gui.setItem(item.slot(), guiItem); + } + gui.open(player); } + + private BaseItemBuilder createItem(ConfigItem item) { + Component name = AdventureUtil.RESET_ITEM.append(this.miniMessage.deserialize(item.name())); + List lore = item.lore() + .stream() + .map(entry -> AdventureUtil.RESET_ITEM.append(this.miniMessage.deserialize(entry))) + .toList(); + + if (item.material() == Material.PLAYER_HEAD && !item.texture().isEmpty()) { + return ItemBuilder.skull() + .name(name) + .lore(lore) + .texture(item.texture()) + .glow(item.glow()); + } + + return ItemBuilder.from(item.material()) + .name(name) + .lore(lore) + .glow(item.glow()); + } } diff --git a/eternalcore-core/src/main/java/com/eternalcode/core/feature/language/config/LanguageConfigItem.java b/eternalcore-core/src/main/java/com/eternalcode/core/feature/language/config/LanguageConfigItem.java index 0cece86c9..c85b25de1 100644 --- a/eternalcore-core/src/main/java/com/eternalcode/core/feature/language/config/LanguageConfigItem.java +++ b/eternalcore-core/src/main/java/com/eternalcode/core/feature/language/config/LanguageConfigItem.java @@ -1,5 +1,6 @@ package com.eternalcode.core.feature.language.config; +import com.eternalcode.core.configuration.contextual.ConfigItem; import com.eternalcode.core.feature.language.Language; import net.dzikoysk.cdn.entity.Contextual; import org.bukkit.Material; @@ -8,38 +9,15 @@ import java.util.List; @Contextual -public class LanguageConfigItem { - - public Material material = Material.DIRT; +public class LanguageConfigItem extends ConfigItem { public Language language = Language.EN; - public int slot = 1; - - public String name = "none"; - - public List lore = Collections.singletonList("none"); - - public String texture = "none"; - - public LanguageConfigItem(Material material, Language language, int slot, String name, List lore, String texture) { - this.material = material; + public LanguageConfigItem(String name, List lore, Material material, String texture, boolean glow, int slot, List commands, Language language) { + super(name, lore, material, texture, glow, slot, commands); this.language = language; - this.slot = slot; - this.name = name; - this.lore = lore; - this.texture = texture; - } - - public LanguageConfigItem(Material material, Language language, int slot, String name, List lore) { - this.material = material; - this.language = language; - this.slot = slot; - this.name = name; - this.lore = lore; } public LanguageConfigItem() { - } } diff --git a/eternalcore-core/src/main/java/com/eternalcode/core/feature/language/config/LanguageConfiguration.java b/eternalcore-core/src/main/java/com/eternalcode/core/feature/language/config/LanguageConfiguration.java index ca79ca04d..4bbbbbbb2 100644 --- a/eternalcore-core/src/main/java/com/eternalcode/core/feature/language/config/LanguageConfiguration.java +++ b/eternalcore-core/src/main/java/com/eternalcode/core/feature/language/config/LanguageConfiguration.java @@ -60,29 +60,34 @@ public enum FillType { @Description({ " ", "# List of languages" }) public List languageConfigItemMap = new ImmutableList.Builder() .add(new LanguageConfigItem( - Material.PLAYER_HEAD, - Language.EN, - 20, "&c&lEnglish", Collections.singletonList("&7▪ Click to change language!"), - "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvODc5ZDk5ZDljNDY0NzRlMjcxM2E3ZTg0YTk1ZTRjZTdlOGZmOGVhNGQxNjQ0MTNhNTkyZTQ0MzVkMmM2ZjlkYyJ9fX0") + Material.PLAYER_HEAD, + "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvODc5ZDk5ZDljNDY0NzRlMjcxM2E3ZTg0YTk1ZTRjZTdlOGZmOGVhNGQxNjQ0MTNhNTkyZTQ0MzVkMmM2ZjlkYyJ9fX0", + false, + 20, + Collections.emptyList(), + Language.EN) ) - .add(new LanguageConfigItem( + "&c&lAuto", + Collections.singletonList("&7▪ Kliknij, aby pobierać język z ustawień klienta!"), Material.REPEATER, - Language.DEFAULT, + "none", + false, 22, - "&c&lAuto", - Collections.singletonList("&7▪ Kliknij, aby pobierać język z ustawień klienta!")) + Collections.emptyList(), + Language.DEFAULT) ) - .add(new LanguageConfigItem( - Material.PLAYER_HEAD, - Language.PL, - 24, "&c&lPolish", Collections.singletonList("&7▪ Kliknij aby zmienić język!"), - "ewogICJ0aW1lc3RhbXAiIDogMTYyNzMxOTA4NjYyOCwKICAicHJvZmlsZUlkIiA6ICJiNTM5NTkyMjMwY2I0MmE0OWY5YTRlYmYxNmRlOTYwYiIsCiAgInByb2ZpbGVOYW1lIiA6ICJtYXJpYW5hZmFnIiwKICAic2lnbmF0dXJlUmVxdWlyZWQiIDogdHJ1ZSwKICAidGV4dHVyZXMiIDogewogICAgIlNLSU4iIDogewogICAgICAidXJsIiA6ICJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2IxZDFlZmVkNjIyZTEzMTJlOTg0NGU4OTgzNjQzMzM5MGEyMTFjN2E1NTVhMzQzMWI0OTk2NWMzZTNiMzhiYjYiCiAgICB9CiAgfQp9") + Material.PLAYER_HEAD, + "ewogICJ0aW1lc3RhbXAiIDogMTYyNzMxOTA4NjYyOCwKICAicHJvZmlsZUlkIiA6ICJiNTM5NTkyMjMwY2I0MmE0OWY5YTRlYmYxNmRlOTYwYiIsCiAgInByb2ZpbGVOYW1lIiA6ICJtYXJpYW5hZmFnIiwKICAic2lnbmF0dXJlUmVxdWlyZWQiIDogdHJ1ZSwKICAidGV4dHVyZXMiIDogewogICAgIlNLSU4iIDogewogICAgICAidXJsIiA6ICJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2IxZDFlZmVkNjIyZTEzMTJlOTg0NGU4OTgzNjQzMzM5MGEyMTFjN2E1NTVhMzQzMWI0OTk2NWMzZTNiMzhiYjYiCiAgICB9CiAgfQp9", + false, + 24, + Collections.emptyList(), + Language.PL) ) .build(); } diff --git a/eternalcore-core/src/main/java/com/eternalcode/core/feature/warp/WarpInventory.java b/eternalcore-core/src/main/java/com/eternalcode/core/feature/warp/WarpInventory.java index a6057a1c6..d1d5f7380 100644 --- a/eternalcore-core/src/main/java/com/eternalcode/core/feature/warp/WarpInventory.java +++ b/eternalcore-core/src/main/java/com/eternalcode/core/feature/warp/WarpInventory.java @@ -1,6 +1,6 @@ package com.eternalcode.core.feature.warp; -import com.eternalcode.core.feature.warp.config.WarpConfigItem; +import com.eternalcode.core.configuration.contextual.ConfigItem; import com.eternalcode.core.injector.annotations.Inject; import com.eternalcode.core.injector.annotations.component.Service; import com.eternalcode.core.feature.language.Language; @@ -16,6 +16,7 @@ import net.kyori.adventure.text.Component; import net.kyori.adventure.text.minimessage.MiniMessage; import org.bukkit.Material; +import org.bukkit.Server; import org.bukkit.entity.Player; import panda.std.Option; @@ -29,13 +30,15 @@ class WarpInventory { private final TeleportTaskService teleportTaskService; private final TranslationManager translationManager; private final WarpManager warpManager; + private final Server server; private final MiniMessage miniMessage; @Inject - WarpInventory(TeleportTaskService teleportTaskService, TranslationManager translationManager, WarpManager warpManager, MiniMessage miniMessage) { + WarpInventory(TeleportTaskService teleportTaskService, TranslationManager translationManager, WarpManager warpManager, Server server, MiniMessage miniMessage) { this.teleportTaskService = teleportTaskService; this.translationManager = translationManager; this.warpManager = warpManager; + this.server = server; this.miniMessage = miniMessage; } @@ -57,7 +60,7 @@ private Gui createInventory(Language language) { } Warp warp = warpOption.get(); - WarpConfigItem warpItem = item.warpItem(); + ConfigItem warpItem = item.warpItem(); BaseItemBuilder baseItemBuilder = this.createItem(warpItem); GuiItem guiItem = baseItemBuilder.asGuiItem(); @@ -105,28 +108,49 @@ private Gui createInventory(Language language) { } } + for (ConfigItem item : warpSection.decorationItems().items()) { + BaseItemBuilder baseItemBuilder = this.createItem(item); + GuiItem guiItem = baseItemBuilder.asGuiItem(); + + guiItem.setAction(event -> { + Player player = (Player) event.getWhoClicked(); + + if (item.commands.isEmpty()) { + return; + } + + for (String command : item.commands) { + this.server.dispatchCommand(player, command); + } + + player.closeInventory(); + }); + + gui.setItem(item.slot(), guiItem); + } + return gui; } - private BaseItemBuilder createItem(WarpConfigItem warpItem) { - Component name = AdventureUtil.RESET_ITEM.append(this.miniMessage.deserialize(warpItem.name())); - List lore = warpItem.lore() + private BaseItemBuilder createItem(ConfigItem item) { + Component name = AdventureUtil.RESET_ITEM.append(this.miniMessage.deserialize(item.name())); + List lore = item.lore() .stream() .map(entry -> AdventureUtil.RESET_ITEM.append(this.miniMessage.deserialize(entry))) .toList(); - if (warpItem.material() == Material.PLAYER_HEAD && !warpItem.texture().isEmpty()) { + if (item.material() == Material.PLAYER_HEAD && !item.texture().isEmpty()) { return ItemBuilder.skull() .name(name) .lore(lore) - .texture(warpItem.texture()) - .glow(warpItem.glow()); + .texture(item.texture()) + .glow(item.glow()); } - return ItemBuilder.from(warpItem.material()) - .name(name) - .lore(lore) - .glow(warpItem.glow()); + return ItemBuilder.from(item.material()) + .name(name) + .lore(lore) + .glow(item.glow()); } public void openInventory(Player player, Language language) { diff --git a/eternalcore-core/src/main/java/com/eternalcode/core/feature/warp/config/WarpInventoryItem.java b/eternalcore-core/src/main/java/com/eternalcode/core/feature/warp/config/WarpInventoryItem.java index 66050dc60..12d56d39c 100644 --- a/eternalcore-core/src/main/java/com/eternalcode/core/feature/warp/config/WarpInventoryItem.java +++ b/eternalcore-core/src/main/java/com/eternalcode/core/feature/warp/config/WarpInventoryItem.java @@ -1,5 +1,6 @@ package com.eternalcode.core.feature.warp.config; +import com.eternalcode.core.configuration.contextual.ConfigItem; import net.dzikoysk.cdn.entity.Contextual; import org.bukkit.Material; @@ -10,7 +11,7 @@ public class WarpInventoryItem { public String warpName = "default"; - public WarpConfigItem warpItem = WarpConfigItem.builder() + public ConfigItem warpItem = ConfigItem.builder() .withName("&6Warp: &fdefault") .withLore(Collections.singletonList("&7Click to teleport to warp")) .withMaterial(Material.PLAYER_HEAD) @@ -19,7 +20,7 @@ public class WarpInventoryItem { .withGlow(true) .build(); - public WarpInventoryItem(String warpName, WarpConfigItem warpItem) { + public WarpInventoryItem(String warpName, ConfigItem warpItem) { this.warpName = warpName; this.warpItem = warpItem; } @@ -32,7 +33,7 @@ public String warpName() { return this.warpName; } - public WarpConfigItem warpItem() { + public ConfigItem warpItem() { return this.warpItem; } @@ -43,7 +44,7 @@ public static Builder builder() { public static class Builder { private String warpName; - private WarpConfigItem warpItem; + private ConfigItem warpItem; public Builder withWarpName(String warpName) { this.warpName = warpName; @@ -51,7 +52,7 @@ public Builder withWarpName(String warpName) { return this; } - public Builder withWarpItem(WarpConfigItem warpItem) { + public Builder withWarpItem(ConfigItem warpItem) { this.warpItem = warpItem; return this; diff --git a/eternalcore-core/src/main/java/com/eternalcode/core/translation/Translation.java b/eternalcore-core/src/main/java/com/eternalcode/core/translation/Translation.java index 3993fc0f2..d6e1477a3 100644 --- a/eternalcore-core/src/main/java/com/eternalcode/core/translation/Translation.java +++ b/eternalcore-core/src/main/java/com/eternalcode/core/translation/Translation.java @@ -1,11 +1,13 @@ package com.eternalcode.core.translation; +import com.eternalcode.core.configuration.contextual.ConfigItem; import com.eternalcode.core.feature.warp.config.WarpInventoryItem; import com.eternalcode.core.feature.language.Language; import com.eternalcode.core.notice.Notice; import org.bukkit.Material; import org.bukkit.event.entity.EntityDamageEvent; +import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; @@ -133,13 +135,13 @@ interface WarpSection { WarpInventorySection warpInventory(); interface WarpInventorySection { - String title(); int rows(); Map items(); BorderSection border(); + DecorationItemsSection decorationItems(); interface BorderSection { boolean enabled(); @@ -156,6 +158,10 @@ enum FillType { TOP, BOTTOM, BORDER, ALL } } + + interface DecorationItemsSection { + List items(); + } } } @@ -366,6 +372,8 @@ interface TimeAndWeatherSection { interface LanguageSection { Notice languageChanged(); + + List decorationItems(); } // container section diff --git a/eternalcore-core/src/main/java/com/eternalcode/core/translation/implementation/ENTranslation.java b/eternalcore-core/src/main/java/com/eternalcode/core/translation/implementation/ENTranslation.java index d349130b1..fabf674b0 100644 --- a/eternalcore-core/src/main/java/com/eternalcode/core/translation/implementation/ENTranslation.java +++ b/eternalcore-core/src/main/java/com/eternalcode/core/translation/implementation/ENTranslation.java @@ -1,6 +1,6 @@ package com.eternalcode.core.translation.implementation; -import com.eternalcode.core.feature.warp.config.WarpConfigItem; +import com.eternalcode.core.configuration.contextual.ConfigItem; import com.eternalcode.core.feature.warp.config.WarpInventoryItem; import com.eternalcode.core.feature.language.Language; import com.eternalcode.core.notice.Notice; @@ -351,7 +351,7 @@ public static class ENWarpInventory implements WarpInventorySection { public Map items = Map.of("default", WarpInventoryItem.builder() .withWarpName("default") - .withWarpItem(WarpConfigItem.builder() + .withWarpItem(ConfigItem.builder() .withName("&8» &6Warp: &fdefault") .withLore(Collections.singletonList("Click to teleport!")) .withMaterial(Material.ENDER_PEARL) @@ -361,6 +361,7 @@ public static class ENWarpInventory implements WarpInventorySection { .build()); public ENBorderSection border = new ENBorderSection(); + public ENDecorationItemsSection decorationItems = new ENDecorationItemsSection(); @Getter @Contextual @@ -375,6 +376,27 @@ public static class ENBorderSection implements BorderSection { public List lore = Collections.emptyList(); } + + @Getter + @Contextual + public static class ENDecorationItemsSection implements DecorationItemsSection { + public List items = List.of( + ConfigItem.builder() + .withName("&8» &6Example item") + .withLore(Collections.singletonList("Click to set time to day")) + .withMaterial(Material.YELLOW_CARPET) + .withSlot(18) + .withCommands(List.of("day")) + .build(), + ConfigItem.builder() + .withName("&8» &6Example item 2") + .withLore(Collections.singletonList("Click to set time to night")) + .withMaterial(Material.BLUE_CARPET) + .withSlot(19) + .withCommands(List.of("night")) + .build() + ); + } } } @@ -746,6 +768,16 @@ public static class ENContainerSection implements ContainerSection { @Contextual public static class ENLanguageSection implements LanguageSection { public Notice languageChanged = Notice.chat("Language changed to English!"); + + public List decorationItems = List.of( + ConfigItem.builder() + .withMaterial(Material.SUNFLOWER) + .withGlow(true) + .withSlot(40) + .withName("&7Our discord") + .withLore(Collections.singletonList("&8» &6https://discord.gg/TRbDApaJaJ")) + .build() + ); } @Description({ " ", "# Auto message" }) diff --git a/eternalcore-core/src/main/java/com/eternalcode/core/translation/implementation/PLTranslation.java b/eternalcore-core/src/main/java/com/eternalcode/core/translation/implementation/PLTranslation.java index 74a533d22..7de60c4ab 100644 --- a/eternalcore-core/src/main/java/com/eternalcode/core/translation/implementation/PLTranslation.java +++ b/eternalcore-core/src/main/java/com/eternalcode/core/translation/implementation/PLTranslation.java @@ -1,6 +1,6 @@ package com.eternalcode.core.translation.implementation; -import com.eternalcode.core.feature.warp.config.WarpConfigItem; +import com.eternalcode.core.configuration.contextual.ConfigItem; import com.eternalcode.core.feature.warp.config.WarpInventoryItem; import com.eternalcode.core.feature.language.Language; import com.eternalcode.core.notice.Notice; @@ -231,7 +231,7 @@ public static class PLRandomTeleportSection implements RandomTeleportSection { public Notice teleportedToRandomLocation = Notice.chat("Zostałeś przeteleportowany na losową lokalizację!"); - @Description({"# {PLAYER} - Gracz który został teleportowany, {WORLD} - Świat, {X} - Koordynat X, {Y} - Koordynat Y, {Z} - Koordynat Z" }) + @Description({ "# {PLAYER} - Gracz który został teleportowany, {WORLD} - Świat, {X} - Koordynat X, {Y} - Koordynat Y, {Z} - Koordynat Z" }) public Notice teleportedSpecifiedPlayerToRandomLocation = Notice.chat("Przeteleportowałeś gracza {PLAYER} na losową lokalizację! Jego aktualna lokalizacja to: świat: {WORLD} x: {X}, y: {Y}, z: {Z}."); } @@ -269,7 +269,7 @@ public static class PLChatSection implements ChatSection { @Description(" ") public Notice commandNotFound = Notice.chat("Komenda {COMMAND} nie istnieje!"); - @Description({" ", "# {PLAYER} - Gracz, który otrzymał wiadomość", "# {MESSAGE} - wiadomość", "# {TYPE} - typ wiadomości"}) + @Description({ " ", "# {PLAYER} - Gracz, który otrzymał wiadomość", "# {MESSAGE} - wiadomość", "# {TYPE} - typ wiadomości" }) public Notice tellrawInfo = Notice.chat("Wysłano wiadomość typu {TYPE} do {PLAYER} o treści: {MESSAGE}"); public Notice tellrawAllInfo = Notice.chat("Wysłano wiadomość typu {TYPE} do wszystkich o treści: {MESSAGE}"); } @@ -355,7 +355,7 @@ public static class PLWarpInventory implements WarpInventorySection { public Map items = Map.of("default", WarpInventoryItem.builder() .withWarpName("default") - .withWarpItem(WarpConfigItem.builder() + .withWarpItem(ConfigItem.builder() .withName("&8» &6Warp: &fdomyślny") .withLore(Collections.singletonList("Kliknij aby się teleportować!")) .withMaterial(Material.PLAYER_HEAD) @@ -365,6 +365,7 @@ public static class PLWarpInventory implements WarpInventorySection { .build()); public PLBorderSection border = new PLBorderSection(); + public PLDecorationItemsSection decorationItems = new PLDecorationItemsSection(); @Getter @Contextual @@ -379,6 +380,27 @@ public static class PLBorderSection implements BorderSection { public List lore = Collections.emptyList(); } + + @Getter + @Contextual + public static class PLDecorationItemsSection implements DecorationItemsSection { + public List items = List.of( + ConfigItem.builder() + .withMaterial(Material.YELLOW_CARPET) + .withName("&8» &6Przykładowy przedmiot") + .withLore(Collections.singletonList("Kliknij aby ustawić dzień!")) + .withSlot(18) + .withCommands(List.of("day")) + .build(), + ConfigItem.builder() + .withMaterial(Material.BLUE_CARPET) + .withName("&8» &6Przykładowy przedmiot 2") + .withLore(Collections.singletonList("Kliknij aby ustawić noc!")) + .withSlot(19) + .withCommands((List.of("night"))) + .build() + ); + } } } @@ -764,6 +786,16 @@ public static class PLContainerSection implements ContainerSection { @Contextual public static class PLLanguageSection implements LanguageSection { public Notice languageChanged = Notice.chat("Zmieniono język na Polski!"); + + public List decorationItems = List.of( + ConfigItem.builder() + .withMaterial(Material.SUNFLOWER) + .withGlow(true) + .withSlot(40) + .withName("&7Nasz discord") + .withLore(Collections.singletonList("&8» &6https://discord.gg/TRbDApaJaJ")) + .build() + ); } @Description({ " ", "# Automatyczne wiadomości " }) @@ -772,7 +804,6 @@ public static class PLLanguageSection implements LanguageSection { @Getter @Contextual public static class PLAutoMessageSection implements AutoMessageSection { - @Description({ "", "# Jeżeli chcesz użyć placeholder'a %server_online% musisz zainstalować plugin", diff --git a/eternalcore-plugin/build.gradle.kts b/eternalcore-plugin/build.gradle.kts index 58cbc6fe0..a92f20f5d 100644 --- a/eternalcore-plugin/build.gradle.kts +++ b/eternalcore-plugin/build.gradle.kts @@ -34,6 +34,6 @@ eternalShadowCompiler { tasks { runServer { - minecraftVersion("1.20.1") + minecraftVersion("1.19.4") } }