refactor(command): ♻️ make toss exit early if non-existent block
This commit is contained in:
parent
5b4718fa5d
commit
ba7c53be0c
|
@ -431,13 +431,13 @@ function command(username, message) {
|
|||
case "toss":
|
||||
case "drop":
|
||||
if (!message_parts[1]) { return false } // FIXME, works but ugly
|
||||
// TODO use cfg.plugins.inventory.itemByName
|
||||
const item = cfg.plugins.inventory.itemByName(message_parts[1])
|
||||
if (!mcData.findItemOrBlockByName(message_parts[1])) {
|
||||
console.log("doesn't exist:", message_parts[1])
|
||||
cfg.quiet || bot.chat(`item doesn't exist: ${message_parts[1]}`)
|
||||
return false
|
||||
} else if (!item) {
|
||||
}
|
||||
const item = cfg.plugins.inventory.itemByName(message_parts[1])
|
||||
if (!item) {
|
||||
console.log("don't have:", message_parts[1])
|
||||
cfg.quiet || bot.chat(`don't have item: ${message_parts[1]}`)
|
||||
return false
|
||||
|
|
Loading…
Reference in New Issue
Block a user