Map improvements (#8682)
* Update Map.java * Update MapListDialog.java * Update ServerControl.java
This commit is contained in:
@@ -117,6 +117,10 @@ public class Map implements Comparable<Map>, Publishable{
|
||||
}
|
||||
return maps.readFilters(tags.get("genfilters", ""));
|
||||
}
|
||||
|
||||
public String name(){
|
||||
return tag("name");
|
||||
}
|
||||
|
||||
public String author(){
|
||||
return tag("author");
|
||||
@@ -125,17 +129,25 @@ public class Map implements Comparable<Map>, Publishable{
|
||||
public String description(){
|
||||
return tag("description");
|
||||
}
|
||||
|
||||
public String plainName() {
|
||||
return Strings.stripColors(name());
|
||||
}
|
||||
|
||||
public String name(){
|
||||
return tag("name");
|
||||
public String plainAuthor(){
|
||||
return Strings.stripColors(author());
|
||||
}
|
||||
|
||||
public String plainDescription(){
|
||||
return Strings.stripColors(description());
|
||||
}
|
||||
|
||||
public String tag(String name){
|
||||
return tags.containsKey(name) && !tags.get(name).trim().isEmpty() ? tags.get(name) : Core.bundle.get("unknown", "unknown");
|
||||
return hasTag(name) ? tags.get(name) : Core.bundle.get("unknown", "unknown");
|
||||
}
|
||||
|
||||
public boolean hasTag(String name){
|
||||
return tags.containsKey(name);
|
||||
return tags.containsKey(name) && !tags.get(name).trim().isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -146,21 +158,22 @@ public class Map implements Comparable<Map>, Publishable{
|
||||
@Override
|
||||
public void addSteamID(String id){
|
||||
tags.put("steamid", id);
|
||||
|
||||
editor.tags.put("steamid", id);
|
||||
|
||||
try{
|
||||
ui.editor.save();
|
||||
}catch(Exception e){
|
||||
Log.err(e);
|
||||
}
|
||||
|
||||
Events.fire(new MapPublishEvent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeSteamID(){
|
||||
tags.remove("steamid");
|
||||
|
||||
editor.tags.remove("steamid");
|
||||
|
||||
try{
|
||||
ui.editor.save();
|
||||
}catch(Exception e){
|
||||
@@ -205,9 +218,9 @@ public class Map implements Comparable<Map>, Publishable{
|
||||
@Override
|
||||
public boolean prePublish(){
|
||||
tags.put("author", player.name);
|
||||
editor.tags.put("author", tags.get("author"));
|
||||
editor.tags.put("author", player.name);
|
||||
|
||||
ui.editor.save();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user