Skip to content

Commit

Permalink
Add a packet interception config setting
Browse files Browse the repository at this point in the history
  • Loading branch information
Morphan1 committed Sep 19, 2016
1 parent d382093 commit 55745f6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
6 changes: 4 additions & 2 deletions plugin/src/main/java/net/aufdemrand/denizen/Denizen.java
Expand Up @@ -862,8 +862,10 @@ public void onEnable() {
dB.echoError(e);
}

// Enable custom inbound packet listener
DenizenPacketListener.enable();
if (Settings.packetInterception()) {
// Enable custom inbound packet listener
DenizenPacketListener.enable();
}

// Run everything else on the first server tick
getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
Expand Down
5 changes: 5 additions & 0 deletions plugin/src/main/java/net/aufdemrand/denizen/Settings.java
Expand Up @@ -425,4 +425,9 @@ public static int tagTimeout() {
return DenizenAPI.getCurrentInstance().getConfig()
.getInt("Tags.Timeout", 10);
}

public static boolean packetInterception() {
return DenizenAPI.getCurrentInstance().getConfig()
.getBoolean("Packets.Interception", true);
}
}
9 changes: 8 additions & 1 deletion plugin/src/main/resources/config.yml
Expand Up @@ -139,7 +139,14 @@ Tags:
# How many player messages will be stored for each player (<player.chat_history>, etc.)
Max messages: 10

Packets:
# Whether to allow Denizen to intercept packets from and to player clients.
# This enables access to certain ScriptEvents, such as PlayerSteers and PlayerReceivesMessage.
# It also enables hiding item script IDs and most likely has no real reason to be disabled.
# Note that changing this setting requires a full server restart.
Interception: true

# The version of this configuration file, used to check if your
# configuration file is outdated or too new
Config:
Version: 13
Version: 14

0 comments on commit 55745f6

Please sign in to comment.