Commit b60fbcb1 authored by Moritz Sokoll's avatar Moritz Sokoll 🦀
Browse files

some kotlin adjustments

parent 9e36f930
Pipeline #112 failed with stage
in 29 seconds
......@@ -27,7 +27,7 @@ public class Loader : JavaPlugin(), Listener, CommandExecutor {
@EventHandler
public fun joinEvent(event: PlayerJoinEvent) {
event.joinMessage = "§2>>§7 " + event.player.displayName
var players = Bukkit.getOnlinePlayers()
val players = Bukkit.getOnlinePlayers()
for (p in players) {
event.player.sendMessage("Currently there are " + players.size + " players online!")
}
......@@ -52,19 +52,14 @@ public class Loader : JavaPlugin(), Listener, CommandExecutor {
}
"permissions" -> {
if (args.isEmpty()) {
for (perm in sender.effectivePermissions) {
sender.sendMessage(perm.permission)
}
}
else {
var name = args[0]
for (p in server.onlinePlayers) {
if (p.name == name) {
for (perm in p.effectivePermissions) {
sender.sendMessage(perm.permission)
}
}
sender.effectivePermissions.forEach {
sender.sendMessage(it.permission)
}
} else {
val name = args[0]
server.onlinePlayers
.filter { it.name == name }
.firstOrNull()?.effectivePermissions?.forEach { sender.sendMessage(it.permission) }
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment