mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-09-29 23:27:30 +02:00
Adds better checking for on-join commands
https://github.com/BentoBoxWorld/BSkyBlock/issues/315
This commit is contained in:
parent
61fe218a16
commit
e39db644b9
@ -718,12 +718,16 @@ public class IslandsManager {
|
||||
// Execute commands
|
||||
plugin.getIWM().getOnJoinCommands(world).forEach(command -> {
|
||||
command = command.replace("[player]", user.getName());
|
||||
if (command.startsWith("[SUDO]")) {
|
||||
if (command.startsWith("[SUDO]") && user.isOnline()) {
|
||||
// Execute the command by the player
|
||||
user.performCommand(command.substring(6));
|
||||
if (!user.performCommand(command.substring(6))) {
|
||||
plugin.logError("Could not execute join command for " + user.getName() + ": " + command.substring(6));
|
||||
}
|
||||
} else {
|
||||
// Otherwise execute as the server console
|
||||
plugin.getServer().dispatchCommand(Bukkit.getConsoleSender(), command);
|
||||
if (!plugin.getServer().dispatchCommand(Bukkit.getConsoleSender(), command)) {
|
||||
plugin.logError("Could not execute join command as console: " + command);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user