refactor: refactoring skeleton
This commit is contained in:
+11
-8
@@ -33,11 +33,14 @@ void RegCleanerCommand() {
|
||||
switch (param.action) {
|
||||
case CleanerParam::Action::clean: {
|
||||
Cleaner::CleanTask();
|
||||
if (Config->getValue<bool>({"Basic", "ConsoleLog"}, true)) {
|
||||
if (ConfigFile::mConsoleLog) {
|
||||
logger.info(tr("cleaner.output.opClean"));
|
||||
}
|
||||
if (Config->getValue<bool>({"Basic", "SendBroadcast"}, true)) {
|
||||
TextPacket::createRawMessage(tr("cleaner.info.prefix") + tr("cleaner.output.opClean")).sendToClients();
|
||||
if (ConfigFile::mAnnounce) {
|
||||
Helper::broadcastMessage(tr("cleaner.output.opClean"));
|
||||
}
|
||||
if (ConfigFile::mSendToast) {
|
||||
Helper::broadcastToast(tr("cleaner.output.opClean"));
|
||||
}
|
||||
return output.success(tr("cleaner.command.clean.output"));
|
||||
}
|
||||
@@ -61,19 +64,19 @@ void RegCleanerCommand() {
|
||||
.required("despawntime")
|
||||
.required("ticks")
|
||||
.execute<[&](CommandOrigin const& origin, CommandOutput& output, CleanerParam const& param) {
|
||||
item_despawn_time = param.ticks;
|
||||
Config->setValue({"ItemDespawn", "DespawnTime"}, item_despawn_time);
|
||||
return output.success(tr("cleaner.command.despawntime", {S(item_despawn_time)}));
|
||||
ConfigFile::mItemDespawnTicks = param.ticks;
|
||||
Config->setValue({"ItemDespawn", "DespawnTime"}, ConfigFile::mItemDespawnTicks);
|
||||
return output.success(tr("cleaner.command.despawntime", {S(ConfigFile::mItemDespawnTicks)}));
|
||||
}>();
|
||||
};
|
||||
|
||||
void RegisterCommands() {
|
||||
RegCleanerCommand();
|
||||
// RegVoteCommand(registry);
|
||||
// RegVoteCommand();
|
||||
}
|
||||
|
||||
/*
|
||||
void RegVoteCommand(CommandRegistry& registry) {
|
||||
void RegVoteCommand() {
|
||||
auto command = DynamicCommand::createCommand(registry, "voteclean", "Clean entities", CommandPermissionLevel::Any);
|
||||
command->addOverload();
|
||||
command->setCallback([](DynamicCommand const& cmd,
|
||||
|
||||
Reference in New Issue
Block a user