diff --git a/api/src/main/java/net/draycia/carbon/api/users/CarbonPlayer.java b/api/src/main/java/net/draycia/carbon/api/users/CarbonPlayer.java index 05793325..b05421d9 100644 --- a/api/src/main/java/net/draycia/carbon/api/users/CarbonPlayer.java +++ b/api/src/main/java/net/draycia/carbon/api/users/CarbonPlayer.java @@ -298,7 +298,7 @@ public interface CarbonPlayer extends Audience, Identified { * @param ignoring if the player is ignoring direct messages * @since 2.1.0 */ - void ignoringDirectMessages(final boolean ignoring); + void ignoringDirectMessages(boolean ignoring); /** * Sends the message as the player. diff --git a/common/src/main/java/net/draycia/carbon/common/users/CarbonPlayerCommon.java b/common/src/main/java/net/draycia/carbon/common/users/CarbonPlayerCommon.java index 017892c4..f5fee6c4 100644 --- a/common/src/main/java/net/draycia/carbon/common/users/CarbonPlayerCommon.java +++ b/common/src/main/java/net/draycia/carbon/common/users/CarbonPlayerCommon.java @@ -70,7 +70,7 @@ public class CarbonPlayerCommon implements CarbonPlayer, ForwardingAudience.Sing // Whispers protected transient @Nullable UUID lastWhisperTarget = null; protected transient @Nullable UUID whisperReplyTarget = null; - protected boolean ignoringdirectMessages = false; + protected final PersistentUserProperty ignoringDirectMessages; // Administrative protected final PersistentUserProperty spying; @@ -89,7 +89,8 @@ public class CarbonPlayerCommon implements CarbonPlayer, ForwardingAudience.Sing final @Nullable Component displayName, final @Nullable UUID lastWhisperTarget, final @Nullable UUID whisperReplyTarget, - final boolean spying + final boolean spying, + final boolean ignoreDirectMessages ) { this.muted = PersistentUserProperty.of(muted); this.deafened = PersistentUserProperty.of(deafened); @@ -102,6 +103,7 @@ public class CarbonPlayerCommon implements CarbonPlayer, ForwardingAudience.Sing this.spying = PersistentUserProperty.of(spying); this.ignoredPlayers = PersistentUserProperty.of(Collections.emptySet()); this.leftChannels = PersistentUserProperty.of(Collections.emptySet()); + this.ignoringDirectMessages = PersistentUserProperty.of(ignoreDirectMessages); } public CarbonPlayerCommon( @@ -117,6 +119,7 @@ public class CarbonPlayerCommon implements CarbonPlayer, ForwardingAudience.Sing this.leftChannels = PersistentUserProperty.of(Collections.emptySet()); this.username = username; this.uuid = uuid; + this.ignoringDirectMessages = PersistentUserProperty.of(false); } public CarbonPlayerCommon() { @@ -127,6 +130,7 @@ public class CarbonPlayerCommon implements CarbonPlayer, ForwardingAudience.Sing this.spying = PersistentUserProperty.of(false); this.ignoredPlayers = PersistentUserProperty.of(Collections.emptySet()); this.leftChannels = PersistentUserProperty.of(Collections.emptySet()); + this.ignoringDirectMessages = PersistentUserProperty.of(false); } public boolean needsSave() { @@ -265,12 +269,12 @@ public class CarbonPlayerCommon implements CarbonPlayer, ForwardingAudience.Sing @Override public boolean ignoringDirectMessages() { - return this.ignoringdirectMessages; + return this.ignoringDirectMessages.get(); } @Override public void ignoringDirectMessages(final boolean ignoring) { - this.ignoringdirectMessages = ignoring; + this.ignoringDirectMessages.set(ignoring); } @Override diff --git a/common/src/main/resources/queries/insert-player.sql b/common/src/main/resources/queries/insert-player.sql index 273aa968..faeef40d 100644 --- a/common/src/main/resources/queries/insert-player.sql +++ b/common/src/main/resources/queries/insert-player.sql @@ -7,4 +7,4 @@ INSERT IGNORE INTO carbon_users SET lastwhispertarget = :lastwhispertarget, whisperreplytarget = :whisperreplytarget, spying = :spying, - ignoringdirectmessages = :ignoringdirectmessages; + ignoringdms = :ignoringdms; diff --git a/common/src/main/resources/queries/migrations/h2/V1__create_tables.sql b/common/src/main/resources/queries/migrations/h2/V1__create_tables.sql index c74f13ad..54172e56 100644 --- a/common/src/main/resources/queries/migrations/h2/V1__create_tables.sql +++ b/common/src/main/resources/queries/migrations/h2/V1__create_tables.sql @@ -7,7 +7,7 @@ CREATE TABLE carbon_users ( `lastwhispertarget` UUID, `whisperreplytarget` UUID, `spying` BOOLEAN, - `ignoringdirectmessages` BOOLEAN + `ignoringdms` BOOLEAN ); CREATE TABLE carbon_ignores ( diff --git a/common/src/main/resources/queries/migrations/mysql/V5__add_dmtoggle.sql b/common/src/main/resources/queries/migrations/mysql/V5__add_dmtoggle.sql index bc666317..f829f30a 100644 --- a/common/src/main/resources/queries/migrations/mysql/V5__add_dmtoggle.sql +++ b/common/src/main/resources/queries/migrations/mysql/V5__add_dmtoggle.sql @@ -1 +1 @@ -ALTER TABLE carbon_users ADD COLUMN ignoringdirectmessages BOOLEAN; +ALTER TABLE carbon_users ADD COLUMN ignoringdms BOOLEAN; diff --git a/common/src/main/resources/queries/migrations/postgresql/V5__add_dmtoggle.sql b/common/src/main/resources/queries/migrations/postgresql/V5__add_dmtoggle.sql index bc666317..f829f30a 100644 --- a/common/src/main/resources/queries/migrations/postgresql/V5__add_dmtoggle.sql +++ b/common/src/main/resources/queries/migrations/postgresql/V5__add_dmtoggle.sql @@ -1 +1 @@ -ALTER TABLE carbon_users ADD COLUMN ignoringdirectmessages BOOLEAN; +ALTER TABLE carbon_users ADD COLUMN ignoringdms BOOLEAN; diff --git a/common/src/main/resources/queries/select-player.sql b/common/src/main/resources/queries/select-player.sql index bd14b6e2..6a78e9e1 100644 --- a/common/src/main/resources/queries/select-player.sql +++ b/common/src/main/resources/queries/select-player.sql @@ -7,5 +7,5 @@ SELECT lastwhispertarget, whisperreplytarget, spying, - ignoringdirectmessages + ignoringdms FROM carbon_users WHERE (id = :id); diff --git a/common/src/main/resources/queries/update-player.sql b/common/src/main/resources/queries/update-player.sql index 2075f94b..b4bebdbf 100644 --- a/common/src/main/resources/queries/update-player.sql +++ b/common/src/main/resources/queries/update-player.sql @@ -7,4 +7,4 @@ UPDATE carbon_users SET lastwhispertarget = :lastwhispertarget, whisperreplytarget = :whisperreplytarget, spying = :spying, - ignoringdirectmessages = :ignoringdirectmessages; + ignoringdms = :ignoringdms;