From 8004e990d9f035c635fd993f1c1f1b86a4aa2f27 Mon Sep 17 00:00:00 2001 From: Aurora Lahtela <24460436+AuroraLS3@users.noreply.github.com> Date: Wed, 31 Aug 2022 09:51:05 +0300 Subject: [PATCH] Converted ChatFormatter to an interface --- .../com/djrapitops/plan/commands/use/ChatFormatter.java | 8 ++++---- .../plan/commands/use/ConsoleChatFormatter.java | 2 +- .../djrapitops/plan/commands/use/PlayerChatFormatter.java | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Plan/common/src/main/java/com/djrapitops/plan/commands/use/ChatFormatter.java b/Plan/common/src/main/java/com/djrapitops/plan/commands/use/ChatFormatter.java index b8a799b4b..918f1bf34 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/commands/use/ChatFormatter.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/commands/use/ChatFormatter.java @@ -22,11 +22,11 @@ import org.apache.commons.lang3.StringUtils; import java.util.ArrayList; import java.util.List; -public abstract class ChatFormatter { +public interface ChatFormatter { - public abstract int getWidth(String part); + int getWidth(String part); - public String table(String message, String separator) { + default String table(String message, String separator) { String[] lines = StringUtils.split(message, '\n'); List rows = new ArrayList<>(); Maximum.ForInteger rowWidth = new Maximum.ForInteger(0); @@ -54,7 +54,7 @@ public abstract class ChatFormatter { return table.toString(); } - public List tableAsParts(String message, String separator) { + default List tableAsParts(String message, String separator) { String[] lines = StringUtils.split(message, '\n'); List rows = new ArrayList<>(); Maximum.ForInteger rowWidth = new Maximum.ForInteger(0); diff --git a/Plan/common/src/main/java/com/djrapitops/plan/commands/use/ConsoleChatFormatter.java b/Plan/common/src/main/java/com/djrapitops/plan/commands/use/ConsoleChatFormatter.java index 2acf5115c..2f5e1f13f 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/commands/use/ConsoleChatFormatter.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/commands/use/ConsoleChatFormatter.java @@ -18,7 +18,7 @@ package com.djrapitops.plan.commands.use; import org.apache.commons.lang3.StringUtils; -public class ConsoleChatFormatter extends ChatFormatter { +public class ConsoleChatFormatter implements ChatFormatter { @Override public int getWidth(String part) { diff --git a/Plan/common/src/main/java/com/djrapitops/plan/commands/use/PlayerChatFormatter.java b/Plan/common/src/main/java/com/djrapitops/plan/commands/use/PlayerChatFormatter.java index dc48e638b..f6d8820fd 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/commands/use/PlayerChatFormatter.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/commands/use/PlayerChatFormatter.java @@ -16,7 +16,7 @@ */ package com.djrapitops.plan.commands.use; -public class PlayerChatFormatter extends ChatFormatter { +public class PlayerChatFormatter implements ChatFormatter { @Override public int getWidth(String part) {