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

View File

@ -24,6 +24,7 @@ public class MindustryServer extends ModuleCore{
headless = true; headless = true;
BundleLoader.load(); BundleLoader.load();
content.verbose(false);
content.load(); content.load();
content.initialize(Content::init); 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.Command;
import io.anuke.ucore.util.CommandHandler.Response; import io.anuke.ucore.util.CommandHandler.Response;
import io.anuke.ucore.util.CommandHandler.ResponseType; import io.anuke.ucore.util.CommandHandler.ResponseType;
import io.anuke.ucore.util.Log;
import io.anuke.ucore.util.Strings; import io.anuke.ucore.util.Strings;
import java.io.IOException; 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 java.util.Scanner;
import static io.anuke.mindustry.Vars.*; import static io.anuke.mindustry.Vars.*;
@ -61,18 +62,22 @@ public class ServerControl extends Module{
Log.setLogger(new LogHandler(){ Log.setLogger(new LogHandler(){
DateTimeFormatter dateTime = DateTimeFormatter.ofPattern("MM-dd-yyyy | HH:mm:ss"); DateTimeFormatter dateTime = DateTimeFormatter.ofPattern("MM-dd-yyyy | HH:mm:ss");
@Override
public void info(String text, Object... args){ 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){ 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){ 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){ public void print(String text, Object... args){
System.out.println("[" + dateTime.format(LocalDateTime.now()) + "] " + format(text + "&fr", 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."); info("&lcServer loaded. Type &ly'help'&lc for help.");
System.out.print("> ");
} }
private void registerCommands(){ private void registerCommands(){
@ -242,7 +248,7 @@ public class ServerControl extends Module{
logic.play(); logic.play();
}else{ }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); playSectorMap(false);
} }
@ -621,9 +627,9 @@ public class ServerControl extends Module{
} }
private void readCommands(){ private void readCommands(){
Scanner scan = new Scanner(System.in); Scanner scan = new Scanner(System.in);
while(scan.hasNext()){ while(scan.hasNext()){
System.out.print("> ");
String line = scan.nextLine(); String line = scan.nextLine();
Gdx.app.postRunnable(() -> { Gdx.app.postRunnable(() -> {
@ -652,6 +658,8 @@ public class ServerControl extends Module{
}else if(response.type == ResponseType.manyArguments){ }else if(response.type == ResponseType.manyArguments){
err("Too many command arguments. Usage: " + response.command.text + " " + response.command.paramText); err("Too many command arguments. Usage: " + response.command.text + " " + response.command.paramText);
} }
System.out.print("> ");
}); });
} }
} }