Added unit tests
This commit is contained in:
@@ -11,6 +11,7 @@ import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.ucore.util.Bits;
|
||||
|
||||
import static io.anuke.mindustry.Vars.control;
|
||||
import static io.anuke.mindustry.Vars.headless;
|
||||
|
||||
@Serialize
|
||||
public class Sector{
|
||||
@@ -46,11 +47,11 @@ public class Sector{
|
||||
}
|
||||
|
||||
public SaveSlot getSave(){
|
||||
return control.getSaves().getByID(saveID);
|
||||
return !hasSave() ? null : control.getSaves().getByID(saveID);
|
||||
}
|
||||
|
||||
public boolean hasSave(){
|
||||
return control.getSaves().getByID(saveID) != null;
|
||||
return !headless && control.getSaves().getByID(saveID) != null;
|
||||
}
|
||||
|
||||
public int packedPosition(){
|
||||
|
||||
@@ -47,7 +47,9 @@ public class Sectors{
|
||||
}
|
||||
world.loadSector(sector);
|
||||
logic.play();
|
||||
sector.saveID = control.getSaves().addSave("sector-" + sector.packedPosition()).index;
|
||||
if(!headless){
|
||||
sector.saveID = control.getSaves().addSave("sector-" + sector.packedPosition()).index;
|
||||
}
|
||||
world.sectors().save();
|
||||
world.setSector(sector);
|
||||
sector.currentMission().onBegin();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package io.anuke.mindustry.net;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.IntMap;
|
||||
import com.badlogic.gdx.utils.ObjectMap;
|
||||
import io.anuke.annotations.Annotations.Serialize;
|
||||
import io.anuke.ucore.core.Settings;
|
||||
@@ -16,8 +15,6 @@ public class Administration{
|
||||
private ObjectMap<String, PlayerInfo> playerInfo = new ObjectMap<>();
|
||||
/**Maps UUIDs to trace infos. This is wiped when a player logs off.*/
|
||||
private ObjectMap<String, TraceInfo> traceInfo = new ObjectMap<>();
|
||||
/** Maps packed coordinates to logs for that coordinate*/
|
||||
private IntMap<Array<EditLog>> editLogs = new IntMap<>();
|
||||
private Array<String> bannedIPs = new Array<>();
|
||||
|
||||
public Administration(){
|
||||
@@ -46,16 +43,6 @@ public class Administration{
|
||||
Settings.save();
|
||||
}
|
||||
|
||||
public void setAntiGriefParams(int maxBreak, int cooldown){
|
||||
Settings.putInt("antigrief-max", maxBreak);
|
||||
Settings.putInt("antigrief-cooldown", cooldown);
|
||||
Settings.save();
|
||||
}
|
||||
|
||||
public IntMap<Array<EditLog>> getEditLogs(){
|
||||
return editLogs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call when a player joins to update their information here.
|
||||
*/
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
package io.anuke.mindustry.net;
|
||||
|
||||
import io.anuke.mindustry.world.Block;
|
||||
|
||||
public class EditLog{
|
||||
public String playername;
|
||||
public Block block;
|
||||
public int rotation;
|
||||
public EditAction action;
|
||||
|
||||
EditLog(String playername, Block block, int rotation, EditAction action){
|
||||
this.playername = playername;
|
||||
this.block = block;
|
||||
this.rotation = rotation;
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public enum EditAction{
|
||||
PLACE, BREAK
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user