Skip to content
Merged
23 changes: 15 additions & 8 deletions src/main/java/fr/openmc/api/menulib/template/ItemMenuTemplate.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,18 @@
public class ItemMenuTemplate {
public static final Function<Menu, ItemMenuBuilder> BTN_PREVIOUS_PAGE_WHITE = (menu) ->
new ItemMenuBuilder(menu, OMCRegistry.CUSTOM_ITEMS.MAILBOX_ARROW_LEFT, meta ->
meta.displayName(Component.text("⬅ Page précédente",
NamedTextColor.GOLD, TextDecoration.BOLD).decoration(TextDecoration.ITALIC, false))
meta.displayName(TranslationManager.translation("feature.mailboxes.menu.button.previous_page_arrow")
.color(NamedTextColor.GOLD)
.decorate(TextDecoration.BOLD)
.decoration(TextDecoration.ITALIC, false))
).setPreviousPageButton();

public static final Function<Menu, ItemMenuBuilder> BTN_NEXT_PAGE_WHITE = (menu) ->
new ItemMenuBuilder(menu, OMCRegistry.CUSTOM_ITEMS.MAILBOX_ARROW_RIGHT, meta ->
meta.displayName(Component.text("Page suivante ➡",
NamedTextColor.GOLD, TextDecoration.BOLD).decoration(TextDecoration.ITALIC, false))
meta.displayName(TranslationManager.translation("feature.mailboxes.menu.button.next_page_arrow")
.color(NamedTextColor.GOLD)
.decorate(TextDecoration.BOLD)
.decoration(TextDecoration.ITALIC, false))
).setNextPageButton();

public static final Function<Menu, ItemMenuBuilder> BTN_PREVIOUS_PAGE_ORANGE = (menu) ->
Expand All @@ -43,18 +47,21 @@ public class ItemMenuTemplate {
).setCloseButton();

public static final Function<Menu, ItemMenuBuilder> BTN_CLOSE = (menu) ->
btn(menu, "✘", "Annuler", OMCRegistry.CUSTOM_ITEMS.MAILBOX_CANCEL_BTN, NamedTextColor.DARK_RED, true)
btn(menu, "✘", "feature.mailboxes.menu.button.cancel", OMCRegistry.CUSTOM_ITEMS.MAILBOX_CANCEL_BTN, NamedTextColor.DARK_RED, true)
.setCloseButton();

public static final Function<Menu, ItemMenuBuilder> BTN_MAILBOX_ACCEPT = (menu) ->
btn(menu, "✔", "Accepter", OMCRegistry.CUSTOM_ITEMS.MAILBOX_ACCEPT_BTN, NamedTextColor.DARK_GREEN, true);
btn(menu, "✔", "feature.mailboxes.menu.button.accept", OMCRegistry.CUSTOM_ITEMS.MAILBOX_ACCEPT_BTN, NamedTextColor.DARK_GREEN, true);

public static final Function<Menu, ItemMenuBuilder> BTN_MAILBOX_SEND = (menu) ->
btn(menu, "✉", "Envoyer", OMCRegistry.CUSTOM_ITEMS.MAILBOX_SEND, NamedTextColor.DARK_AQUA, true);
btn(menu, "✉", "feature.mailboxes.menu.button.send", OMCRegistry.CUSTOM_ITEMS.MAILBOX_SEND, NamedTextColor.DARK_AQUA, true);

public static final Function<Menu, ItemMenuBuilder> BTN_MAILBOX_HOME = (menu) ->
new ItemMenuBuilder(menu, Material.CHEST, meta -> {
meta.displayName(Component.text("⬅ Home", NamedTextColor.GOLD, TextDecoration.BOLD).decoration(TextDecoration.ITALIC, false));
meta.displayName(TranslationManager.translation("feature.mailboxes.menu.button.home_arrow")
.color(NamedTextColor.GOLD)
.decorate(TextDecoration.BOLD)
.decoration(TextDecoration.ITALIC, false));
meta.setMaxStackSize(1);
}).setOnClick(e -> new HomeMailbox(menu.getOwner()).open());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import fr.openmc.core.features.quests.rewards.QuestTextReward;
import fr.openmc.core.utils.text.messages.MessageType;
import fr.openmc.core.utils.text.messages.Prefix;
import net.kyori.adventure.text.Component;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
Expand All @@ -36,8 +37,7 @@ public TransferableObjectQuest() {
DreamSteps.TRANSFERABLE_OBJECT,
new QuestTier(
1,
new QuestTextReward("Il y a bien un lien entre cette dimension et le monde réel. " +
"Et ce n'est que le début d'une nouvelle aventure !", Prefix.DREAM, MessageType.SUCCESS)
new QuestTextReward(Component.text("Il y a bien un lien entre cette dimension et le monde réel. Et ce n'est que le début d'une nouvelle aventure !"), Prefix.DREAM, MessageType.SUCCESS)
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import dev.lone.itemsadder.api.CustomStack;
import fr.openmc.core.OMCPlugin;
import fr.openmc.core.utils.text.messages.TranslationManager;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.block.Block;
Expand Down Expand Up @@ -40,7 +40,7 @@ public void onBlockBreak(BlockBreakEvent event) {
return;

if (ThreadLocalRandom.current().nextDouble() < FAILURE_CHANCE) {
player.sendActionBar(Component.text("L'extraction a échoué ! Le spawner s'est brisé.", NamedTextColor.RED));
player.sendActionBar(TranslationManager.translation("feature.itemsadder.spawner_extractor.fail"));
return;
}

Expand All @@ -50,16 +50,19 @@ public void onBlockBreak(BlockBreakEvent event) {

ItemStack spawnerItem = ItemStack.of(Material.SPAWNER);
spawnerItem.editMeta(meta -> {
meta.displayName(Component.text("Spawner à ", NamedTextColor.YELLOW)
.append(Component.translatable(entityType.translationKey())));
meta.displayName(TranslationManager.translation(
"feature.itemsadder.spawner_extractor.display_name",
Component.translatable(entityType.translationKey())
));

meta.getPersistentDataContainer().set(KEY_SPAWNER_MOB, PersistentDataType.STRING, entityType.name());
});

block.getWorld().dropItemNaturally(block.getLocation(), spawnerItem);
player.sendActionBar(Component.text("Vous avez extrait un spawner à ", NamedTextColor.GREEN)
.append(Component.translatable(entityType.translationKey()))
.append(Component.text(" !")));
player.sendActionBar(TranslationManager.translation(
"feature.itemsadder.spawner_extractor.success_extract",
Component.translatable(entityType.translationKey())
));
}

@EventHandler
Expand All @@ -81,8 +84,9 @@ public void onBlockPlace(BlockPlaceEvent event) {
spawner.setSpawnedType(entityType);
spawner.update();

event.getPlayer().sendActionBar(Component.text("Spawner à ", NamedTextColor.GREEN)
.append(Component.translatable(entityType.translationKey()))
.append(Component.text(" placé !")));
event.getPlayer().sendActionBar(TranslationManager.translation(
"feature.itemsadder.spawner_extractor.success_place",
Component.translatable(entityType.translationKey())
));
}
}
Loading
Loading