Skip to content

Commit 88b13a0

Browse files
committed
Fix flag formatting
1 parent 8e90ade commit 88b13a0

File tree

1 file changed

+16
-5
lines changed
  • src/main/java/com/empcraft/plot2dynmap

1 file changed

+16
-5
lines changed

src/main/java/com/empcraft/plot2dynmap/Main.java

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ private void updatePlots() {
230230
}
231231
final String[] trusted_list = new String[plot.getTrusted().size()];
232232
i = 0;
233-
for (UUID trusted : plot.getTrusted()) {
233+
for (final UUID trusted : plot.getTrusted()) {
234234
trusted_list[i] = MainUtil.getName(trusted);
235235
i++;
236236
}
@@ -239,15 +239,26 @@ private void updatePlots() {
239239
trusted = StringUtils.join(trusted_list, ",");
240240
}
241241

242-
String alias = plot.toString();
243-
String flags = "";
244-
final Collection<Flag<?>> plotFlags =
242+
final String alias = plot.toString();
243+
/*final Collection<Flag<?>> plotFlags =
245244
FlagManager.getPlotFlags(plot).keySet();
246245
if (plotFlags.size() > 0) {
247246
flags = StringUtils.join(plotFlags, ",");
247+
}*/
248+
final StringBuilder flagBuilder = new StringBuilder();
249+
final Iterator<Map.Entry<Flag<?>, Object>> iterator =
250+
FlagManager.getPlotFlags(plot).entrySet().iterator();
251+
while (iterator.hasNext()) {
252+
final Map.Entry<Flag<?>, Object> entry = iterator.next();
253+
flagBuilder.append(String.format("%s = %s", entry.getKey().getName(),
254+
entry.getValue().toString()));
255+
if (iterator.hasNext()) {
256+
flagBuilder.append(", ");
257+
}
248258
}
259+
249260
final PlotWrapper plotWrapper =
250-
new PlotWrapper(owner, helpers, trusted, plot.getId(), alias, flags,
261+
new PlotWrapper(owner, helpers, trusted, plot.getId(), alias, flagBuilder.toString(),
251262
plot.getArea());
252263
handlePlot(w, plotWrapper, newMap);
253264
}

0 commit comments

Comments
 (0)