Fixed forceopen not being able to be run by console
This commit is contained in:
@@ -13,20 +13,20 @@ class CommandForceOpen(plugin: EcoPlugin) : Subcommand(
|
|||||||
plugin,
|
plugin,
|
||||||
"forceopen",
|
"forceopen",
|
||||||
"ecocrates.command.forceopen",
|
"ecocrates.command.forceopen",
|
||||||
true
|
false
|
||||||
) {
|
) {
|
||||||
override fun onExecute(sender: CommandSender, args: List<String>) {
|
override fun onExecute(sender: CommandSender, args: List<String>) {
|
||||||
var player: Player = sender as Player
|
var player = sender
|
||||||
|
|
||||||
if (args.isEmpty()) {
|
if (args.isEmpty()) {
|
||||||
player.sendMessage(plugin.langYml.getMessage("must-specify-crate"))
|
sender.sendMessage(plugin.langYml.getMessage("must-specify-crate"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val crate = Crates.getByID(args[0])
|
val crate = Crates.getByID(args[0])
|
||||||
|
|
||||||
if (crate == null) {
|
if (crate == null) {
|
||||||
player.sendMessage(plugin.langYml.getMessage("invalid-crate"))
|
sender.sendMessage(plugin.langYml.getMessage("invalid-crate"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,8 +40,9 @@ class CommandForceOpen(plugin: EcoPlugin) : Subcommand(
|
|||||||
|
|
||||||
player = specificPlayer
|
player = specificPlayer
|
||||||
}
|
}
|
||||||
|
if (player is Player) {
|
||||||
crate.open(player, OpenMethod.OTHER)
|
crate.open(player, OpenMethod.OTHER)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun tabComplete(sender: CommandSender, args: List<String>): List<String> {
|
override fun tabComplete(sender: CommandSender, args: List<String>): List<String> {
|
||||||
|
|||||||
Reference in New Issue
Block a user