mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 14:38:48 +00:00
Disable spy when permission's removed
This commit is contained in:
1 parent
503bdcc4db
commit
a3b41f103b
3 files changed
+27
-1
No files matched your search
@@ -108,6 +108,12 @@ public class PrimaryConfig {
|
||||
@Comment("Settings for the clear chat command")
|
||||
private ClearChatSettings clearChatSettings = new ClearChatSettings();
|
||||
|
||||
@Comment("Disables spying when the user doesn't have spy permissions")
|
||||
private boolean spyPermissionRequired = true;
|
||||
|
||||
@Comment("Alerts the user when they can no longer spy due to lacking permissions")
|
||||
private boolean spyDisabledMessage = false;
|
||||
|
||||
@Comment("Settings for integrations with other plugins/mods. Settings only apply when the relevant plugin/mod is present.")
|
||||
private IntegrationConfigContainer integrations;
|
||||
|
||||
@@ -202,6 +208,14 @@ public class PrimaryConfig {
|
||||
return this.clearChatSettings;
|
||||
}
|
||||
|
||||
public boolean spyPermissionRequired() {
|
||||
return this.spyPermissionRequired;
|
||||
}
|
||||
|
||||
public boolean spyDisabledMessage() {
|
||||
return this.spyDisabledMessage;
|
||||
}
|
||||
|
||||
public IntegrationConfigContainer integrations() {
|
||||
return this.integrations;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ import net.draycia.carbon.api.util.InventorySlot;
|
||||
import net.draycia.carbon.common.PlatformScheduler;
|
||||
import net.draycia.carbon.common.config.ConfigManager;
|
||||
import net.draycia.carbon.common.messages.CarbonMessageRenderer;
|
||||
import net.draycia.carbon.common.messages.CarbonMessages;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.audience.ForwardingAudience;
|
||||
import net.kyori.adventure.identity.Identity;
|
||||
@@ -60,6 +61,7 @@ public class CarbonPlayerCommon implements CarbonPlayer, ForwardingAudience.Sing
|
||||
private transient @MonotonicNonNull @Inject ConfigManager config;
|
||||
private transient @MonotonicNonNull @Inject CarbonMessageRenderer messageRenderer;
|
||||
private transient @MonotonicNonNull @Inject UserManagerInternal<?> users;
|
||||
private transient @MonotonicNonNull @Inject CarbonMessages messages;
|
||||
private volatile transient long transientLoadedSince = -1;
|
||||
|
||||
protected final PersistentUserProperty<Boolean> muted;
|
||||
@@ -500,6 +502,10 @@ public class CarbonPlayerCommon implements CarbonPlayer, ForwardingAudience.Sing
|
||||
return this.messageRenderer;
|
||||
}
|
||||
|
||||
public CarbonMessages carbonMessages() {
|
||||
return this.messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID uuid() {
|
||||
return this.uuid;
|
||||
|
||||
@@ -304,7 +304,13 @@ public abstract class WrappedCarbonPlayer implements CarbonPlayer {
|
||||
|
||||
@Override
|
||||
public boolean spying() {
|
||||
if (this.online() && !this.hasPermission("carbon.spy")) {
|
||||
if (this.carbonPlayerCommon.configManager().primaryConfig().spyPermissionRequired() &&
|
||||
this.online() && !this.hasPermission("carbon.spy")) {
|
||||
|
||||
this.spying(false);
|
||||
if (this.carbonPlayerCommon.configManager().primaryConfig().spyDisabledMessage()) {
|
||||
this.carbonPlayerCommon.carbonMessages().commandSpyDisabled(this);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user