mirror of
https://github.com/Nan1t/NanoLimbo.git
synced 2025-07-09 11:30:13 +02:00
Added generated version constant for 'version' command
This commit is contained in:
parent
dceb977a75
commit
7309ca3b41
12
build.gradle
12
build.gradle
@ -1,10 +1,13 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'com.github.johnrengelman.shadow' version '7.1.2'
|
||||
id 'com.github.gmazzo.buildconfig' version '3.1.0'
|
||||
}
|
||||
|
||||
//def limboVersion = '1.6'
|
||||
|
||||
group 'ru.nanit'
|
||||
version '1.5.2'
|
||||
version '1.6'
|
||||
|
||||
compileJava {
|
||||
options.encoding = "UTF-8"
|
||||
@ -29,6 +32,13 @@ dependencies {
|
||||
implementation 'com.grack:nanojson:1.8'
|
||||
}
|
||||
|
||||
buildConfig {
|
||||
className("BuildConfig") // forces the class name. Defaults to 'BuildConfig'
|
||||
packageName("ua.nanit.limbo")
|
||||
|
||||
buildConfigField('String', 'LIMBO_VERSION', "\"${project.version}\"")
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
from 'LICENSE'
|
||||
|
||||
|
@ -1,9 +1,6 @@
|
||||
package ua.nanit.limbo.server;
|
||||
|
||||
import ua.nanit.limbo.server.commands.CmdConn;
|
||||
import ua.nanit.limbo.server.commands.CmdHelp;
|
||||
import ua.nanit.limbo.server.commands.CmdMem;
|
||||
import ua.nanit.limbo.server.commands.CmdStop;
|
||||
import ua.nanit.limbo.server.commands.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@ -19,8 +16,10 @@ public final class CommandManager extends Thread {
|
||||
return commands.get(name.toLowerCase());
|
||||
}
|
||||
|
||||
public void register(String name, Command cmd) {
|
||||
commands.put(name.toLowerCase(), cmd);
|
||||
public void register(Command cmd, String... aliases) {
|
||||
for (String alias : aliases) {
|
||||
commands.put(alias.toLowerCase(), cmd);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -51,9 +50,10 @@ public final class CommandManager extends Thread {
|
||||
}
|
||||
|
||||
public void registerAll(LimboServer server) {
|
||||
register("help", new CmdHelp(server));
|
||||
register("conn", new CmdConn(server));
|
||||
register("mem", new CmdMem());
|
||||
register("stop", new CmdStop());
|
||||
register(new CmdHelp(server), "help");
|
||||
register(new CmdConn(server), "conn");
|
||||
register(new CmdMem(), "mem");
|
||||
register(new CmdStop(), "stop");
|
||||
register(new CmdVersion(), "version", "ver");
|
||||
}
|
||||
}
|
||||
|
18
src/main/java/ua/nanit/limbo/server/commands/CmdVersion.java
Normal file
18
src/main/java/ua/nanit/limbo/server/commands/CmdVersion.java
Normal file
@ -0,0 +1,18 @@
|
||||
package ua.nanit.limbo.server.commands;
|
||||
|
||||
import ua.nanit.limbo.server.Command;
|
||||
import ua.nanit.limbo.server.Logger;
|
||||
import ua.nanit.limbo.BuildConfig;
|
||||
|
||||
public class CmdVersion implements Command {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
Logger.info("Version: %s", BuildConfig.LIMBO_VERSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "Display limbo version";
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user