Merge pull request #254 from TheLonelyWolf1/master

Added Config-Option to enable MiniMessage-CommandTag on Non-Paper forks + Warning
This commit is contained in:
RockyHawk 2023-03-30 16:47:13 +11:00 committed by GitHub
commit 978c745d00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 1 deletions

View File

@ -18,6 +18,8 @@ config:
stop-sound: true
disabled-world-message: true
panel-snooper: false
allow-unsafe-mini-message: false
disable-unsafe-mm-warning: false
format:
tag: '&6[&bCommandPanels&6] '
perms: '&cNo permission.'

View File

@ -272,6 +272,9 @@ public class CommandPanels extends JavaPlugin{
//get tag
tag = tex.colour(config.getString("config.format.tag"));
if(config.getBoolean("config.allow-unsafe-mini-message") && !config.getBoolean("config.disable-unsafe-mm-warning")){
Bukkit.getLogger().warning("[CommandPanels] Allow unsafe MiniMessage detected! Please proceed with caution as no support will be given for it!");
}
Bukkit.getLogger().info("[CommandPanels] RockyHawk's CommandPanels v" + this.getDescription().getVersion() + " Plugin Loaded!");
}

View File

@ -142,7 +142,13 @@ public class BasicTags implements Listener {
Component parsedText = SerializerUtils.serializeText(String.join(" ",e.args));
player.sendMessage(parsedText);
}else{
plugin.tex.sendString(e.p, plugin.tag + ChatColor.RED + "MiniMessage-Feature needs Paper 1.18 or newer to work!");
if(plugin.legacy.LOCAL_VERSION.greaterThanOrEqualTo(MinecraftVersions.v1_18) && plugin.config.getBoolean("config.allow-unsafe-mini-message")){
Audience player = (Audience) e.p; // Needed because the basic Player from the Event can't send Paper's Components
Component parsedText = SerializerUtils.serializeText(String.join(" ",e.args));
player.sendMessage(parsedText);
}else{
plugin.tex.sendString(e.p, plugin.tag + ChatColor.RED + "MiniMessage-Feature needs Paper 1.18 or newer to work!");
}
}
}
}