Better party chat logging in console, some style changes to admin/party chat as well

This commit is contained in:
nossr50
2020-10-27 13:09:01 -07:00
parent d183d1217c
commit 2f506b72bb
14 changed files with 144 additions and 48 deletions

View File

@ -1,6 +1,7 @@
package com.gmail.nossr50.chat.author;
import com.gmail.nossr50.config.Config;
import com.google.common.base.Objects;
import org.bukkit.entity.Player;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.NotNull;
@ -38,7 +39,10 @@ public class AdminAuthor implements Author {
return overrideName;
}
@Override
/**
* Set the name of this author
* @param newName value of the new name
*/
public void setName(@NotNull String newName) {
overrideName = newName;
}
@ -57,4 +61,18 @@ public class AdminAuthor implements Author {
public @NonNull UUID uuid() {
return player.getUniqueId();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AdminAuthor that = (AdminAuthor) o;
return Objects.equal(player, that.player) &&
Objects.equal(overrideName, that.overrideName);
}
@Override
public int hashCode() {
return Objects.hashCode(player, overrideName);
}
}

View File

@ -11,12 +11,6 @@ public interface Author extends Identity {
*/
@NotNull String getAuthoredName();
/**
* Set the name of this author
* @param newName value of the new name
*/
void setName(@NotNull String newName);
/**
* Whether or not this author is a {@link org.bukkit.command.ConsoleCommandSender}
*

View File

@ -7,7 +7,7 @@ import java.util.UUID;
public class ConsoleAuthor implements Author {
private final UUID uuid;
private @NotNull String name;
private final @NotNull String name;
public ConsoleAuthor(@NotNull String name) {
this.name = name;
@ -19,11 +19,6 @@ public class ConsoleAuthor implements Author {
return name;
}
@Override
public void setName(@NotNull String newName) {
this.name = newName;
}
@Override
public boolean isConsole() {
return true;

View File

@ -1,6 +1,7 @@
package com.gmail.nossr50.chat.author;
import com.gmail.nossr50.config.Config;
import com.google.common.base.Objects;
import org.bukkit.entity.Player;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.NotNull;
@ -30,7 +31,10 @@ public class PartyAuthor implements Author {
}
}
@Override
/**
* Set the name of this author
* @param newName value of the new name
*/
public void setName(@NotNull String newName) {
overrideName = newName;
}
@ -45,8 +49,26 @@ public class PartyAuthor implements Author {
return true;
}
public Player getPlayer() {
return player;
}
@Override
public @NonNull UUID uuid() {
return player.getUniqueId();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PartyAuthor that = (PartyAuthor) o;
return Objects.equal(player, that.player) &&
Objects.equal(overrideName, that.overrideName);
}
@Override
public int hashCode() {
return Objects.hashCode(player, overrideName);
}
}