Removed useless content logging, >

This commit is contained in:
Anuken 2018-10-28 18:17:46 -04:00
parent 32f9da0724
commit eb20ec1556
3 changed files with 29 additions and 13 deletions

View File

@ -35,6 +35,7 @@ import io.anuke.ucore.util.ThreadArray;
@SuppressWarnings("unchecked")
public class ContentLoader{
private boolean loaded = false;
private boolean verbose = true;
private ObjectMap<String, MappableContent>[] contentNameMap = new ObjectMap[ContentType.values().length];
private Array<Content>[] contentMap = new Array[ContentType.values().length];
@ -152,12 +153,14 @@ public class ContentLoader{
throw new ImpendingDoomException("THE TIME HAS COME. More than 256 blocks have been created.");
}
Log.info("--- CONTENT INFO ---");
for(int k = 0; k < contentMap.length; k ++){
Log.info("[{0}]: loaded {1}", ContentType.values()[k].name(), contentMap[k].size);
if(verbose){
Log.info("--- CONTENT INFO ---");
for(int k = 0; k < contentMap.length; k++){
Log.info("[{0}]: loaded {1}", ContentType.values()[k].name(), contentMap[k].size);
}
Log.info("Total content loaded: {0}", total);
Log.info("-------------------");
}
Log.info("Total content loaded: {0}", total);
Log.info("-------------------");
loaded = true;
}
@ -175,6 +178,10 @@ public class ContentLoader{
initialization.add(callable);
}
public void verbose(boolean verbose){
this.verbose = verbose;
}
public void dispose(){
//clear all content, currently not needed
}

View File

@ -24,6 +24,7 @@ public class MindustryServer extends ModuleCore{
headless = true;
BundleLoader.load();
content.verbose(false);
content.load();
content.initialize(Content::init);

View File

@ -28,11 +28,12 @@ import io.anuke.ucore.util.CommandHandler;
import io.anuke.ucore.util.CommandHandler.Command;
import io.anuke.ucore.util.CommandHandler.Response;
import io.anuke.ucore.util.CommandHandler.ResponseType;
import io.anuke.ucore.util.Log;
import io.anuke.ucore.util.Strings;
import java.io.IOException;
import java.time.format.DateTimeFormatter;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Scanner;
import static io.anuke.mindustry.Vars.*;
@ -61,18 +62,22 @@ public class ServerControl extends Module{
Log.setLogger(new LogHandler(){
DateTimeFormatter dateTime = DateTimeFormatter.ofPattern("MM-dd-yyyy | HH:mm:ss");
@Override
public void info(String text, Object... args){
print("&lg&fb" + "[ INFO ] " + format(text, args));
print("&lg&fb" + "[INFO] " + format(text, args));
}
@Override
public void err(String text, Object... args){
print("&lr&fb" + "[ ERR! ] " + format(text, args));
print("&lr&fb" + "[ERR!] " + format(text, args));
}
@Override
public void warn(String text, Object... args){
print("&ly&fb" + "[ WARN ] " + format(text, args));
print("&ly&fb" + "[WARN] " + format(text, args));
}
@Override
public void print(String text, Object... args){
System.out.println("[" + dateTime.format(LocalDateTime.now()) + "] " + format(text + "&fr", args));
}
@ -172,6 +177,7 @@ public class ServerControl extends Module{
});
info("&lcServer loaded. Type &ly'help'&lc for help.");
System.out.print("> ");
}
private void registerCommands(){
@ -242,7 +248,7 @@ public class ServerControl extends Module{
logic.play();
}else{
info("&ly&fiNo map specified. Loading sector {0}, {1}.", Settings.getInt("sector_x"), Settings.getInt("sector_y"));
info("&fiNo map specified. Loading sector {0}, {1}.", Settings.getInt("sector_x"), Settings.getInt("sector_y"));
playSectorMap(false);
}
@ -621,9 +627,9 @@ public class ServerControl extends Module{
}
private void readCommands(){
Scanner scan = new Scanner(System.in);
while(scan.hasNext()){
System.out.print("> ");
String line = scan.nextLine();
Gdx.app.postRunnable(() -> {
@ -652,6 +658,8 @@ public class ServerControl extends Module{
}else if(response.type == ResponseType.manyArguments){
err("Too many command arguments. Usage: " + response.command.text + " " + response.command.paramText);
}
System.out.print("> ");
});
}
}