Fix legacy conversion of block lists

This commit is contained in:
Sauilitired 2018-12-24 08:57:17 +01:00
parent 9e0c226632
commit 9fe9c2662b
No known key found for this signature in database
GPG Key ID: C0207FF7EA146678
2 changed files with 17 additions and 11 deletions

View File

@ -141,6 +141,11 @@ import java.util.Map.Entry;
// //
if (sum < 100) { if (sum < 100) {
final int remaining = 100 - sum; final int remaining = 100 - sum;
if (unassigned.isEmpty()) {
// If there are no unassigned values, we just add it to the first value
final Entry<PlotBlock, Integer> entry = temp.entrySet().iterator().next();
temp.put(entry.getKey(), (entry.getValue() + 1 + remaining));
} else {
final int perUnassigned = remaining / unassigned.size(); final int perUnassigned = remaining / unassigned.size();
for (final PlotBlock block : unassigned) { for (final PlotBlock block : unassigned) {
temp.put(block, perUnassigned); temp.put(block, perUnassigned);
@ -152,6 +157,7 @@ import java.util.Map.Entry;
temp.put(unassigned.get(0), perUnassigned + difference); temp.put(unassigned.get(0), perUnassigned + difference);
sum = 100; sum = 100;
} }
}
} else if (!unassigned.isEmpty()) { } else if (!unassigned.isEmpty()) {
C.BUCKET_ENTRIES_IGNORED.send(ConsolePlayer.getConsole()); C.BUCKET_ENTRIES_IGNORED.send(ConsolePlayer.getConsole());
} }

View File

@ -1423,7 +1423,7 @@ public class Plot {
} }
PlotArea plotworld = getArea(); PlotArea plotworld = getArea();
if (plotworld.SCHEMATIC_ON_CLAIM) { if (plotworld.SCHEMATIC_ON_CLAIM) {
Schematic sch = null; Schematic sch;
try { try {
if (schematic == null || schematic.isEmpty()) { if (schematic == null || schematic.isEmpty()) {
sch = SchematicHandler.manager.getSchematic(plotworld.SCHEMATIC_FILE); sch = SchematicHandler.manager.getSchematic(plotworld.SCHEMATIC_FILE);