Skip to content

Commit 59a2d2f

Browse files
committed
improve the to string option for BuildMapView
1 parent 8fbd3a4 commit 59a2d2f

File tree

1 file changed

+10
-6
lines changed
  • Item Creator/src/main/java/org/broken/arrow/library/itemcreator/meta/map

1 file changed

+10
-6
lines changed

Item Creator/src/main/java/org/broken/arrow/library/itemcreator/meta/map/BuildMapView.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33

44
import org.broken.arrow.library.itemcreator.ItemCreator;
5+
import org.broken.arrow.library.itemcreator.utility.FormatString;
56
import org.bukkit.Bukkit;
67
import org.bukkit.World;
78
import org.bukkit.inventory.meta.MapMeta;
@@ -344,12 +345,15 @@ public static int retrieveMapId(@Nonnull final MapView mapView) {
344345

345346
@Override
346347
public String toString() {
347-
return "id: " + getId() +
348-
",\n world: " + (world == null ? "" : world.getName()) +
349-
",\n x: " + getCenterX() +
350-
",\n z: " + getCenterZ() +
351-
",\n renderers:" + renderers
352-
;
348+
FormatString string = new FormatString(new StringBuilder("{"));
349+
350+
string.appendFieldRecursive("id", getId(), 1);
351+
string.appendFieldRecursive("world", (world == null ? "" : world.getName()), 1);
352+
string.appendFieldRecursive("x", getCenterX(), 1);
353+
string.appendFieldRecursive("z", getCenterZ(), 1);
354+
string.appendFieldRecursive("renderers", renderers, 1);
355+
356+
return string.finalizeString() + "";
353357
}
354358

355359
}

0 commit comments

Comments
 (0)