Apply suggestions

This commit is contained in:
Draycia committed 2023-08-25 19:18:04 -07:00
1 parent a511035d0a
commit 64a93656ea
8 files changed
+15 -11

No files matched your search

@@ -298,7 +298,7 @@ public interface CarbonPlayer extends Audience, Identified {
* @param ignoring if the player is ignoring direct messages * @param ignoring if the player is ignoring direct messages
* @since 2.1.0 * @since 2.1.0
*/ */
void ignoringDirectMessages(final boolean ignoring); void ignoringDirectMessages(boolean ignoring);
/** /**
* Sends the message as the player. * Sends the message as the player.
@@ -70,7 +70,7 @@ public class CarbonPlayerCommon implements CarbonPlayer, ForwardingAudience.Sing
// Whispers // Whispers
protected transient @Nullable UUID lastWhisperTarget = null; protected transient @Nullable UUID lastWhisperTarget = null;
protected transient @Nullable UUID whisperReplyTarget = null; protected transient @Nullable UUID whisperReplyTarget = null;
protected boolean ignoringdirectMessages = false; protected final PersistentUserProperty<Boolean> ignoringDirectMessages;
// Administrative // Administrative
protected final PersistentUserProperty<Boolean> spying; protected final PersistentUserProperty<Boolean> spying;
@@ -89,7 +89,8 @@ public class CarbonPlayerCommon implements CarbonPlayer, ForwardingAudience.Sing
final @Nullable Component displayName, final @Nullable Component displayName,
final @Nullable UUID lastWhisperTarget, final @Nullable UUID lastWhisperTarget,
final @Nullable UUID whisperReplyTarget, final @Nullable UUID whisperReplyTarget,
final boolean spying final boolean spying,
final boolean ignoreDirectMessages
) { ) {
this.muted = PersistentUserProperty.of(muted); this.muted = PersistentUserProperty.of(muted);
this.deafened = PersistentUserProperty.of(deafened); this.deafened = PersistentUserProperty.of(deafened);
@@ -102,6 +103,7 @@ public class CarbonPlayerCommon implements CarbonPlayer, ForwardingAudience.Sing
this.spying = PersistentUserProperty.of(spying); this.spying = PersistentUserProperty.of(spying);
this.ignoredPlayers = PersistentUserProperty.of(Collections.emptySet()); this.ignoredPlayers = PersistentUserProperty.of(Collections.emptySet());
this.leftChannels = PersistentUserProperty.of(Collections.emptySet()); this.leftChannels = PersistentUserProperty.of(Collections.emptySet());
this.ignoringDirectMessages = PersistentUserProperty.of(ignoreDirectMessages);
} }
public CarbonPlayerCommon( public CarbonPlayerCommon(
@@ -117,6 +119,7 @@ public class CarbonPlayerCommon implements CarbonPlayer, ForwardingAudience.Sing
this.leftChannels = PersistentUserProperty.of(Collections.emptySet()); this.leftChannels = PersistentUserProperty.of(Collections.emptySet());
this.username = username; this.username = username;
this.uuid = uuid; this.uuid = uuid;
this.ignoringDirectMessages = PersistentUserProperty.of(false);
} }
public CarbonPlayerCommon() { public CarbonPlayerCommon() {
@@ -127,6 +130,7 @@ public class CarbonPlayerCommon implements CarbonPlayer, ForwardingAudience.Sing
this.spying = PersistentUserProperty.of(false); this.spying = PersistentUserProperty.of(false);
this.ignoredPlayers = PersistentUserProperty.of(Collections.emptySet()); this.ignoredPlayers = PersistentUserProperty.of(Collections.emptySet());
this.leftChannels = PersistentUserProperty.of(Collections.emptySet()); this.leftChannels = PersistentUserProperty.of(Collections.emptySet());
this.ignoringDirectMessages = PersistentUserProperty.of(false);
} }
public boolean needsSave() { public boolean needsSave() {
@@ -265,12 +269,12 @@ public class CarbonPlayerCommon implements CarbonPlayer, ForwardingAudience.Sing
@Override @Override
public boolean ignoringDirectMessages() { public boolean ignoringDirectMessages() {
return this.ignoringdirectMessages; return this.ignoringDirectMessages.get();
} }
@Override @Override
public void ignoringDirectMessages(final boolean ignoring) { public void ignoringDirectMessages(final boolean ignoring) {
this.ignoringdirectMessages = ignoring; this.ignoringDirectMessages.set(ignoring);
} }
@Override @Override
@@ -7,4 +7,4 @@ INSERT IGNORE INTO carbon_users SET
lastwhispertarget = :lastwhispertarget, lastwhispertarget = :lastwhispertarget,
whisperreplytarget = :whisperreplytarget, whisperreplytarget = :whisperreplytarget,
spying = :spying, spying = :spying,
ignoringdirectmessages = :ignoringdirectmessages; ignoringdms = :ignoringdms;
@@ -7,7 +7,7 @@ CREATE TABLE carbon_users (
`lastwhispertarget` UUID, `lastwhispertarget` UUID,
`whisperreplytarget` UUID, `whisperreplytarget` UUID,
`spying` BOOLEAN, `spying` BOOLEAN,
`ignoringdirectmessages` BOOLEAN `ignoringdms` BOOLEAN
); );
CREATE TABLE carbon_ignores ( CREATE TABLE carbon_ignores (
@@ -1 +1 @@
ALTER TABLE carbon_users ADD COLUMN ignoringdirectmessages BOOLEAN; ALTER TABLE carbon_users ADD COLUMN ignoringdms BOOLEAN;
@@ -1 +1 @@
ALTER TABLE carbon_users ADD COLUMN ignoringdirectmessages BOOLEAN; ALTER TABLE carbon_users ADD COLUMN ignoringdms BOOLEAN;
@@ -7,5 +7,5 @@ SELECT
lastwhispertarget, lastwhispertarget,
whisperreplytarget, whisperreplytarget,
spying, spying,
ignoringdirectmessages ignoringdms
FROM carbon_users WHERE (id = :id); FROM carbon_users WHERE (id = :id);
@@ -7,4 +7,4 @@ UPDATE carbon_users SET
lastwhispertarget = :lastwhispertarget, lastwhispertarget = :lastwhispertarget,
whisperreplytarget = :whisperreplytarget, whisperreplytarget = :whisperreplytarget,
spying = :spying, spying = :spying,
ignoringdirectmessages = :ignoringdirectmessages; ignoringdms = :ignoringdms;