feat: toString() for data classes and some other more

This commit is contained in:
ChomeNS
2024-12-07 18:25:01 +07:00
parent 1afcfde5e5
commit 1d3b51cd3f
10 changed files with 91 additions and 13 deletions

View File

@@ -1 +1 @@
1218
1219

View File

@@ -300,6 +300,16 @@ public class Bot {
listeners.add(listener);
}
@Override
public String toString() {
return "Bot{" +
"host='" + host + '\'' +
", port=" + port +
", username='" + username + '\'' +
", loggedIn=" + loggedIn +
'}';
}
public static class Listener extends SessionAdapter {
public void connecting () {}
public void loadedPlugins () {}

View File

@@ -2,6 +2,8 @@ package me.chayapak1.chomens_bot.command;
import net.kyori.adventure.text.Component;
import java.util.Arrays;
public abstract class Command {
public final String name;
public String description;
@@ -27,4 +29,16 @@ public abstract class Command {
}
public abstract Component execute (CommandContext context) throws Exception;
@Override
public String toString() {
return "Command{" +
"name='" + name + '\'' +
", description='" + description + '\'' +
", usages=" + Arrays.toString(usages) +
", aliases=" + Arrays.toString(aliases) +
", trustLevel=" + trustLevel +
", consoleOnly=" + consoleOnly +
'}';
}
}

View File

@@ -27,5 +27,15 @@ public class BossBar {
this.division = division;
this.health = health;
}
}
@Override
public String toString() {
return "BossBar{" +
"uuid=" + uuid +
", title=" + title +
", color=" + color +
", division=" + division +
", health=" + health +
'}';
}
}

View File

@@ -18,4 +18,13 @@ public class FilteredPlayer {
this.regex = regex;
this.ignoreCase = ignoreCase;
}
@Override
public String toString() {
return "FilteredPlayer{" +
"playerName='" + playerName + '\'' +
", regex=" + regex +
", ignoreCase=" + ignoreCase +
'}';
}
}

View File

@@ -1,10 +0,0 @@
package me.chayapak1.chomens_bot.data;
// https://gist.github.com/kaecy/286f8ad334aec3fcb588516feb727772#file-message-java
public class IRCMessage {
public String origin;
public String nickName;
public String command;
public String channel;
public String content;
}

View File

@@ -24,4 +24,14 @@ public class Mail {
this.server = server;
this.contents = contents;
}
@Override
public String toString() {
return "Mail{" +
"sentBy='" + sentBy + '\'' +
", sentTo='" + sentTo + '\'' +
", timeSent=" + timeSent +
", server='" + server + '\'' +
'}';
}
}

View File

@@ -37,7 +37,17 @@ public class PlayerEntry {
this.listed = listed;
}
public PlayerEntry(PlayerListEntry entry) {
public PlayerEntry (PlayerListEntry entry) {
this(entry.getProfile(), entry.getGameMode(), entry.getLatency(), entry.getDisplayName(), entry.getExpiresAt(), entry.getPublicKey(), entry.getKeySignature(), entry.isListed());
}
@Override
public String toString() {
return "PlayerEntry{" +
"gamemode=" + gamemode +
", latency=" + latency +
", listed=" + listed +
", displayName=" + displayName +
'}';
}
}

View File

@@ -72,4 +72,20 @@ public class Team {
case RESET -> Style.empty();
};
}
@Override
public String toString() {
return "Team{" +
"teamName='" + teamName + '\'' +
", players=" + players +
", displayName=" + displayName +
", friendlyFire=" + friendlyFire +
", seeFriendlyInvisibles=" + seeFriendlyInvisibles +
", nametagVisibility=" + nametagVisibility +
", collisionRule=" + collisionRule +
", color=" + color +
", prefix=" + prefix +
", suffix=" + suffix +
'}';
}
}

View File

@@ -17,4 +17,13 @@ public class PlayerMessage {
this.displayName = displayName;
this.contents = contents;
}
@Override
public String toString() {
return "PlayerMessage{" +
"sender=" + sender +
", displayName=" + displayName +
", contents=" + contents +
'}';
}
}