Skip to content

Commit 18ed322

Browse files
authored
Add permission bypass as config option (#3)
Signed-off-by: Pugzy <pugzy@mail.com>
1 parent 9730f95 commit 18ed322

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

src/main/java/tc/oc/occ/idly/IdlyConfig.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public class IdlyConfig {
1212
private int observerDelay;
1313
private int warningDuration;
1414
private int warningFrequency;
15+
private boolean bypassEnabled;
1516
private boolean requireMatchRunning;
1617
private boolean preciseMovement;
1718
private boolean movementCheck;
@@ -46,6 +47,10 @@ public int getWarningFrequency() {
4647
return warningFrequency;
4748
}
4849

50+
public boolean isBypassEnabled() {
51+
return bypassEnabled;
52+
}
53+
4954
public boolean isRequireMatchRunning() {
5055
return requireMatchRunning;
5156
}
@@ -73,6 +78,7 @@ public void reload(Configuration config) {
7378
this.observerDelay = config.getInt("observer-delay");
7479
this.warningDuration = config.getInt("warning-duration");
7580
this.warningFrequency = config.getInt("warning-frequency");
81+
this.bypassEnabled = config.getBoolean("bypass-enabled", true);
7682
this.requireMatchRunning = config.getBoolean("require-match-running");
7783
this.preciseMovement = config.getBoolean("precise-movement");
7884
this.movementCheck = config.getBoolean("checks.movement");

src/main/java/tc/oc/occ/idly/IdlyManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ private void checkPlayer(Player player, boolean isPlaying) {
5858
if (!config.isKickMode() && !isPlaying) return;
5959

6060
// Ignore those with the bypass permission
61-
if (player.hasPermission(IdlyPermissions.BYPASS)) return;
61+
if (config.isBypassEnabled() && player.hasPermission(IdlyPermissions.BYPASS)) return;
6262

6363
int duration = (isPlaying ? config.getParticipantDelay() : config.getObserverDelay());
6464
float remaining = duration - inactivity;

src/main/resources/config.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ observer-delay: 120
1717
warning-duration: 15
1818

1919
# Frequency between warning countdown messages (in seconds)
20-
warning-frequency: 5
20+
warning-frequency: 5
21+
22+
# Allow player bypass with 'idly.bypass' permission
23+
bypass-enabled: true
2124

2225
# Only check for inactivity when match is running
2326
require-match-running: true

0 commit comments

Comments
 (0)