Skip to content

Commit

Permalink
⚡ Rework HoverEvent to conform with new API
Browse files Browse the repository at this point in the history
  • Loading branch information
MrGraversen committed Apr 16, 2021
1 parent 03f5994 commit 4920490
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/main/java/io/graversen/minecraft/rcon/JsonUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.google.gson.GsonBuilder;

public class JsonUtils {
private static final Gson GSON_INSTANCE = new GsonBuilder().create();
private static final Gson GSON_INSTANCE = new GsonBuilder().disableHtmlEscaping().create();

public static String toJson(Object object) {
return GSON_INSTANCE.toJson(object);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
package io.graversen.minecraft.rcon.commands.tellraw;

import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
public class HoverEvent {
private final String action;
private final String value;

public HoverEvent(String action, String value) {
this.action = action;
this.value = value;
}

public String getAction() {
return action;
}

public String getValue() {
return value;
}

private final TextContent[] contents;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package io.graversen.minecraft.rcon.commands.tellraw;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
public class TextContent {
private final String text;
private final boolean bold;
private final boolean italic;
private final boolean underlined;
private final boolean striketrough;
private final boolean obfuscated;
private final String color;

public TextContent(TellRawCommand tellRawCommand) {
this.text = tellRawCommand.getText();
this.bold = tellRawCommand.isBold();
this.italic = tellRawCommand.isItalic();
this.underlined = tellRawCommand.isUnderlined();
this.striketrough = tellRawCommand.isStriketrough();
this.obfuscated = tellRawCommand.isObfuscated();
this.color = tellRawCommand.getColor();
}
}

0 comments on commit 4920490

Please sign in to comment.