mirror of
https://github.com/rockyhawk64/CommandPanels.git
synced 2025-11-18 07:14:17 +01:00
Server= allow custom permission checking.
Sound on open: allow volume and pitch.
This commit is contained in:
parent
66ee2346ac
commit
de26e2f8e9
@ -92,7 +92,13 @@ public class ExecuteOpenVoids {
|
||||
//play sound when panel is opened
|
||||
if(!Objects.requireNonNull(panel.getConfig().getString("sound-on-open")).equalsIgnoreCase("off")) {
|
||||
try {
|
||||
p.playSound(p.getLocation(), Sound.valueOf(Objects.requireNonNull(panel.getConfig().getString("sound-on-open")).toUpperCase()), 1F, 1F);
|
||||
String[] args = Objects.requireNonNull(panel.getConfig().getString("sound-on-open")).split(" ");
|
||||
if(args.length >= 3){
|
||||
//sound on open volume and pitch: sound-on-open: minecraft:villager 1.0 0.5
|
||||
p.playSound(p.getLocation(), Sound.valueOf(args[0].toUpperCase()), Float.parseFloat(args[1]), Float.parseFloat(args[2]));
|
||||
} else {
|
||||
p.playSound(p.getLocation(), Sound.valueOf(Objects.requireNonNull(panel.getConfig().getString("sound-on-open")).toUpperCase()), 1F, 1F);
|
||||
}
|
||||
} catch (Exception s) {
|
||||
p.sendMessage(plugin.tex.colour(plugin.tag + plugin.config.getString("config.format.error") + " " + "sound-on-open: " + panel.getConfig().getString("sound-on-open")));
|
||||
}
|
||||
|
||||
@ -30,7 +30,16 @@ public class BungeeTags implements Listener {
|
||||
e.commandTagUsed();
|
||||
Player player = Bukkit.getPlayerExact(e.p.getName());
|
||||
assert player != null;
|
||||
if (player.hasPermission("bungeecord.command.server." + e.args[0].toLowerCase())) {
|
||||
if(e.args.length >= 2){
|
||||
//This uses custom permission: server= servername permission
|
||||
if(player.hasPermission(e.args[1])){
|
||||
//this contacts bungee and tells it to send the server change command whilst checking for CUSTOM permissions
|
||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
out.writeUTF("Connect");
|
||||
out.writeUTF(e.args[0]);
|
||||
player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
|
||||
}
|
||||
}else if (player.hasPermission("bungeecord.command.server." + e.args[0].toLowerCase())) {
|
||||
//this contacts bungee and tells it to send the server change command whilst checking for permissions
|
||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
out.writeUTF("Connect");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user