Source reformat

This commit is contained in:
Anuken
2019-04-08 09:03:18 -04:00
parent 4a96b9bb00
commit b40beb0d1d
331 changed files with 2822 additions and 3274 deletions

View File

@@ -12,9 +12,7 @@ import io.anuke.mindustry.net.Net;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@@ -55,7 +53,7 @@ public class CrashHandler{
try{
Path path = Paths.get(OS.getAppDataDirectoryString(Vars.appName), "crashes",
"crash-report-" + DateTimeFormatter.ofPattern("MM-dd-yyyy-HH:mm:ss").format(LocalDateTime.now()) + ".txt");
"crash-report-" + DateTimeFormatter.ofPattern("MM-dd-yyyy-HH:mm:ss").format(LocalDateTime.now()) + ".txt");
Files.createDirectories(Paths.get(OS.getAppDataDirectoryString(Vars.appName), "crashes"));
Files.write(path, parseException(e).getBytes());
@@ -70,7 +68,10 @@ public class CrashHandler{
Net.http(Vars.crashReportURL, "POST", value.toJson(OutputType.json), r -> System.exit(1), t -> System.exit(1));
//sleep forever
try{ Thread.sleep(Long.MAX_VALUE); }catch(InterruptedException ignored){}
try{
Thread.sleep(Long.MAX_VALUE);
}catch(InterruptedException ignored){
}
}
private static String parseException(Throwable e){

View File

@@ -3,9 +3,7 @@ package io.anuke.mindustry.server;
import io.anuke.arc.ApplicationListener;
import io.anuke.arc.Core;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.core.Logic;
import io.anuke.mindustry.core.NetServer;
import io.anuke.mindustry.core.World;
import io.anuke.mindustry.core.*;
import io.anuke.mindustry.game.Content;
import io.anuke.mindustry.io.BundleLoader;

View File

@@ -1,16 +1,12 @@
package io.anuke.mindustry.server;
import io.anuke.arc.ApplicationListener;
import io.anuke.arc.Core;
import io.anuke.arc.Events;
import io.anuke.arc.*;
import io.anuke.arc.collection.Array;
import io.anuke.arc.collection.Array.ArrayIterable;
import io.anuke.arc.collection.ObjectSet;
import io.anuke.arc.files.FileHandle;
import io.anuke.arc.util.*;
import io.anuke.arc.util.CommandHandler.Command;
import io.anuke.arc.util.CommandHandler.Response;
import io.anuke.arc.util.CommandHandler.ResponseType;
import io.anuke.arc.util.CommandHandler.*;
import io.anuke.arc.util.Timer.Task;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.entities.Effects;
@@ -50,13 +46,13 @@ public class ServerControl implements ApplicationListener{
public ServerControl(String[] args){
Core.settings.defaults(
"shufflemode", "normal",
"bans", "",
"admins", "",
"shuffle", true,
"crashreport", false,
"port", port,
"logging", true
"shufflemode", "normal",
"bans", "",
"admins", "",
"shuffle", true,
"crashreport", false,
"port", port,
"logging", true
);
Log.setLogger(new LogHandler(){
@@ -94,8 +90,10 @@ public class ServerControl implements ApplicationListener{
});
Time.setDeltaProvider(() -> Core.graphics.getDeltaTime() * 60f);
Effects.setScreenShakeProvider((a, b) -> {});
Effects.setEffectProvider((a, b, c, d, e, f) -> {});
Effects.setScreenShakeProvider((a, b) -> {
});
Effects.setEffectProvider((a, b, c, d, e, f) -> {
});
registerCommands();
@@ -144,8 +142,8 @@ public class ServerControl implements ApplicationListener{
Call.onInfoMessage((state.rules.pvp
? "[YELLOW]The " + event.winner.name() + " team is victorious![]" : "[SCARLET]Game over![]")
+ "\nNext selected map:[accent] "+map.name()+"[]"
+ (map.tags.containsKey("author") && !map.tags.get("author").trim().isEmpty() ? " by[accent] " + map.author() + "[]" : "") + "."+
+ "\nNext selected map:[accent] " + map.name() + "[]"
+ (map.tags.containsKey("author") && !map.tags.get("author").trim().isEmpty() ? " by[accent] " + map.author() + "[]" : "") + "." +
"\nNew game begins in " + roundExtraTime + " seconds.");
info("Selected next map to be {0}.", map.name());
@@ -280,10 +278,10 @@ public class ServerControl implements ApplicationListener{
if(state.rules.waves){
info("&ly {0} enemies.", unitGroups[Team.red.ordinal()].size());
}else{
info("&ly {0} seconds until next wave.", (int) (state.wavetime / 60));
info("&ly {0} seconds until next wave.", (int)(state.wavetime / 60));
}
info(" &ly{0} FPS, {1} MB used.", (int)(60f/Time.delta()), Core.app.getJavaHeap() / 1024 / 1024);
info(" &ly{0} FPS, {1} MB used.", (int)(60f / Time.delta()), Core.app.getJavaHeap() / 1024 / 1024);
if(playerGroup.size() > 0){
info(" &lyPlayers: {0}", playerGroup.size());
@@ -321,7 +319,7 @@ public class ServerControl implements ApplicationListener{
err("Not playing. Host first.");
return;
}
try{
Team team = arg.length == 0 ? Team.blue : Team.valueOf(arg[0]);
@@ -329,13 +327,13 @@ public class ServerControl implements ApplicationListener{
err("That team has no cores.");
return;
}
for(Item item : content.items()){
if(item.type == ItemType.material){
state.teams.get(team).cores.first().entity.items.set(item, state.teams.get(team).cores.first().block().itemCapacity);
}
}
info("Core filled.");
}catch(IllegalArgumentException ignored){
err("No such team exists.");
@@ -357,9 +355,9 @@ public class ServerControl implements ApplicationListener{
});
handler.register("strict", "<on/off>", "Disables or enables strict mode", arg -> {
boolean value = arg[0].equalsIgnoreCase("on");
netServer.admins.setStrict(value);
info("Strict mode is now {0}.", netServer.admins.getStrict() ? "on" : "off");
boolean value = arg[0].equalsIgnoreCase("on");
netServer.admins.setStrict(value);
info("Strict mode is now {0}.", netServer.admins.getStrict() ? "on" : "off");
});
handler.register("allow-custom-clients", "[on/off]", "Allow or disallow custom clients.", arg -> {
@@ -595,7 +593,7 @@ public class ServerControl implements ApplicationListener{
int i = 0;
for(PlayerInfo info : infos){
info("&lc[{0}] Trace info for player '{1}' / UUID {2}", i ++, info.lastName, info.id);
info("&lc[{0}] Trace info for player '{1}' / UUID {2}", i++, info.lastName, info.id);
info(" &lyall names used: {0}", info.names);
info(" &lyIP: {0}", info.lastIP);
info(" &lyall IPs used: {0}", info.ips);
@@ -706,14 +704,14 @@ public class ServerControl implements ApplicationListener{
private void logToFile(String text){
if(currentLogFile != null && currentLogFile.length() > maxLogLength){
String date = DateTimeFormatter.ofPattern("MM-dd-yyyy | HH:mm:ss").format(LocalDateTime.now());
currentLogFile.writeString("[End of log file. Date: "+ date + "]\n", true);
currentLogFile.writeString("[End of log file. Date: " + date + "]\n", true);
currentLogFile = null;
}
if(currentLogFile == null){
int i = 0;
while(logFolder.child("log-" + i + ".txt").length() >= maxLogLength){
i ++;
i++;
}
currentLogFile = logFolder.child("log-" + i + ".txt");