From 11689bf855a696f80f464c3aebcc77513aa81dd3 Mon Sep 17 00:00:00 2001 From: Sauilitired Date: Mon, 1 Apr 2019 09:00:08 +0200 Subject: [PATCH] Configurable help categories --- .../plot/commands/CommandCategory.java | 38 ++++++++----------- .../plotsquared/plot/config/Captions.java | 11 ++++++ 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CommandCategory.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CommandCategory.java index f0ffc71a8..97c793be3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CommandCategory.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/CommandCategory.java @@ -1,58 +1,50 @@ package com.github.intellectualsites.plotsquared.plot.commands; +import com.github.intellectualsites.plotsquared.plot.config.Captions; +import lombok.RequiredArgsConstructor; + /** * CommandCategory. */ -public enum CommandCategory { +@RequiredArgsConstructor public enum CommandCategory { /** * Claiming CommandConfig. * Such as: /plot claim */ - CLAIMING("Claiming"), /** + CLAIMING(Captions.COMMAND_CATEGORY_CLAIMING), /** * Teleportation CommandConfig. * Such as: /plot visit */ - TELEPORT("Teleport"), /** + TELEPORT(Captions.COMMAND_CATEGORY_TELEPPORT), /** * Protection. */ - SETTINGS("Protection"), /** + SETTINGS(Captions.COMMAND_CATEGORY_SETTINGS), /** * Chat. */ - CHAT("Chat"), /** + CHAT(Captions.COMMAND_CATEGORY_CHAT), /** * Web. */ - SCHEMATIC("Web"), /** + SCHEMATIC(Captions.COMMAND_CATEGORY_SCHEMATIC), /** * Cosmetic. */ - APPEARANCE("Cosmetic"), /** + APPEARANCE(Captions.COMMAND_CATEGORY_APPEARANCE), /** * Information CommandConfig. * Such as: /plot info */ - INFO("Info"), /** + INFO(Captions.COMMAND_CATEGORY_INFO), /** * Debug CommandConfig. * Such as: /plot debug */ - DEBUG("Debug"), /** + DEBUG(Captions.COMMAND_CATEGORY_DEBUG), /** * Administration commands. */ - ADMINISTRATION("Admin"); + ADMINISTRATION(Captions.COMMAND_CATEGORY_ADMINISTRATION); /** * The category name (Readable). */ - private final String name; - - /** - * Constructor. - * - * @param name readable name - */ - CommandCategory(String name) { - this.name = name; - } - - + private final Captions caption; @Override public String toString() { - return this.name; + return this.caption.s(); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java index 5b2ec9ab2..b334d8dbe 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/config/Captions.java @@ -844,6 +844,17 @@ public enum Captions { "$2Total bucket values add up to 1 or more. Blocks without a spcified chance will be ignored", "Generator_Bucket"), + + /** + * Command Categories + */ + COMMAND_CATEGORY_CLAIMING("Claiming", "Category"), COMMAND_CATEGORY_TELEPPORT("Teleport", + "Category"), COMMAND_CATEGORY_SETTINGS("Protection", "Category"), COMMAND_CATEGORY_CHAT( + "Chat", "Category"), COMMAND_CATEGORY_SCHEMATIC("Web", + "Category"), COMMAND_CATEGORY_APPEARANCE("Cosmetic", "Category"), COMMAND_CATEGORY_INFO( + "Info", "Category"), COMMAND_CATEGORY_DEBUG("Debug", + "Category"), COMMAND_CATEGORY_ADMINISTRATION("Admin", "Category"), + /* * Direction */