mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-20 06:51:42 +00:00
24 lines
718 B
JavaScript
Executable file
24 lines
718 B
JavaScript
Executable file
module.exports.player = function (player, serv) {
|
|
player.commands.add({
|
|
base: 'weather',
|
|
info: 'Sets the weather.',
|
|
usage: '/weather <clear|rain>',
|
|
permission: "world.changeWeather",
|
|
parse (str) {
|
|
const args = str.split(' ')
|
|
if (args.length !== 1) { return false }
|
|
|
|
let condition = args[0]
|
|
if (['clear', 'rain'].indexOf(condition) === -1) { return false }
|
|
|
|
return { condition: condition }
|
|
},
|
|
action ({ condition }) {
|
|
if (condition === 'rain') {
|
|
serv._writeAll('game_state_change', { reason: 2, gameMode: 0 })
|
|
} else if (condition === 'clear') {
|
|
serv._writeAll('game_state_change', { reason: 1, gameMode: 0 })
|
|
}
|
|
}
|
|
})
|
|
}
|