Cleaner formatting

This commit is contained in:
Anuken
2020-05-03 21:18:25 -04:00
parent 45d8188ba4
commit becc23ca42
31 changed files with 183 additions and 183 deletions

View File

@@ -121,7 +121,7 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform
if(!finished){
drawLoading();
if(assets.update(1000 / loadingFPS)){
Log.info("Total time to load: {0}", Time.timeSinceMillis(beginTime));
Log.info("Total time to load: @", Time.timeSinceMillis(beginTime));
for(ApplicationListener listener : modules){
listener.init();
}

View File

@@ -88,9 +88,9 @@ public class ContentLoader{
Log.debug("--- CONTENT INFO ---");
for(int k = 0; k < contentMap.length; k++){
Log.debug("[{0}]: loaded {1}", ContentType.values()[k].name(), contentMap[k].size);
Log.debug("[@]: loaded @", ContentType.values()[k].name(), contentMap[k].size);
}
Log.debug("Total content loaded: {0}", Array.with(ContentType.values()).mapInt(c -> contentMap[c.ordinal()].size).sum());
Log.debug("Total content loaded: @", Array.with(ContentType.values()).mapInt(c -> contentMap[c.ordinal()].size).sum());
Log.debug("-------------------");
}

View File

@@ -53,7 +53,7 @@ public class NetClient implements ApplicationListener{
public NetClient(){
net.handleClient(Connect.class, packet -> {
Log.info("Connecting to server: {0}", packet.addressTCP);
Log.info("Connecting to server: @", packet.addressTCP);
player.admin(false);
@@ -115,7 +115,7 @@ public class NetClient implements ApplicationListener{
});
net.handleClient(WorldStream.class, data -> {
Log.info("Recieved world data: {0} bytes.", data.stream.available());
Log.info("Recieved world data: @ bytes.", data.stream.available());
NetworkIO.loadWorld(new InflaterInputStream(data.stream));
finishConnecting();
@@ -171,14 +171,14 @@ public class NetClient implements ApplicationListener{
}
//server console logging
Log.info("&y{0}: &lb{1}", player.name(), message);
Log.info("&y@: &lb@", player.name(), message);
//invoke event for all clients but also locally
//this is required so other clients get the correct name even if they don't know who's sending it yet
Call.sendMessage(message, colorizeName(player.id(), player.name()), player);
}else{
//log command to console but with brackets
Log.info("<&y{0}: &lm{1}&lg>", player.name(), message);
Log.info("<&y@: &lm@&lg>", player.name(), message);
//a command was sent, now get the output
if(response.type != ResponseType.valid){
@@ -401,7 +401,7 @@ public class NetClient implements ApplicationListener{
int pos = input.readInt();
Tile tile = world.tile(pos);
if(tile == null || tile.entity == null){
Log.warn("Missing entity at {0}. Skipping block snapshot.", tile);
Log.warn("Missing entity at @. Skipping block snapshot.", tile);
break;
}
tile.entity.readAll(Reads.get(input), tile.entity.version());

View File

@@ -159,7 +159,7 @@ public class NetServer implements ApplicationListener{
info.id = packet.uuid;
admins.save();
Call.onInfoMessage(con, "You are not whitelisted here.");
Log.info("&lcDo &lywhitelist-add {0}&lc to whitelist the player &lb'{1}'", packet.uuid, packet.name);
Log.info("&lcDo &lywhitelist-add @&lc to whitelist the player &lb'@'", packet.uuid, packet.name);
con.kick(KickReason.whitelist);
return;
}
@@ -243,11 +243,11 @@ public class NetServer implements ApplicationListener{
try{
RemoteReadServer.readPacket(packet.reader(), packet.type, con.player);
}catch(ValidateException e){
Log.debug("Validation failed for '{0}': {1}", e.player, e.getMessage());
Log.debug("Validation failed for '@': @", e.player, e.getMessage());
}catch(RuntimeException e){
if(e.getCause() instanceof ValidateException){
ValidateException v = (ValidateException)e.getCause();
Log.debug("Validation failed for '{0}': {1}", v.player, v.getMessage());
Log.debug("Validation failed for '@': @", v.player, v.getMessage());
}else{
throw e;
}
@@ -280,7 +280,7 @@ public class NetServer implements ApplicationListener{
}
StringBuilder result = new StringBuilder();
result.append(Strings.format("[orange]-- Commands Page[lightgray] {0}[gray]/[lightgray]{1}[orange] --\n\n", (page+1), pages));
result.append(Strings.format("[orange]-- Commands Page[lightgray] @[gray]/[lightgray]@[orange] --\n\n", (page+1), pages));
for(int i = commandsPerPage * page; i < Math.min(commandsPerPage * (page + 1), clientCommands.getCommandList().size); i++){
Command command = clientCommands.getCommandList().get(i);
@@ -312,7 +312,7 @@ public class NetServer implements ApplicationListener{
this.map = map;
this.task = Timer.schedule(() -> {
if(!checkPass()){
Call.sendMessage(Strings.format("[lightgray]Vote failed. Not enough votes to kick[orange] {0}[lightgray].", target.name()));
Call.sendMessage(Strings.format("[lightgray]Vote failed. Not enough votes to kick[orange] @[lightgray].", target.name()));
map[0] = null;
task.cancel();
}
@@ -323,13 +323,13 @@ public class NetServer implements ApplicationListener{
votes += d;
voted.addAll(player.uuid(), admins.getInfo(player.uuid()).lastIP);
Call.sendMessage(Strings.format("[orange]{0}[lightgray] has voted on kicking[orange] {1}[].[accent] ({2}/{3})\n[lightgray]Type[orange] /vote <y/n>[] to agree.",
Call.sendMessage(Strings.format("[orange]@[lightgray] has voted on kicking[orange] @[].[accent] (@/@)\n[lightgray]Type[orange] /vote <y/n>[] to agree.",
player.name(), target.name(), votes, votesRequired()));
}
boolean checkPass(){
if(votes >= votesRequired()){
Call.sendMessage(Strings.format("[orange]Vote passed.[scarlet] {0}[orange] will be banned from the server for {1} minutes.", target.name(), (kickDuration/60)));
Call.sendMessage(Strings.format("[orange]Vote passed.[scarlet] @[orange] will be banned from the server for @ minutes.", target.name(), (kickDuration/60)));
target.getInfo().lastKicked = Time.millis() + kickDuration*1000;
Groups.player.each(p -> p.uuid().equals(target.uuid()), p -> p.kick(KickReason.vote));
map[0] = null;
@@ -468,7 +468,7 @@ public class NetServer implements ApplicationListener{
data.stream = new ByteArrayInputStream(stream.toByteArray());
player.con().sendStream(data);
Log.debug("Packed {0} compressed bytes of world data.", stream.size());
Log.debug("Packed @ compressed bytes of world data.", stream.size());
}
public static void onDisconnect(Playerc player, String reason){
@@ -485,7 +485,7 @@ public class NetServer implements ApplicationListener{
Call.onPlayerDisconnect(player.id());
}
if(Config.showConnectMessages.bool()) Log.info("&lm[{1}] &lc{0} has disconnected. &lg&fi({2})", player.name(), player.uuid(), reason);
if(Config.showConnectMessages.bool()) Log.info("&lm[@] &lc@ has disconnected. &lg&fi(@)", player.uuid(), player.name(), reason);
}
player.remove();
@@ -607,13 +607,13 @@ public class NetServer implements ApplicationListener{
public static void onAdminRequest(Playerc player, Playerc other, AdminAction action){
if(!player.admin()){
Log.warn("ACCESS DENIED: Player {0} / {1} attempted to perform admin action without proper security access.",
Log.warn("ACCESS DENIED: Player @ / @ attempted to perform admin action without proper security access.",
player.name(), player.con().address);
return;
}
if(other == null || ((other.admin() && !player.isLocal()) && other != player)){
Log.warn("{0} attempted to perform admin action on nonexistant or admin player.", player.name());
Log.warn("@ attempted to perform admin action on nonexistant or admin player.", player.name());
return;
}
@@ -624,10 +624,10 @@ public class NetServer implements ApplicationListener{
}else if(action == AdminAction.ban){
netServer.admins.banPlayerIP(other.con().address);
other.kick(KickReason.banned);
Log.info("&lc{0} has banned {1}.", player.name(), other.name());
Log.info("&lc@ has banned @.", player.name(), other.name());
}else if(action == AdminAction.kick){
other.kick(KickReason.kick);
Log.info("&lc{0} has kicked {1}.", player.name(), other.name());
Log.info("&lc@ has kicked @.", player.name(), other.name());
}else if(action == AdminAction.trace){
TraceInfo info = new TraceInfo(other.con().address, other.uuid(), other.con().modclient, other.con().mobile);
if(player.con() != null){
@@ -635,7 +635,7 @@ public class NetServer implements ApplicationListener{
}else{
NetClient.onTraceInfo(other, info);
}
Log.info("&lc{0} has requested trace info of {1}.", player.name(), other.name());
Log.info("&lc@ has requested trace info of @.", player.name(), other.name());
}
}
@@ -647,7 +647,7 @@ public class NetServer implements ApplicationListener{
player.con().hasConnected = true;
if(Config.showConnectMessages.bool()){
Call.sendMessage("[accent]" + player.name() + "[accent] has connected.");
Log.info("&lm[{1}] &y{0} has connected. ", player.name(), player.uuid());
Log.info("&lm[@] &y@ has connected. ", player.uuid(), player.name());
}
if(!Config.motd.string().equalsIgnoreCase("off")){
@@ -692,7 +692,7 @@ public class NetServer implements ApplicationListener{
public void openServer(){
try{
net.host(Config.port.num());
info("&lcOpened a server on port {0}.", Config.port.num());
info("&lcOpened a server on port @.", Config.port.num());
}catch(BindException e){
Log.err("Unable to host: Port already in use! Make sure no other servers are running on the same port in your network.");
state.set(State.menu);

View File

@@ -105,7 +105,7 @@ public class Tutorial{
public enum TutorialStage{
intro(
line -> Strings.format(line, item(Items.copper), mineCopper),
line -> Core.bundle.format(line, item(Items.copper), mineCopper),
() -> item(Items.copper) >= mineCopper
),
drill(() -> placed(Blocks.mechanicalDrill, 1)){

View File

@@ -241,7 +241,7 @@ public class FloorRenderer implements Disposable{
}
}
Log.debug("Time to cache: {0}", Time.elapsed());
Log.debug("Time to cache: @", Time.elapsed());
}
@Override

View File

@@ -36,7 +36,7 @@ public class MenuRenderer implements Disposable{
Time.mark();
generate();
cache();
Log.info("Time to generate menu: {0}", Time.elapsed());
Log.info("Time to generate menu: @", Time.elapsed());
}
private void generate(){

View File

@@ -134,7 +134,7 @@ public class Maps{
loadMap(file, true);
}
}catch(Exception e){
Log.err("Failed to load custom map file '{0}'!", file);
Log.err("Failed to load custom map file '@'!", file);
Log.err(e);
}
}
@@ -146,7 +146,7 @@ public class Maps{
map.workshop = true;
map.tags.put("steamid", file.parent().name());
}catch(Exception e){
Log.err("Failed to load workshop map file '{0}'!", file);
Log.err("Failed to load workshop map file '@'!", file);
Log.err(e);
}
}
@@ -157,7 +157,7 @@ public class Maps{
Map map = loadMap(file, false);
map.mod = mod;
}catch(Exception e){
Log.err("Failed to load mod map file '{0}'!", file);
Log.err("Failed to load mod map file '@'!", file);
Log.err(e);
}
});

View File

@@ -561,7 +561,7 @@ public class ContentParser{
FieldMetadata metadata = fields.get(child.name().replace(" ", "_"));
if(metadata == null){
if(ignoreUnknownFields){
Log.warn("{0}: Ignoring unknown field: " + child.name + " (" + type.getName() + ")", object);
Log.warn("@: Ignoring unknown field: " + child.name + " (" + type.getName() + ")", object);
continue;
}else{
SerializationException ex = new SerializationException("Field not found: " + child.name + " (" + type.getName() + ")");

View File

@@ -107,11 +107,11 @@ public class Mods implements Loadable{
Array<Fi> overrides = mod.root.child("sprites-override").findAll(f -> f.extension().equals("png"));
packSprites(sprites, mod, true);
packSprites(overrides, mod, false);
Log.debug("Packed {0} images for mod '{1}'.", sprites.size + overrides.size, mod.meta.name);
Log.debug("Packed @ images for mod '@'.", sprites.size + overrides.size, mod.meta.name);
totalSprites += sprites.size + overrides.size;
});
Log.debug("Time to pack textures: {0}", Time.elapsed());
Log.debug("Time to pack textures: @", Time.elapsed());
}
private void loadIcons(){
@@ -136,7 +136,7 @@ public class Mods implements Loadable{
pixmap.dispose();
}catch(IOException e){
Core.app.post(() -> {
Log.err("Error packing images for mod: {0}", mod.meta.name);
Log.err("Error packing images for mod: @", mod.meta.name);
e.printStackTrace();
if(!headless) ui.showException(e);
});
@@ -182,12 +182,12 @@ public class Mods implements Loadable{
Core.atlas = packer.flush(filter, new TextureAtlas());
Core.atlas.setErrorRegion("error");
Log.debug("Total pages: {0}", Core.atlas.getTextures().size);
Log.debug("Total pages: @", Core.atlas.getTextures().size);
}
packer.dispose();
packer = null;
Log.debug("Time to update textures: {0}", Time.elapsed());
Log.debug("Time to update textures: @", Time.elapsed());
}
private PageType getPage(AtlasRegion region){
@@ -246,15 +246,15 @@ public class Mods implements Loadable{
for(Fi file : modDirectory.list()){
if(!file.extension().equals("jar") && !file.extension().equals("zip") && !(file.isDirectory() && (file.child("mod.json").exists() || file.child("mod.hjson").exists()))) continue;
Log.debug("[Mods] Loading mod {0}", file);
Log.debug("[Mods] Loading mod @", file);
try{
LoadedMod mod = loadMod(file);
mods.add(mod);
}catch(Throwable e){
if(e instanceof ClassNotFoundException && e.getMessage().contains("mindustry.plugin.Plugin")){
Log.info("Plugin {0} is outdated and needs to be ported to 6.0! Update its main class to inherit from 'mindustry.mod.Plugin'.");
Log.info("Plugin @ is outdated and needs to be ported to 6.0! Update its main class to inherit from 'mindustry.mod.Plugin'.");
}else{
Log.err("Failed to load mod file {0}. Skipping.", file);
Log.err("Failed to load mod file @. Skipping.", file);
Log.err(e);
}
}
@@ -267,7 +267,7 @@ public class Mods implements Loadable{
mods.add(mod);
mod.addSteamID(file.name());
}catch(Throwable e){
Log.err("Failed to load mod workshop file {0}. Skipping.", file);
Log.err("Failed to load mod workshop file @. Skipping.", file);
Log.err(e);
}
}
@@ -481,13 +481,13 @@ public class Mods implements Loadable{
scripts.run(mod, main);
}catch(Throwable e){
Core.app.post(() -> {
Log.err("Error loading main script {0} for mod {1}.", main.name(), mod.meta.name);
Log.err("Error loading main script @ for mod @.", main.name(), mod.meta.name);
e.printStackTrace();
});
}
}else{
Core.app.post(() -> {
Log.err("No main.js found for mod {0}.", mod.meta.name);
Log.err("No main.js found for mod @.", mod.meta.name);
});
}
}
@@ -496,7 +496,7 @@ public class Mods implements Loadable{
content.setCurrentMod(null);
}
Log.debug("Time to initialize modded scripts: {0}", Time.elapsed());
Log.debug("Time to initialize modded scripts: @", Time.elapsed());
}
/** Creates all the content found in mod files. */
@@ -544,7 +544,7 @@ public class Mods implements Loadable{
try{
//this binds the content but does not load it entirely
Content loaded = parser.parse(l.mod, l.file.nameWithoutExtension(), l.file.readString("UTF-8"), l.file, l.type);
Log.debug("[{0}] Loaded '{1}'.", l.mod.meta.name, (loaded instanceof UnlockableContent ? ((UnlockableContent)loaded).localizedName : loaded));
Log.debug("[@] Loaded '@'.", l.mod.meta.name, (loaded instanceof UnlockableContent ? ((UnlockableContent)loaded).localizedName : loaded));
}catch(Throwable e){
if(current != content.getLastAdded() && content.getLastAdded() != null){
parser.markError(content.getLastAdded(), l.mod, l.file, e);
@@ -624,7 +624,7 @@ public class Mods implements Loadable{
Fi metaf = zip.child("mod.json").exists() ? zip.child("mod.json") : zip.child("mod.hjson").exists() ? zip.child("mod.hjson") : zip.child("plugin.json");
if(!metaf.exists()){
Log.warn("Mod {0} doesn't have a 'mod.json'/'mod.hjson'/'plugin.json' file, skipping.", sourceFile);
Log.warn("Mod @ doesn't have a 'mod.json'/'mod.hjson'/'plugin.json' file, skipping.", sourceFile);
throw new IllegalArgumentException("No mod.json found.");
}

View File

@@ -41,7 +41,7 @@ public class Scripts implements Disposable{
if(!run(Core.files.internal("scripts/global.js").readString(), "global.js")){
errored = true;
}
Log.debug("Time to load script engine: {0}", Time.elapsed());
Log.debug("Time to load script engine: @", Time.elapsed());
}
public boolean hasErrored(){
@@ -73,7 +73,7 @@ public class Scripts implements Disposable{
}
public void log(LogLevel level, String source, String message){
Log.log(level, "[{0}]: {1}", source, message);
Log.log(level, "[@]: @", source, message);
}
public void run(LoadedMod mod, Fi file){

View File

@@ -85,7 +85,7 @@ public class ArcNetProvider implements NetProvider{
Connect c = new Connect();
c.addressTCP = ip;
Log.debug("&bRecieved connection: {0}", c.addressTCP);
Log.debug("&bRecieved connection: @", c.addressTCP);
connections.add(kn);
Core.app.post(() -> net.handleServerReceived(kn, c));

View File

@@ -113,7 +113,7 @@ public class BeControl{
dialog.show();
}, () -> checkUpdates = false);
}else{
Log.info("&lcA new update is available: &lyBleeding Edge build {0}", updateBuild);
Log.info("&lcA new update is available: &lyBleeding Edge build @", updateBuild);
if(Config.autoUpdate.bool()){
Log.info("&lcAuto-downloading next version...");
@@ -123,7 +123,7 @@ public class BeControl{
Fi dest = source.sibling("server-be-" + updateBuild + ".jar");
download(updateUrl, dest,
len -> Core.app.post(() -> Log.info("&ly| Size: {0} MB.", Strings.fixed((float)len / 1024 / 1024, 2))),
len -> Core.app.post(() -> Log.info("&ly| Size: @ MB.", Strings.fixed((float)len / 1024 / 1024, 2))),
progress -> {},
() -> false,
() -> Core.app.post(() -> {

View File

@@ -252,7 +252,7 @@ public class Net{
Pools.free(object);
}
}else{
Log.err("Unhandled packet type: '{0}'!", object);
Log.err("Unhandled packet type: '@'!", object);
}
}
@@ -266,7 +266,7 @@ public class Net{
serverListeners.get(object.getClass()).get(connection, object);
Pools.free(object);
}else{
Log.err("Unhandled packet type: '{0}'!", object.getClass());
Log.err("Unhandled packet type: '@'!", object.getClass());
}
}

View File

@@ -35,7 +35,7 @@ public abstract class NetConnection{
/** Kick with a special, localized reason. Use this if possible. */
public void kick(KickReason reason){
Log.info("Kicking connection {0}; Reason: {1}", address, reason.name());
Log.info("Kicking connection @; Reason: @", address, reason.name());
if((reason == KickReason.kick || reason == KickReason.banned || reason == KickReason.vote)){
PlayerInfo info = netServer.admins.getInfo(uuid);
@@ -57,7 +57,7 @@ public abstract class NetConnection{
/** Kick with an arbitrary reason, and a kick duration in milliseconds. */
public void kick(String reason, int kickDuration){
Log.info("Kicking connection {0}; Reason: {1}", address, reason.replace("\n", " "));
Log.info("Kicking connection @; Reason: @", address, reason.replace("\n", " "));
PlayerInfo info = netServer.admins.getInfo(uuid);
info.timesKicked++;

View File

@@ -433,7 +433,7 @@ public class JoinDialog extends FloatingDialog{
try{
defaultServers.clear();
val.asArray().each(child -> defaultServers.add(child.getString("address", "<invalid>")));
Log.info("Fetched {0} global servers.", defaultServers.size);
Log.info("Fetched @ global servers.", defaultServers.size);
}catch(Throwable ignored){}
});
}catch(Throwable ignored){}

View File

@@ -40,7 +40,7 @@ public class LanguageDialog extends FloatingDialog{
if(getLocale().equals(loc)) return;
Core.settings.put("locale", loc.toString());
Core.settings.save();
Log.info("Setting locale: {0}", loc.toString());
Log.info("Setting locale: @", loc.toString());
ui.showInfo("$language.restart");
});
langs.add(button).group(group).update(t -> t.setChecked(loc.equals(getLocale()))).size(400f, 50f).row();

View File

@@ -291,7 +291,7 @@ public class Block extends UnlockableContent{
}
public void setStats(){
stats.add(BlockStat.size, "{0}x{0}", size);
stats.add(BlockStat.size, "@x@", size, size);
stats.add(BlockStat.health, health, StatUnit.none);
if(isBuildable()){
stats.add(BlockStat.buildTime, buildCost / 60, StatUnit.seconds);