Merge branch 'crash-report-server' of https://github.com/Anuken/Mindustry

This commit is contained in:
Anuken
2018-08-30 09:23:10 -04:00
10 changed files with 141 additions and 101 deletions

View File

@@ -40,6 +40,7 @@ public class Vars{
//discord group URL
public static final String discordURL = "https://discord.gg/BKADYds";
public static final String releasesURL = "https://api.github.com/repos/Anuken/Mindustry/releases";
public static final String crashReportURL = "http://mindustry.us.to/report";
public static final int maxTextLength = 150;
public static final int maxNameLength = 40;
public static final float itemSize = 5f;

View File

@@ -14,7 +14,6 @@ public class GameState{
public boolean gameOver = false;
public GameMode mode = GameMode.waves;
public Difficulty difficulty = Difficulty.normal;
public boolean friendlyFire;
public WaveSpawner spawner = new WaveSpawner();
public Teams teams = new Teams();
private State state = State.menu;

View File

@@ -63,55 +63,6 @@ public class Administration{
return editLogs;
}
/*
public void rollbackWorld(int rollbackTimes) {
for(IntMap.Entry<Array<EditLog>> editLog : editLogs.entries()) {
int coords = editLog.key;
Array<EditLog> logs = editLog.value;
for(int i = 0; i < rollbackTimes; i++) {
EditLog log = logs.get(logs.size - 1);
int x = coords % world.width();
int y = coords / world.width();
Block result = log.block;
int rotation = log.rotation;
//TODO fix this mess, broken with 4.0
if(log.action == EditLog.EditAction.PLACE) {
// Build.breakBlock(x, y, false, false);
Packets.BreakPacket packet = new Packets.BreakPacket();
packet.x = (short) x;
packet.y = (short) y;
packet.playerid = 0;
Net.send(packet, Net.SendMode.tcp);
}
else if(log.action == EditLog.EditAction.BREAK) {
//Build.placeBlock(x, y, result, rotation, false, false);
Packets.PlacePacket packet = new Packets.PlacePacket();
packet.x = (short) x;
packet.y = (short) y;
packet.rotation = (byte) rotation;
packet.playerid = 0;
//packet.block = result.id;
Net.send(packet, Net.SendMode.tcp);
}
logs.removeIndex(logs.size - 1);
if(logs.size == 0) {
editLogs.remove(coords);
break;
}
}
}
}*/
public boolean validateBreak(String id, String ip){
if(!isAntiGrief() || isAdmin(id, ip)) return true;

View File

@@ -309,8 +309,12 @@ public class Net{
}
public static void http(String url, String method, Consumer<String> listener, Consumer<Throwable> failure){
http(url, method, null, listener, failure);
}
public static void http(String url, String method, String body, Consumer<String> listener, Consumer<Throwable> failure){
HttpRequest req = new HttpRequestBuilder().newRequest()
.method(method).url(url).build();
.method(method).url(url).content(body).build();
Gdx.net.sendHttpRequest(req, new HttpResponseListener(){
@Override