Possible crash fix with editor saving
This commit is contained in:
@@ -31,7 +31,7 @@ public class Map implements Comparable<Map>, Publishable{
|
|||||||
/** Map width/height, shorts. */
|
/** Map width/height, shorts. */
|
||||||
public int width, height;
|
public int width, height;
|
||||||
/** Preview texture. */
|
/** Preview texture. */
|
||||||
public Texture texture;
|
public @Nullable Texture texture;
|
||||||
/** Build that this map was created in. -1 = unknown or custom build. */
|
/** Build that this map was created in. -1 = unknown or custom build. */
|
||||||
public int build;
|
public int build;
|
||||||
/** All teams present on this map.*/
|
/** All teams present on this map.*/
|
||||||
@@ -123,7 +123,7 @@ public class Map implements Comparable<Map>, Publishable{
|
|||||||
}
|
}
|
||||||
return maps.readFilters(tags.get("genfilters", ""));
|
return maps.readFilters(tags.get("genfilters", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String name(){
|
public String name(){
|
||||||
return tag("name");
|
return tag("name");
|
||||||
}
|
}
|
||||||
@@ -135,7 +135,7 @@ public class Map implements Comparable<Map>, Publishable{
|
|||||||
public String description(){
|
public String description(){
|
||||||
return tag("description");
|
return tag("description");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String plainName() {
|
public String plainName() {
|
||||||
return Strings.stripColors(name());
|
return Strings.stripColors(name());
|
||||||
}
|
}
|
||||||
@@ -165,13 +165,13 @@ public class Map implements Comparable<Map>, Publishable{
|
|||||||
public void addSteamID(String id){
|
public void addSteamID(String id){
|
||||||
tags.put("steamid", id);
|
tags.put("steamid", id);
|
||||||
editor.tags.put("steamid", id);
|
editor.tags.put("steamid", id);
|
||||||
|
|
||||||
try{
|
try{
|
||||||
ui.editor.save();
|
ui.editor.save();
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
Log.err(e);
|
Log.err(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
Events.fire(new MapPublishEvent());
|
Events.fire(new MapPublishEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,7 +179,7 @@ public class Map implements Comparable<Map>, Publishable{
|
|||||||
public void removeSteamID(){
|
public void removeSteamID(){
|
||||||
tags.remove("steamid");
|
tags.remove("steamid");
|
||||||
editor.tags.remove("steamid");
|
editor.tags.remove("steamid");
|
||||||
|
|
||||||
try{
|
try{
|
||||||
ui.editor.save();
|
ui.editor.save();
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
@@ -225,7 +225,7 @@ public class Map implements Comparable<Map>, Publishable{
|
|||||||
public boolean prePublish(){
|
public boolean prePublish(){
|
||||||
tags.put("author", player.name);
|
tags.put("author", player.name);
|
||||||
editor.tags.put("author", player.name);
|
editor.tags.put("author", player.name);
|
||||||
|
|
||||||
ui.editor.save();
|
ui.editor.save();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -238,10 +238,13 @@ public class Maps{
|
|||||||
}
|
}
|
||||||
|
|
||||||
Pixmap pix = MapIO.generatePreview(world.tiles);
|
Pixmap pix = MapIO.generatePreview(world.tiles);
|
||||||
mainExecutor.submit(() -> map.previewFile().writePng(pix));
|
|
||||||
writeCache(map);
|
writeCache(map);
|
||||||
|
|
||||||
map.texture = new Texture(pix);
|
map.texture = new Texture(pix);
|
||||||
|
mainExecutor.submit(() -> {
|
||||||
|
map.previewFile().writePng(pix);
|
||||||
|
pix.dispose();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
maps.add(map);
|
maps.add(map);
|
||||||
maps.sort();
|
maps.sort();
|
||||||
|
|||||||
Reference in New Issue
Block a user