mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-30 04:34:43 +02:00
Better party chat logging in console, some style changes to admin/party chat as well
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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}
|
||||
*
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user