From ea69bf0dc55a8a3854bfff79d097b6c9134ef1b3 Mon Sep 17 00:00:00 2001 From: Intelli Date: Tue, 8 Feb 2022 20:17:40 -0700 Subject: [PATCH] UI improvements & action colours --- .../java/net/coreprotect/command/LookupCommand.java | 13 +++++++++---- .../coreprotect/database/lookup/BlockLookup.java | 5 ++++- .../database/lookup/ChestTransactionLookup.java | 3 ++- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/coreprotect/command/LookupCommand.java b/src/main/java/net/coreprotect/command/LookupCommand.java index 24c5eac..71961b3 100755 --- a/src/main/java/net/coreprotect/command/LookupCommand.java +++ b/src/main/java/net/coreprotect/command/LookupCommand.java @@ -658,7 +658,7 @@ public class LookupCommand { final Integer[] radius = argRadius; try { - Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.LOOKUP_SEARCHING)); + Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Color.ITALIC + Phrase.build(Phrase.LOOKUP_SEARCHING)); final CommandSender player2 = player; final int finalX = x; final int finalY = y; @@ -787,7 +787,7 @@ public class LookupCommand { else if (pageStart < rows) { List lookupList = Lookup.performPartialLookup(statement, player2, uuidList, userList, blist, elist, euserlist, finalArgAction, location, radius, rowData, stime, (int) pageStart, displayResults, restrict_world, true); - Chat.sendMessage(player2, Color.WHITE + "----- " + Color.DARK_AQUA + Phrase.build(Phrase.LOOKUP_HEADER, "CoreProtect") + Color.WHITE + " -----"); + Chat.sendMessage(player2, Color.WHITE + "----- " + Color.DARK_AQUA + Phrase.build(Phrase.LOOKUP_HEADER, "CoreProtect" + Color.WHITE + " | " + Color.DARK_AQUA) + Color.WHITE + " -----"); if (finalArgAction.contains(6) || finalArgAction.contains(7)) { // Chat/command for (String[] data : lookupList) { String time = data[0]; @@ -816,7 +816,8 @@ public class LookupCommand { leftPadding = leftPadding + Color.WHITE + Strings.padStart("", (timeLength - 50) / 4, ' '); } - Chat.sendComponent(player2, timeago + " " + Color.WHITE + "- " + Color.DARK_AQUA + Phrase.build(Phrase.LOOKUP_LOGIN, Color.DARK_AQUA + dplayer + Color.WHITE, (action != 0 ? Selector.FIRST : Selector.SECOND))); + String tag = (action != 0 ? Color.GREEN + "+" : Color.RED + "-"); + Chat.sendComponent(player2, timeago + " " + tag + " " + Color.DARK_AQUA + Phrase.build(Phrase.LOOKUP_LOGIN, Color.DARK_AQUA + dplayer + Color.WHITE, (action != 0 ? Selector.FIRST : Selector.SECOND))); Chat.sendComponent(player2, Color.WHITE + leftPadding + Color.GREY + "^ " + Util.getCoordinates(command.getName(), wid, x, y, z, true, true) + ""); } } @@ -920,16 +921,19 @@ public class LookupCommand { if (daction == 2 || daction == 3) { phrase = Phrase.LOOKUP_ITEM; // {picked up|dropped} selector = (daction != 2 ? Selector.FIRST : Selector.SECOND); + tag = (daction != 2 ? Color.GREEN + "+" : Color.RED + "-"); action = "a:inventory"; } else if (daction == 4 || daction == 5) { phrase = Phrase.LOOKUP_STORAGE; // {deposited|withdrew} selector = (daction != 4 ? Selector.FIRST : Selector.SECOND); + tag = (daction != 4 ? Color.GREEN + "+" : Color.RED + "-"); action = "a:inventory"; } else { phrase = Phrase.LOOKUP_CONTAINER; // {added|removed} selector = (daction != 0 ? Selector.FIRST : Selector.SECOND); + tag = (daction != 0 ? Color.GREEN + "+" : Color.RED + "-"); action = "a:container"; } @@ -939,14 +943,15 @@ public class LookupCommand { if (daction == 2 || daction == 3) { phrase = Phrase.LOOKUP_INTERACTION; // {clicked|killed} selector = (daction != 3 ? Selector.FIRST : Selector.SECOND); + tag = (daction != 3 ? Color.WHITE + "-" : Color.RED + "-"); action = (daction == 2 ? "a:click" : "a:kill"); } else { phrase = Phrase.LOOKUP_BLOCK; // {placed|broke} selector = (daction != 0 ? Selector.FIRST : Selector.SECOND); + tag = (daction != 0 ? Color.GREEN + "+" : Color.RED + "-"); } - // tag = ChatColors.RED + "-"; Chat.sendComponent(player2, timeago + " " + tag + " " + Phrase.build(phrase, Color.DARK_AQUA + rbd + dplayer + Color.WHITE + rbd, Color.DARK_AQUA + rbd + dname + Color.WHITE, selector)); } diff --git a/src/main/java/net/coreprotect/database/lookup/BlockLookup.java b/src/main/java/net/coreprotect/database/lookup/BlockLookup.java index 1ff9722..91401c6 100644 --- a/src/main/java/net/coreprotect/database/lookup/BlockLookup.java +++ b/src/main/java/net/coreprotect/database/lookup/BlockLookup.java @@ -91,13 +91,16 @@ public class BlockLookup { Phrase phrase = Phrase.LOOKUP_BLOCK; String selector = Selector.FIRST; + String tag = Color.WHITE + "-"; if (resultAction == 2 || resultAction == 3) { phrase = Phrase.LOOKUP_INTERACTION; // {clicked|killed} selector = (resultAction != 3 ? Selector.FIRST : Selector.SECOND); + tag = (resultAction != 3 ? Color.WHITE + "-" : Color.RED + "-"); } else { phrase = Phrase.LOOKUP_BLOCK; // {placed|broke} selector = (resultAction != 0 ? Selector.FIRST : Selector.SECOND); + tag = (resultAction != 0 ? Color.GREEN + "+" : Color.RED + "-"); } String rbFormat = ""; @@ -126,7 +129,7 @@ public class BlockLookup { target = target.split(":")[1]; } - resultTextBuilder.append(timeAgo + " " + Color.WHITE + "- ").append(Phrase.build(phrase, Color.DARK_AQUA + rbFormat + resultUser + Color.WHITE + rbFormat, Color.DARK_AQUA + rbFormat + target + Color.WHITE, selector)).append("\n"); + resultTextBuilder.append(timeAgo + " " + tag + " ").append(Phrase.build(phrase, Color.DARK_AQUA + rbFormat + resultUser + Color.WHITE + rbFormat, Color.DARK_AQUA + rbFormat + target + Color.WHITE, selector)).append("\n"); } resultText = resultTextBuilder.toString(); diff --git a/src/main/java/net/coreprotect/database/lookup/ChestTransactionLookup.java b/src/main/java/net/coreprotect/database/lookup/ChestTransactionLookup.java index 3f611bd..53d57b1 100644 --- a/src/main/java/net/coreprotect/database/lookup/ChestTransactionLookup.java +++ b/src/main/java/net/coreprotect/database/lookup/ChestTransactionLookup.java @@ -95,6 +95,7 @@ public class ChestTransactionLookup { found = true; String selector = (resultAction != 0 ? Selector.FIRST : Selector.SECOND); + String tag = (resultAction != 0 ? Color.GREEN + "+" : Color.RED + "-"); String rbFormat = ""; if (resultRolledBack == 1) { rbFormat = Color.STRIKETHROUGH; @@ -115,7 +116,7 @@ public class ChestTransactionLookup { target = target.split(":")[1]; } - resultBuilder.append(timeAgo + " " + Color.WHITE + "- ").append(Phrase.build(Phrase.LOOKUP_CONTAINER, Color.DARK_AQUA + rbFormat + resultUser + Color.WHITE + rbFormat, "x" + resultAmount, Color.DARK_AQUA + rbFormat + target + Color.WHITE, selector)).append("\n"); + resultBuilder.append(timeAgo + " " + tag + " ").append(Phrase.build(Phrase.LOOKUP_CONTAINER, Color.DARK_AQUA + rbFormat + resultUser + Color.WHITE + rbFormat, "x" + resultAmount, Color.DARK_AQUA + rbFormat + target + Color.WHITE, selector)).append("\n"); } result = resultBuilder.toString(); results.close();