Added mod displayName property [for color tags, etc]
This commit is contained in:
@@ -1,49 +0,0 @@
|
||||
package io.anuke.mindustry.server;
|
||||
|
||||
import io.anuke.arc.*;
|
||||
import io.anuke.arc.files.*;
|
||||
import io.anuke.arc.util.*;
|
||||
import io.anuke.mindustry.*;
|
||||
import io.anuke.mindustry.core.*;
|
||||
import io.anuke.mindustry.mod.*;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class MindustryServer implements ApplicationListener{
|
||||
private String[] args;
|
||||
|
||||
public MindustryServer(String[] args){
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(){
|
||||
Core.settings.setDataDirectory(Core.files.local("config"));
|
||||
loadLocales = false;
|
||||
headless = true;
|
||||
|
||||
FileHandle plugins = Core.settings.getDataDirectory().child("plugins");
|
||||
if(plugins.isDirectory() && plugins.list().length > 0 && !plugins.sibling("mods").exists()){
|
||||
Log.warn("[IMPORTANT NOTICE] &lrPlugins have been detected.&ly Automatically moving all contents of the plugin folder into the 'mods' folder. The original folder will not be removed; please do so manually.");
|
||||
plugins.sibling("mods").mkdirs();
|
||||
for(FileHandle file : plugins.list()){
|
||||
file.copyTo(plugins.sibling("mods"));
|
||||
}
|
||||
}
|
||||
|
||||
Vars.loadSettings();
|
||||
Vars.init();
|
||||
content.createBaseContent();
|
||||
mods.loadScripts();
|
||||
content.createModContent();
|
||||
content.init();
|
||||
|
||||
Core.app.addListener(logic = new Logic());
|
||||
Core.app.addListener(netServer = new NetServer());
|
||||
Core.app.addListener(new ServerControl(args));
|
||||
|
||||
mods.each(Mod::init);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -336,7 +336,7 @@ public class ServerControl implements ApplicationListener{
|
||||
if(!mods.all().isEmpty()){
|
||||
info("Mods:");
|
||||
for(LoadedMod mod : mods.all()){
|
||||
info(" &ly{0} &lcv{1}", mod.meta.name, mod.meta.version);
|
||||
info(" &ly{0} &lcv{1}", mod.meta.displayName(), mod.meta.version);
|
||||
}
|
||||
}else{
|
||||
info("No mods found.");
|
||||
@@ -347,7 +347,8 @@ public class ServerControl implements ApplicationListener{
|
||||
handler.register("mod", "<name...>", "Display information about a loaded plugin.", arg -> {
|
||||
LoadedMod mod = mods.all().find(p -> p.meta.name.equalsIgnoreCase(arg[0]));
|
||||
if(mod != null){
|
||||
info("Name: &ly{0}", mod.meta.name);
|
||||
info("Name: &ly{0}", mod.meta.displayName());
|
||||
info("Internal Name: &ly{0}", mod.name);
|
||||
info("Version: &ly{0}", mod.meta.version);
|
||||
info("Author: &ly{0}", mod.meta.author);
|
||||
info("Path: &ly{0}", mod.file.path());
|
||||
|
||||
@@ -1,22 +1,58 @@
|
||||
package io.anuke.mindustry.server;
|
||||
|
||||
|
||||
import io.anuke.arc.*;
|
||||
import io.anuke.arc.backends.headless.*;
|
||||
import io.anuke.arc.files.*;
|
||||
import io.anuke.arc.util.*;
|
||||
import io.anuke.mindustry.*;
|
||||
import io.anuke.mindustry.core.*;
|
||||
import io.anuke.mindustry.mod.*;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.net.*;
|
||||
|
||||
import static io.anuke.mindustry.Vars.platform;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class ServerLauncher{
|
||||
public class ServerLauncher implements ApplicationListener{
|
||||
static String[] args;
|
||||
|
||||
public static void main(String[] args){
|
||||
try{
|
||||
ServerLauncher.args = args;
|
||||
Vars.platform = new Platform(){};
|
||||
Vars.net = new Net(platform.getNet());
|
||||
new HeadlessApplication(new MindustryServer(args), null, throwable -> CrashSender.send(throwable, f -> {}));
|
||||
new HeadlessApplication(new ServerLauncher(), null, throwable -> CrashSender.send(throwable, f -> {}));
|
||||
}catch(Throwable t){
|
||||
CrashSender.send(t, f -> {});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(){
|
||||
Core.settings.setDataDirectory(Core.files.local("config"));
|
||||
loadLocales = false;
|
||||
headless = true;
|
||||
|
||||
FileHandle plugins = Core.settings.getDataDirectory().child("plugins");
|
||||
if(plugins.isDirectory() && plugins.list().length > 0 && !plugins.sibling("mods").exists()){
|
||||
Log.warn("[IMPORTANT NOTICE] &lrPlugins have been detected.&ly Automatically moving all contents of the plugin folder into the 'mods' folder. The original folder will not be removed; please do so manually.");
|
||||
plugins.sibling("mods").mkdirs();
|
||||
for(FileHandle file : plugins.list()){
|
||||
file.copyTo(plugins.sibling("mods"));
|
||||
}
|
||||
}
|
||||
|
||||
Vars.loadSettings();
|
||||
Vars.init();
|
||||
content.createBaseContent();
|
||||
mods.loadScripts();
|
||||
content.createModContent();
|
||||
content.init();
|
||||
|
||||
Core.app.addListener(logic = new Logic());
|
||||
Core.app.addListener(netServer = new NetServer());
|
||||
Core.app.addListener(new ServerControl(args));
|
||||
|
||||
mods.each(Mod::init);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user