mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
implement player ignore api
This commit is contained in:
1 parent
ad2b7be13d
commit
bf9e4e8148
3 files changed
+43
No files matched your search
@@ -346,4 +346,22 @@ public interface CarbonPlayer extends Audience, Identified {
|
||||
*/
|
||||
boolean awareOf(final CarbonPlayer other);
|
||||
|
||||
/**
|
||||
* If this player is ignoring and hiding the messages of the sender.
|
||||
*
|
||||
* @param sender the player that may or may not be ignored
|
||||
* @return if this player is ignoring the sender
|
||||
* @since 2.0.0
|
||||
*/
|
||||
boolean ignoring(CarbonPlayer sender);
|
||||
|
||||
/**
|
||||
* Ignores/unignores the player.
|
||||
*
|
||||
* @param player the player to ignore/unignore
|
||||
* @param nowIgnoring if the player will be ignored
|
||||
* @since 2.0.0
|
||||
*/
|
||||
void ignoring(CarbonPlayer player, boolean nowIgnoring);
|
||||
|
||||
}
|
||||
@@ -62,6 +62,7 @@ public class CarbonPlayerCommon implements CarbonPlayer, ForwardingAudience.Sing
|
||||
|
||||
// Punishments
|
||||
protected List<MuteEntry> muteEntries = new ArrayList<>();
|
||||
protected List<UUID> ignoredPlayers = new ArrayList<>();
|
||||
|
||||
public CarbonPlayerCommon(
|
||||
final String username,
|
||||
@@ -180,6 +181,20 @@ public class CarbonPlayerCommon implements CarbonPlayer, ForwardingAudience.Sing
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ignoring(final CarbonPlayer sender) {
|
||||
return this.ignoredPlayers.contains(sender.uuid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ignoring(final CarbonPlayer player, final boolean nowIgnoring) {
|
||||
if (nowIgnoring) {
|
||||
this.ignoredPlayers.add(player.uuid());
|
||||
} else {
|
||||
this.ignoredPlayers.remove(player.uuid());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deafened() {
|
||||
return this.deafened;
|
||||
|
||||
@@ -56,6 +56,16 @@ public abstract class WrappedCarbonPlayer implements CarbonPlayer {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ignoring(final CarbonPlayer sender) {
|
||||
return this.carbonPlayerCommon().ignoring(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ignoring(final CarbonPlayer player, final boolean nowIgnoring) {
|
||||
this.carbonPlayerCommon().ignoring(player, nowIgnoring);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(final String permission) {
|
||||
final var data = this.user().getCachedData().getPermissionData(this.user().getQueryOptions());
|
||||
|
||||
Reference in new issue
Block a user