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 {
|
plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
id 'com.github.johnrengelman.shadow' version '7.1.2'
|
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'
|
group 'ru.nanit'
|
||||||
version '1.5.2'
|
version '1.6'
|
||||||
|
|
||||||
compileJava {
|
compileJava {
|
||||||
options.encoding = "UTF-8"
|
options.encoding = "UTF-8"
|
||||||
@ -29,6 +32,13 @@ dependencies {
|
|||||||
implementation 'com.grack:nanojson:1.8'
|
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 {
|
shadowJar {
|
||||||
from 'LICENSE'
|
from 'LICENSE'
|
||||||
|
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package ua.nanit.limbo.server;
|
package ua.nanit.limbo.server;
|
||||||
|
|
||||||
import ua.nanit.limbo.server.commands.CmdConn;
|
import ua.nanit.limbo.server.commands.*;
|
||||||
import ua.nanit.limbo.server.commands.CmdHelp;
|
|
||||||
import ua.nanit.limbo.server.commands.CmdMem;
|
|
||||||
import ua.nanit.limbo.server.commands.CmdStop;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@ -19,8 +16,10 @@ public final class CommandManager extends Thread {
|
|||||||
return commands.get(name.toLowerCase());
|
return commands.get(name.toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void register(String name, Command cmd) {
|
public void register(Command cmd, String... aliases) {
|
||||||
commands.put(name.toLowerCase(), cmd);
|
for (String alias : aliases) {
|
||||||
|
commands.put(alias.toLowerCase(), cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -51,9 +50,10 @@ public final class CommandManager extends Thread {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void registerAll(LimboServer server) {
|
public void registerAll(LimboServer server) {
|
||||||
register("help", new CmdHelp(server));
|
register(new CmdHelp(server), "help");
|
||||||
register("conn", new CmdConn(server));
|
register(new CmdConn(server), "conn");
|
||||||
register("mem", new CmdMem());
|
register(new CmdMem(), "mem");
|
||||||
register("stop", new CmdStop());
|
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