diff options
Diffstat (limited to 'spark-common/src/main/java/me/lucko/spark/common/command')
3 files changed, 20 insertions, 12 deletions
diff --git a/spark-common/src/main/java/me/lucko/spark/common/command/modules/ActivityLogModule.java b/spark-common/src/main/java/me/lucko/spark/common/command/modules/ActivityLogModule.java index 36ba47c..e2bd80d 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/command/modules/ActivityLogModule.java +++ b/spark-common/src/main/java/me/lucko/spark/common/command/modules/ActivityLogModule.java @@ -67,14 +67,18 @@ public class ActivityLogModule implements CommandModule { .append(TextComponent.of(activity.getUser(), TextColor.WHITE)) .build() ); + + TextComponent.Builder valueComponent = TextComponent.builder(activity.getDataValue()) + .color(TextColor.WHITE) + .decoration(TextDecoration.UNDERLINED, true); + + if (activity.getDataType().equals("url")) { + valueComponent.clickEvent(ClickEvent.openUrl(activity.getDataValue())); + } + resp.replyPrefixed(TextComponent.builder(" ") - .append(TextComponent.of("Link: ", TextColor.GRAY)) - .append(TextComponent.builder(activity.getUrl()) - .color(TextColor.WHITE) - .decoration(TextDecoration.UNDERLINED, true) - .clickEvent(ClickEvent.openUrl(activity.getUrl())) - .build() - ) + .append(TextComponent.of(Character.toUpperCase(activity.getDataType().charAt(0)) + activity.getDataType().substring(1) + ": ", TextColor.GRAY)) + .append(valueComponent) .build() ); resp.reply(TextComponent.space()); diff --git a/spark-common/src/main/java/me/lucko/spark/common/command/modules/MemoryModule.java b/spark-common/src/main/java/me/lucko/spark/common/command/modules/MemoryModule.java index e3f1cdb..42c03d0 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/command/modules/MemoryModule.java +++ b/spark-common/src/main/java/me/lucko/spark/common/command/modules/MemoryModule.java @@ -20,7 +20,7 @@ package me.lucko.spark.common.command.modules; -import me.lucko.spark.common.ActivityLog; +import me.lucko.spark.common.ActivityLog.Activity; import me.lucko.spark.common.SparkPlatform; import me.lucko.spark.common.command.Command; import me.lucko.spark.common.command.CommandModule; @@ -77,7 +77,7 @@ public class MemoryModule implements CommandModule { .build() ); - platform.getActivityLog().addToLog(new ActivityLog.Activity(sender.getName(), System.currentTimeMillis(), "Heap dump summary", url)); + platform.getActivityLog().addToLog(Activity.urlActivity(sender, System.currentTimeMillis(), "Heap dump summary", url)); } catch (IOException e) { resp.broadcastPrefixed(TextComponent.of("An error occurred whilst uploading the data.", TextColor.RED)); e.printStackTrace(); @@ -119,7 +119,11 @@ public class MemoryModule implements CommandModule { return; } - resp.broadcastPrefixed(TextComponent.of("Heap dump written to: " + file.toString(), TextColor.GOLD)); + resp.broadcastPrefixed(TextComponent.builder("Heap dump written to: ", TextColor.GOLD) + .append(TextComponent.of(file.toString(), TextColor.DARK_GRAY)) + .build() + ); + platform.getActivityLog().addToLog(Activity.fileActivity(sender, System.currentTimeMillis(), "Heap dump", file.toString())); }); }) .tabCompleter((platform, sender, arguments) -> TabCompleter.completeForOpts(arguments, "--run-gc-before", "--include-non-live")) diff --git a/spark-common/src/main/java/me/lucko/spark/common/command/modules/SamplerModule.java b/spark-common/src/main/java/me/lucko/spark/common/command/modules/SamplerModule.java index 11d23da..4ea6144 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/command/modules/SamplerModule.java +++ b/spark-common/src/main/java/me/lucko/spark/common/command/modules/SamplerModule.java @@ -20,7 +20,7 @@ package me.lucko.spark.common.command.modules; -import me.lucko.spark.common.ActivityLog; +import me.lucko.spark.common.ActivityLog.Activity; import me.lucko.spark.common.SparkPlatform; import me.lucko.spark.common.command.Command; import me.lucko.spark.common.command.CommandModule; @@ -255,7 +255,7 @@ public class SamplerModule implements CommandModule { .build() ); - platform.getActivityLog().addToLog(new ActivityLog.Activity(resp.sender().getName(), System.currentTimeMillis(), "Sampler", url)); + platform.getActivityLog().addToLog(Activity.urlActivity(resp.sender(), System.currentTimeMillis(), "Sampler", url)); } catch (IOException e) { resp.broadcastPrefixed(TextComponent.of("An error occurred whilst uploading the results.", TextColor.RED)); e.printStackTrace(); |