forked from zhdev/griefus
Use VanillaCrafts styling in lookup/inspector results
This commit is contained in:
parent
695cd1ade7
commit
877ffe5015
2 changed files with 25 additions and 17 deletions
|
|
@ -109,6 +109,8 @@ public class StandardLookupThread implements Runnable {
|
|||
ConfigHandler.lookupAlist.put(player.getName(), actions);
|
||||
ConfigHandler.lookupRadius.put(player.getName(), radius);
|
||||
|
||||
String separator = Color.DARK_GREY + '-';
|
||||
|
||||
if (connection != null) {
|
||||
Statement statement = connection.createStatement();
|
||||
String baduser = "";
|
||||
|
|
@ -195,14 +197,15 @@ public class StandardLookupThread implements Runnable {
|
|||
else if (pageStart < rows) {
|
||||
List<String[]> lookupList = Lookup.performPartialLookup(statement, player, uuidList, userList, blockList, excludedBlocks, excludedUsers, actions, finalLocation, radius, rowData, timeStart, timeEnd, (int) pageStart, displayResults, restrict_world, true);
|
||||
|
||||
Chat.sendMessage(player, Color.WHITE + "----- " + Color.DARK_AQUA + Phrase.build(Phrase.LOOKUP_HEADER, "Griefus" + Color.WHITE + " | " + Color.DARK_AQUA) + Color.WHITE + " -----");
|
||||
// Chat.sendMessage(player, Color.WHITE + "----- " + Color.DARK_AQUA + Phrase.build(Phrase.LOOKUP_HEADER, "Griefus" + Color.WHITE + " | " + Color.DARK_AQUA) + Color.WHITE + " -----");
|
||||
Chat.sendComponent(player, StringUtils.makeHeader("LOGS"));
|
||||
if (actions.contains(6) || actions.contains(7)) { // Chat/command
|
||||
for (String[] data : lookupList) {
|
||||
String time = data[0];
|
||||
String dplayer = data[1];
|
||||
String message = data[2];
|
||||
String timeago = ChatUtils.getTimeSince(Integer.parseInt(time), unixtimestamp, true);
|
||||
Chat.sendComponent(player, timeago + " " + Color.WHITE + "- " + Color.DARK_AQUA + dplayer + ": " + Color.WHITE, message);
|
||||
Chat.sendComponent(player, "<dark_gray><bold>|<reset> " + timeago + " " + Color.WHITE + "- " + message);
|
||||
if (PluginChannelHandshakeListener.getInstance().isPluginChannelPlayer(player)) {
|
||||
int wid = Integer.parseInt(data[3]);
|
||||
int dataX = Integer.parseInt(data[4]);
|
||||
|
|
@ -232,7 +235,7 @@ public class StandardLookupThread implements Runnable {
|
|||
}
|
||||
|
||||
String tag = (action != 0 ? Color.GREEN + "+" : Color.RED + "-");
|
||||
Chat.sendComponent(player, timeago + " " + tag + " " + Color.DARK_AQUA + Phrase.build(Phrase.LOOKUP_LOGIN, Color.DARK_AQUA + dplayer + Color.WHITE, (action != 0 ? Selector.FIRST : Selector.SECOND)));
|
||||
Chat.sendComponent(player, "<dark_gray><bold>|<reset> " + timeago + " " + tag + " " + Color.DARK_AQUA + Phrase.build(Phrase.LOOKUP_LOGIN, Color.DARK_AQUA + dplayer + Color.WHITE, (action != 0 ? Selector.FIRST : Selector.SECOND)));
|
||||
Chat.sendComponent(player, Color.WHITE + leftPadding + Color.GREY + "^ " + ChatUtils.getCoordinates(command.getName(), wid, dataX, dataY, dataZ, true, true) + "");
|
||||
PluginChannelListener.getInstance().sendInfoData(player, Integer.parseInt(time), Phrase.LOOKUP_LOGIN, (action != 0 ? Selector.FIRST : Selector.SECOND), dplayer, -1, dataX, dataY, dataZ, wid);
|
||||
}
|
||||
|
|
@ -266,8 +269,8 @@ public class StandardLookupThread implements Runnable {
|
|||
leftPadding = leftPadding + Color.WHITE + Strings.padStart("", (timeLength - 50) / 4, ' ');
|
||||
}
|
||||
|
||||
Chat.sendComponent(player, timeago + " " + Color.WHITE + "- " + Color.DARK_AQUA + dplayer + ": " + Color.WHITE, message);
|
||||
Chat.sendComponent(player, Color.WHITE + leftPadding + Color.GREY + "^ " + ChatUtils.getCoordinates(command.getName(), wid, dataX, dataY, dataZ, true, true) + "");
|
||||
Chat.sendComponent(player,"<dark_gray><bold>|<reset> " + timeago + " " + Color.WHITE + "- " + Color.DARK_AQUA + dplayer + ": " + Color.WHITE, message);
|
||||
Chat.sendComponent(player, Color.RESET + leftPadding + ChatUtils.getShowCoordinatesButton(dataX, dataY, dataZ) + " " + ChatUtils.getTeleportButton(wid, dataX, dataY, dataZ));
|
||||
PluginChannelListener.getInstance().sendMessageData(player, Integer.parseInt(time), dplayer, message, true, dataX, dataY, dataZ, wid);
|
||||
}
|
||||
}
|
||||
|
|
@ -317,7 +320,7 @@ public class StandardLookupThread implements Runnable {
|
|||
tag = (daction == 0 ? Color.GREEN + "+" : Color.RED + "-");
|
||||
}
|
||||
|
||||
Chat.sendComponent(player, timeago + " " + tag + " " + Phrase.build(Phrase.LOOKUP_CONTAINER, Color.DARK_AQUA + rbd + dplayer + Color.WHITE + rbd, "x" + amount, ChatUtils.createTooltip(Color.DARK_AQUA + rbd + dname, tooltip) + Color.WHITE, selector));
|
||||
Chat.sendComponent(player, "<dark_gray><bold>|<reset> " + timeago + " " + separator + " " + Phrase.build(Phrase.LOOKUP_CONTAINER, Color.WHITE + Color.BOLD + rbd + dplayer + Color.RESET + rbd, "x" + amount, ChatUtils.createTooltip(Color.GOLD + rbd + dname, tooltip) + Color.WHITE, selector));
|
||||
PluginChannelListener.getInstance().sendData(player, Integer.parseInt(time), Phrase.LOOKUP_CONTAINER, selector, dplayer, dname, amount, dataX, dataY, dataZ, wid, rbd, true, tag.contains("+"));
|
||||
}
|
||||
}
|
||||
|
|
@ -413,7 +416,7 @@ public class StandardLookupThread implements Runnable {
|
|||
action = "a:container";
|
||||
}
|
||||
|
||||
Chat.sendComponent(player, timeago + " " + tag + " " + Phrase.build(phrase, Color.DARK_AQUA + rbd + dplayer + Color.WHITE + rbd, "x" + amount, ChatUtils.createTooltip(Color.DARK_AQUA + rbd + dname, tooltip) + Color.WHITE, selector));
|
||||
Chat.sendComponent(player, "<dark_gray><bold>|<reset>" + timeago + " " + separator + " " + Phrase.build(phrase, Color.WHITE + Color.BOLD + rbd + dplayer + Color.RESET + rbd, "x" + amount, ChatUtils.createTooltip(Color.GOLD + rbd + dname, tooltip) + Color.WHITE, selector));
|
||||
PluginChannelListener.getInstance().sendData(player, Integer.parseInt(time), phrase, selector, dplayer, dname, (tag.contains("+") ? 1 : -1), dataX, dataY, dataZ, wid, rbd, action.contains("container"), tag.contains("+"));
|
||||
}
|
||||
else {
|
||||
|
|
@ -429,20 +432,20 @@ public class StandardLookupThread implements Runnable {
|
|||
tag = (daction != 0 ? Color.GREEN + "+" : Color.RED + "-");
|
||||
}
|
||||
|
||||
Chat.sendComponent(player, timeago + " " + tag + " " + Phrase.build(phrase, Color.DARK_AQUA + rbd + dplayer + Color.WHITE + rbd, Color.DARK_AQUA + rbd + dname + Color.WHITE, selector));
|
||||
Chat.sendComponent(player, timeago + " " + separator + " " + Phrase.build(phrase, Color.WHITE + Color.BOLD + rbd + dplayer + Color.RESET + rbd, Color.GOLD + rbd + dname + Color.WHITE, selector));
|
||||
PluginChannelListener.getInstance().sendData(player, Integer.parseInt(time), phrase, selector, dplayer, dname, (tag.contains("+") ? 1 : -1), dataX, dataY, dataZ, wid, rbd, false, tag.contains("+"));
|
||||
}
|
||||
|
||||
action = (actions.size() == 0 ? " (" + action + ")" : "");
|
||||
Chat.sendComponent(player, Color.WHITE + leftPadding + Color.GREY + "^ " + ChatUtils.getCoordinates(command.getName(), wid, dataX, dataY, dataZ, true, true) + Color.GREY + Color.ITALIC + action);
|
||||
Chat.sendComponent(player, Color.RESET + leftPadding + ChatUtils.getShowCoordinatesButton(dataX, dataY, dataZ) + " " + ChatUtils.getTeleportButton(wid, dataX, dataY, dataZ));
|
||||
}
|
||||
}
|
||||
if (rows > displayResults) {
|
||||
int total_pages = (int) Math.ceil(rows / (displayResults + 0.0));
|
||||
if (actions.contains(6) || actions.contains(7) || actions.contains(9) || (actions.contains(4) && actions.contains(11))) {
|
||||
/* if (actions.contains(6) || actions.contains(7) || actions.contains(9) || (actions.contains(4) && actions.contains(11))) {
|
||||
Chat.sendMessage(player, "-----");
|
||||
}
|
||||
Chat.sendComponent(player, ChatUtils.getPageNavigation(command.getName(), page, total_pages));
|
||||
} */
|
||||
Chat.sendComponent(player, ChatUtils.getPageNavigationVC(command.getName(), page, total_pages));
|
||||
}
|
||||
}
|
||||
else if (rows > 0) {
|
||||
|
|
|
|||
|
|
@ -84,13 +84,19 @@ public class BlockLookup {
|
|||
String timeAgo = ChatUtils.getTimeSince(resultTime, time, true);
|
||||
|
||||
if (!found) {
|
||||
resultTextBuilder = new StringBuilder(Color.WHITE + "----- " + Color.DARK_AQUA + "Griefus " + Color.WHITE + "----- " + ChatUtils.getCoordinates(command, worldId, x, y, z, false, false) + "\n");
|
||||
// resultTextBuilder = new StringBuilder(Color.WHITE + "----- " + Color.DARK_AQUA + "Griefus " + Color.WHITE + "----- " + ChatUtils.getCoordinates(command, worldId, x, y, z, false, false) + "\n");
|
||||
// Lookup/Checker header
|
||||
resultTextBuilder = new StringBuilder(StringUtils.makeHeader("CHECKER") +
|
||||
" " + ChatUtils.getShowCoordinatesButton(x, y, z) +
|
||||
(commandSender.hasPermission("coreprotect.teleport") ? " " + // TODO: change teleport permission key
|
||||
ChatUtils.getTeleportButton(worldId, x, y, z) : "") + "\n");
|
||||
}
|
||||
found = true;
|
||||
|
||||
Phrase phrase = Phrase.LOOKUP_BLOCK;
|
||||
String selector = Selector.FIRST;
|
||||
String tag = Color.WHITE + "-";
|
||||
String separator = Color.DARK_GREY + "-";
|
||||
if (resultAction == 2 || resultAction == 3) {
|
||||
phrase = Phrase.LOOKUP_INTERACTION; // {clicked|killed}
|
||||
selector = (resultAction != 3 ? Selector.FIRST : Selector.SECOND);
|
||||
|
|
@ -128,7 +134,7 @@ public class BlockLookup {
|
|||
target = target.split(":")[1];
|
||||
}
|
||||
|
||||
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");
|
||||
resultTextBuilder.append(timeAgo + " " + separator + " ").append(Phrase.build(phrase, Color.WHITE + Color.BOLD + rbFormat + resultUser + Color.RESET + rbFormat, Color.GOLD + rbFormat + target + Color.WHITE, selector)).append("\n");
|
||||
PluginChannelListener.getInstance().sendData(commandSender, resultTime, phrase, selector, resultUser, target, -1, x, y, z, worldId, rbFormat, false, tag.contains("+"));
|
||||
}
|
||||
|
||||
|
|
@ -137,9 +143,8 @@ public class BlockLookup {
|
|||
|
||||
if (found) {
|
||||
if (count > limit) {
|
||||
String pageInfo = Color.WHITE + "-----\n";
|
||||
pageInfo = pageInfo + ChatUtils.getPageNavigation(command, page, totalPages) + "\n";
|
||||
resultText = resultText + pageInfo;
|
||||
// String pageInfo = Color.WHITE + "-----\n";
|
||||
resultText = resultText + ChatUtils.getPageNavigationVC(command, page, totalPages) + "\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue