Build script reformatting / 'Fixed' all unchecked warnings

This commit is contained in:
Anuken
2018-12-13 18:01:51 -05:00
parent 18ddc040d1
commit 0b837925a2
15 changed files with 119 additions and 124 deletions

View File

@@ -95,26 +95,24 @@ public class MapEditorDialog extends Dialog implements Disposable{
t.addImageTextButton("$text.editor.import", "icon-load-map", isize, () ->
createDialog("$text.editor.import",
"$text.editor.importmap", "$text.editor.importmap.description", "icon-load-map", (Runnable) loadDialog::show,
"$text.editor.importfile", "$text.editor.importfile.description", "icon-file", (Runnable) () -> {
Platform.instance.showFileChooser("$text.loadimage", "Map Files", file -> {
ui.loadGraphics(() -> {
try{
DataInputStream stream = new DataInputStream(file.read());
"$text.editor.importfile", "$text.editor.importfile.description", "icon-file", (Runnable) () ->
Platform.instance.showFileChooser("$text.loadimage", "Map Files", file -> ui.loadGraphics(() -> {
try{
DataInputStream stream = new DataInputStream(file.read());
MapMeta meta = MapIO.readMapMeta(stream);
MapTileData data = MapIO.readTileData(stream, meta, false);
MapMeta meta = MapIO.readMapMeta(stream);
MapTileData data = MapIO.readTileData(stream, meta, false);
editor.beginEdit(data, meta.tags, false);
view.clearStack();
}catch(Exception e){
ui.showError(Bundles.format("text.editor.errorimageload", Strings.parseException(e, false)));
Log.err(e);
}
});
}, true, mapExtension);
},
"$text.editor.importimage", "$text.editor.importimage.description", "icon-file-image", (Runnable)() -> {
Platform.instance.showFileChooser("$text.loadimage", "Image Files", file -> {
editor.beginEdit(data, meta.tags, false);
view.clearStack();
}catch(Exception e){
ui.showError(Bundles.format("text.editor.errorimageload", Strings.parseException(e, false)));
Log.err(e);
}
}), true, mapExtension),
"$text.editor.importimage", "$text.editor.importimage.description", "icon-file-image", (Runnable)() ->
Platform.instance.showFileChooser("$text.loadimage", "Image Files", file ->
ui.loadGraphics(() -> {
try{
MapTileData data = MapIO.readLegacyPixmap(new Pixmap(file));
@@ -125,12 +123,11 @@ public class MapEditorDialog extends Dialog implements Disposable{
ui.showError(Bundles.format("text.editor.errorimageload", Strings.parseException(e, false)));
Log.err(e);
}
});
}, true, "png");
}));
}), true, "png")
));
t.addImageTextButton("$text.editor.export", "icon-save-map", isize, () -> createDialog("$text.editor.export",
"$text.editor.exportfile", "$text.editor.exportfile.description", "icon-file", (Runnable) () -> {
"$text.editor.exportfile", "$text.editor.exportfile.description", "icon-file", (Runnable) () ->
Platform.instance.showFileChooser("$text.saveimage", "Map Files", file -> {
file = file.parent().child(file.nameWithoutExtension() + "." + mapExtension);
FileHandle result = file;
@@ -146,8 +143,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
Log.err(e);
}
});
}, false, mapExtension);
}));
}, false, mapExtension)));
t.row();
@@ -258,7 +254,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
* 2) icon name
* 3) listener
*/
private FloatingDialog createDialog(String title, Object... arguments){
private void createDialog(String title, Object... arguments){
FloatingDialog dialog = new FloatingDialog(title);
float h = 90f;
@@ -292,8 +288,6 @@ public class MapEditorDialog extends Dialog implements Disposable{
dialog.addCloseButton();
dialog.show();
return dialog;
}
@Override
@@ -556,9 +550,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
ImageButton button = new ImageButton("white", "clear-toggle");
button.clicked(() -> editor.setDrawBlock(block));
button.resizeImage(8 * 4f);
button.getImageCell().setActor(stack);
button.addChild(stack);
button.getImage().remove();
button.replaceImage(stack);
button.update(() -> button.setChecked(editor.getDrawBlock() == block));
group.add(button);
content.add(button).size(50f);

View File

@@ -65,6 +65,7 @@ public class Unlocks{
save();
}
@SuppressWarnings("unchecked")
public void load(){
unlocked = Settings.getObject("unlockset", ObjectMap.class, ObjectMap::new);
}

View File

@@ -150,6 +150,7 @@ public class Sectors{
save();
}
@SuppressWarnings("unchecked")
public void load(){
for(Sector sector : grid.values()){
sector.texture.dispose();

View File

@@ -261,6 +261,7 @@ public class Administration{
Settings.save();
}
@SuppressWarnings("unchecked")
private void load(){
playerInfo = Settings.getObject("player-info", ObjectMap.class, ObjectMap::new);
bannedIPs = Settings.getObject("banned-ips", Array.class, Array::new);

View File

@@ -25,11 +25,11 @@ import java.io.IOException;
import static io.anuke.mindustry.Vars.*;
@SuppressWarnings("unchecked")
public class Net{
private static boolean server;
private static boolean active;
private static boolean clientLoaded;
private static String lastIP;
private static Array<Object> packetQueue = new Array<>();
private static ObjectMap<Class<?>, Consumer> clientListeners = new ObjectMap<>();
private static ObjectMap<Class<?>, BiConsumer<Integer, Object>> serverListeners = new ObjectMap<>();
@@ -106,7 +106,6 @@ public class Net{
*/
public static void connect(String ip, int port, Runnable success){
try{
lastIP = ip + ":" + port;
if(!active){
clientProvider.connect(ip, port, success);
active = true;
@@ -119,11 +118,6 @@ public class Net{
}
}
/**Returns the last IP connected to.*/
public static String getLastIP() {
return lastIP;
}
/**
* Host a server at an address.
*/

View File

@@ -310,6 +310,7 @@ public class JoinDialog extends FloatingDialog{
return UIUtils.portrait() ? 350f : 500f;
}
@SuppressWarnings("unchecked")
private void loadServers(){
servers = Settings.getObject("server-list", Array.class, Array::new);
}

View File

@@ -101,6 +101,7 @@ public class Tile implements PosTrait, TargetTrait{
return -1;
}
@SuppressWarnings("unchecked")
public <T extends TileEntity> T entity(){
return (T) entity;
}

View File

@@ -35,7 +35,6 @@ public class Conveyor extends Block{
private TextureRegion[][] regions = new TextureRegion[7][4];
protected float speed = 0f;
protected float carryCapacity = 8f;
protected Conveyor(String name){
super(name);
@@ -359,9 +358,9 @@ public class Conveyor extends Block{
public Array<Object> getDebugInfo(Tile tile){
ConveyorEntity entity = tile.entity();
Array<Object> arr = super.getDebugInfo(tile);
arr.addAll(Array.with(
"clogHeat", entity.clogHeat,
"sleeping", entity.isSleeping()
arr.addAll(Array.<Object>with(
"clogHeat", entity.clogHeat,
"sleeping", entity.isSleeping()
));
return arr;
}

View File

@@ -87,6 +87,7 @@ public class Consumers{
return map.containsKey(type);
}
@SuppressWarnings("unchecked")
public <T extends Consume> T get(Class<T> type){
if(!map.containsKey(type)){
throw new IllegalArgumentException("Block does not contain consumer of type '" + type + "'!");