diff --git a/src/main/java/com/technicjelle/bluemapchatmarkers/BlueMapChatMarkers.java b/src/main/java/com/technicjelle/bluemapchatmarkers/BlueMapChatMarkers.java index 0a8411b..23bb1a7 100644 --- a/src/main/java/com/technicjelle/bluemapchatmarkers/BlueMapChatMarkers.java +++ b/src/main/java/com/technicjelle/bluemapchatmarkers/BlueMapChatMarkers.java @@ -16,6 +16,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.event.EventPriority; import java.io.IOException; import java.util.function.Consumer; @@ -51,8 +52,9 @@ public void onEnable() { } }; - @EventHandler + @EventHandler(priority = EventPriority.MONITOR) public void onPlayerChat(AsyncPlayerChatEvent event) { + if (event.isCancelled() && !config.forceful) return; BlueMapAPI api = BlueMapAPI.getInstance().orElse(null); if (api == null) return; //BlueMap not loaded, ignore diff --git a/src/main/java/com/technicjelle/bluemapchatmarkers/Config.java b/src/main/java/com/technicjelle/bluemapchatmarkers/Config.java index 0f65532..8ebd3a7 100644 --- a/src/main/java/com/technicjelle/bluemapchatmarkers/Config.java +++ b/src/main/java/com/technicjelle/bluemapchatmarkers/Config.java @@ -13,6 +13,7 @@ public class Config { public String markerSetName; public boolean toggleable; public boolean defaultHidden; + public boolean forceful; public long markerDuration; public Config(BlueMapChatMarkers plugin) { @@ -28,10 +29,11 @@ public Config(BlueMapChatMarkers plugin) { plugin.reloadConfig(); //Load config values into variables - markerSetName = configFile().getString("MarkerSetName"); - toggleable = configFile().getBoolean("Toggleable"); - defaultHidden = configFile().getBoolean("DefaultHidden"); - markerDuration = configFile().getLong("MarkerDuration"); + markerSetName = configFile().getString("MarkerSetName", "Chat Messages"); + toggleable = configFile().getBoolean("Toggleable", true); + defaultHidden = configFile().getBoolean("DefaultHidden", false); + markerDuration = configFile().getLong("MarkerDuration", 60); + forceful = configFile().getBoolean("Forceful", false); } private FileConfiguration configFile() { diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 6d4e57f..bc90e00 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -6,3 +6,7 @@ DefaultHidden: false # Amount of time a chat marker stays on the map (in seconds) MarkerDuration: 60 + +# Set this to `true` if you have other chat management plugins that are cancelling the chat event +# before it gets registered with this plugin +Forceful: false