mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-01-09 17:27:38 +00:00
Add amount of missing blocks to message when using inventory.
This commit is contained in:
parent
79802bd4b9
commit
e09a0c64ad
@ -124,7 +124,7 @@ public class EditSession {
|
|||||||
/**
|
/**
|
||||||
* List of missing blocks;
|
* List of missing blocks;
|
||||||
*/
|
*/
|
||||||
private Set<Integer> missingBlocks = new HashSet<Integer>();
|
private Map<Integer, Integer> missingBlocks = new HashMap<Integer, Integer>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mask to cover operations.
|
* Mask to cover operations.
|
||||||
@ -208,7 +208,11 @@ public class EditSession {
|
|||||||
} catch (UnplaceableBlockException e) {
|
} catch (UnplaceableBlockException e) {
|
||||||
return false;
|
return false;
|
||||||
} catch (BlockBagException e) {
|
} catch (BlockBagException e) {
|
||||||
missingBlocks.add(type);
|
if (!missingBlocks.containsKey(type)) {
|
||||||
|
missingBlocks.put(type, 1);
|
||||||
|
} else {
|
||||||
|
missingBlocks.put(type, missingBlocks.get(type) + 1);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -606,9 +610,9 @@ public class EditSession {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Set<Integer> popMissingBlocks() {
|
public Map<Integer, Integer> popMissingBlocks() {
|
||||||
Set<Integer> missingBlocks = this.missingBlocks;
|
Map<Integer, Integer> missingBlocks = this.missingBlocks;
|
||||||
this.missingBlocks = new HashSet<Integer>();
|
this.missingBlocks = new HashMap<Integer, Integer>();
|
||||||
return missingBlocks;
|
return missingBlocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1079,7 +1079,7 @@ public class WorldEdit {
|
|||||||
blockBag.flushChanges();
|
blockBag.flushChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<Integer> missingBlocks = editSession.popMissingBlocks();
|
Map<Integer, Integer> missingBlocks = editSession.popMissingBlocks();
|
||||||
|
|
||||||
if (missingBlocks.size() > 0) {
|
if (missingBlocks.size() > 0) {
|
||||||
StringBuilder str = new StringBuilder();
|
StringBuilder str = new StringBuilder();
|
||||||
@ -1087,13 +1087,15 @@ public class WorldEdit {
|
|||||||
int size = missingBlocks.size();
|
int size = missingBlocks.size();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
for (Integer id : missingBlocks) {
|
for (Integer id : missingBlocks.keySet()) {
|
||||||
BlockType type = BlockType.fromID(id);
|
BlockType type = BlockType.fromID(id);
|
||||||
|
|
||||||
str.append(type != null
|
str.append(type != null
|
||||||
? type.getName() + " (" + id + ")"
|
? type.getName() + " (" + id + ")"
|
||||||
: id.toString());
|
: id.toString());
|
||||||
|
|
||||||
|
str.append(" [Amt: " + missingBlocks.get(id) + "]");
|
||||||
|
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
if (i != size) {
|
if (i != size) {
|
||||||
|
Loading…
Reference in New Issue
Block a user