From 0f196f59c6a4cb76ab8409da62ff1f35505f94a8 Mon Sep 17 00:00:00 2001 From: Dico Karssiens Date: Sun, 11 Nov 2018 14:06:45 +0000 Subject: Changes I made before breaking my local repository. Hoping this works. --- .../dicore/command/chat/AbstractChatHandler.java | 188 ++++++++++----------- 1 file changed, 94 insertions(+), 94 deletions(-) (limited to 'dicore3/command/src/main/java/io/dico/dicore/command/chat/AbstractChatHandler.java') diff --git a/dicore3/command/src/main/java/io/dico/dicore/command/chat/AbstractChatHandler.java b/dicore3/command/src/main/java/io/dico/dicore/command/chat/AbstractChatHandler.java index c0d23ee..ac2a76d 100644 --- a/dicore3/command/src/main/java/io/dico/dicore/command/chat/AbstractChatHandler.java +++ b/dicore3/command/src/main/java/io/dico/dicore/command/chat/AbstractChatHandler.java @@ -1,94 +1,94 @@ -package io.dico.dicore.command.chat; - -import io.dico.dicore.Formatting; -import io.dico.dicore.command.EMessageType; -import io.dico.dicore.command.ExecutionContext; -import io.dico.dicore.command.ICommandAddress; -import io.dico.dicore.command.chat.help.HelpPages; -import org.bukkit.command.CommandSender; -import org.jetbrains.annotations.NotNull; - -public class AbstractChatHandler implements IChatHandler { - private @NotNull HelpPages helpPages; - - public AbstractChatHandler(@NotNull HelpPages helpPages) { - this.helpPages = helpPages; - } - - public AbstractChatHandler() { - this(HelpPages.newDefaultHelpPages()); - } - - @NotNull - public HelpPages getHelpPages() { - return helpPages; - } - - public void setHelpPages(@NotNull HelpPages helpPages) { - this.helpPages = helpPages; - } - - @Override - public Formatting getChatFormatForType(EMessageType type) { - switch (type) { - case EXCEPTION: - case BAD_NEWS: - return Formatting.RED; - case INSTRUCTION: - case NEUTRAL: - return Formatting.GRAY; - case CUSTOM: - return Formatting.WHITE; - case INFORMATIVE: - return Formatting.AQUA; - case RESULT: - default: - case GOOD_NEWS: - return Formatting.GREEN; - case WARNING: - return Formatting.YELLOW; - - case DESCRIPTION: - return Formatting.GREEN; - case SYNTAX: - return Formatting.AQUA; - case HIGHLIGHT: - return Formatting.RED; - case SUBCOMMAND: - return Formatting.GRAY; - case NUMBER: - return Formatting.YELLOW; - } - } - - @Override - public String getMessagePrefixForType(EMessageType type) { - return ""; - } - - protected String createMessage(EMessageType type, String message) { - if (message == null || message.isEmpty()) return null; - return getMessagePrefixForType(type) + getChatFormatForType(type) + message; - } - - @Override - public String createMessage(ExecutionContext context, EMessageType type, String message) { - return createMessage(type, message); - } - - @Override - public String createMessage(CommandSender sender, EMessageType type, String message) { - return createMessage(type, message); - } - - @Override - public String createHelpMessage(CommandSender sender, ExecutionContext context, ICommandAddress address, int page) { - return helpPages.getHelpPage(sender, context, address, page); - } - - @Override - public String createSyntaxMessage(CommandSender sender, ExecutionContext context, ICommandAddress address) { - return helpPages.getSyntax(sender, context, address); - } - -} +package io.dico.dicore.command.chat; + +import io.dico.dicore.Formatting; +import io.dico.dicore.command.EMessageType; +import io.dico.dicore.command.ExecutionContext; +import io.dico.dicore.command.ICommandAddress; +import io.dico.dicore.command.chat.help.HelpPages; +import org.bukkit.command.CommandSender; +import org.jetbrains.annotations.NotNull; + +public class AbstractChatHandler implements IChatHandler { + private @NotNull HelpPages helpPages; + + public AbstractChatHandler(@NotNull HelpPages helpPages) { + this.helpPages = helpPages; + } + + public AbstractChatHandler() { + this(HelpPages.newDefaultHelpPages()); + } + + @NotNull + public HelpPages getHelpPages() { + return helpPages; + } + + public void setHelpPages(@NotNull HelpPages helpPages) { + this.helpPages = helpPages; + } + + @Override + public Formatting getChatFormatForType(EMessageType type) { + switch (type) { + case EXCEPTION: + case BAD_NEWS: + return Formatting.RED; + case INSTRUCTION: + case NEUTRAL: + return Formatting.GRAY; + case CUSTOM: + return Formatting.WHITE; + case INFORMATIVE: + return Formatting.AQUA; + case RESULT: + default: + case GOOD_NEWS: + return Formatting.GREEN; + case WARNING: + return Formatting.YELLOW; + + case DESCRIPTION: + return Formatting.GREEN; + case SYNTAX: + return Formatting.AQUA; + case HIGHLIGHT: + return Formatting.RED; + case SUBCOMMAND: + return Formatting.GRAY; + case NUMBER: + return Formatting.YELLOW; + } + } + + @Override + public String getMessagePrefixForType(EMessageType type) { + return ""; + } + + protected String createMessage(EMessageType type, String message) { + if (message == null || message.isEmpty()) return null; + return getMessagePrefixForType(type) + getChatFormatForType(type) + message; + } + + @Override + public String createMessage(ExecutionContext context, EMessageType type, String message) { + return createMessage(type, message); + } + + @Override + public String createMessage(CommandSender sender, EMessageType type, String message) { + return createMessage(type, message); + } + + @Override + public String createHelpMessage(CommandSender sender, ExecutionContext context, ICommandAddress address, int page) { + return helpPages.getHelpPage(sender, context, address, page); + } + + @Override + public String createSyntaxMessage(CommandSender sender, ExecutionContext context, ICommandAddress address) { + return helpPages.getSyntax(sender, context, address); + } + +} -- cgit v1.2.3