Files
SteamWar/SchematicSystem/src/de/steamwar/schematicsystem/commands/schematiccommand/SchematicCommandHelp.java
T
2026-05-15 14:52:17 +02:00

93 lines
3.3 KiB
Java

/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2025 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.schematicsystem.commands.schematiccommand;
import de.steamwar.schematicsystem.SchematicSystem;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.entity.Player;
public class SchematicCommandHelp {
private SchematicCommandHelp() {
}
public static void printHelpMainPage(Player player) {
SchematicSystem.MESSAGE.sendPrefixless("HELP_HEADER", player);
for (HelpPage page : HelpPage.values()) {
TextComponent pageComp = new TextComponent(SchematicSystem.MESSAGE.parse(page.mainText, player));
pageComp.setColor(ChatColor.GRAY);
pageComp.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§e" + SchematicSystem.MESSAGE.parse(page.hover, player))));
pageComp.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem help " + page.name()));
player.spigot().sendMessage(pageComp);
}
}
public static void printHelpPage(Player player, HelpPage page) {
SchematicSystem.MESSAGE.sendPrefixless("HELP_HEADER", player);
for (String s : page.content) {
SchematicSystem.MESSAGE.sendPrefixless(s, player);
}
}
public enum HelpPage {
ANSICHT("HELP_VIEW", "HELP_VIEW_HOVER", new String[]{
"HELP_VIEW_1",
"HELP_VIEW_2",
"HELP_VIEW_3",
"HELP_VIEW_4",
"HELP_VIEW_5",
"HELP_VIEW_6",
"HELP_VIEW_7",
"HELP_VIEW_8"
}),
BEARBEITUNG("HELP_EDIT", "HELP_EDIT_HOVER", new String[]{
"HELP_EDIT_1",
"HELP_EDIT_2",
"HELP_EDIT_3",
"HELP_EDIT_4",
"HELP_EDIT_5",
"HELP_EDIT_6",
"HELP_EDIT_7",
"HELP_EDIT_8",
"HELP_EDIT_9"
}),
MEMBER("HELP_SHARE", "HELP_SHARE_HOVER", new String[]{
"HELP_SHARE_1",
"HELP_SHARE_2",
"HELP_SHARE_3",
"HELP_SHARE_4",
"HELP_SHARE_5",
"HELP_SHARE_6"
});
private final String mainText;
private final String[] content;
private final String hover;
HelpPage(String mainText, String hover, String[] content) {
this.mainText = mainText;
this.hover = hover;
this.content = content;
}
}
}