mirror of
https://github.com/BentoBoxWorld/Boxed.git
synced 2024-12-04 13:33:35 +01:00
Debug clean up
This commit is contained in:
parent
3d411d24ff
commit
1fe87fedff
@ -153,21 +153,16 @@ public class NewAreaListener implements Listener {
|
|||||||
* Build something in the queue. Structures are built one by one
|
* Build something in the queue. Structures are built one by one
|
||||||
*/
|
*/
|
||||||
private void buildStructure() {
|
private void buildStructure() {
|
||||||
//BentoBox.getInstance().logDebug("buildStructure");
|
|
||||||
// Only kick off a build if there is something to build and something isn't
|
// Only kick off a build if there is something to build and something isn't
|
||||||
// already being built
|
// already being built
|
||||||
if (!pasting && !itemsToBuild.isEmpty()) {
|
if (!pasting && !itemsToBuild.isEmpty()) {
|
||||||
// Build item
|
// Build item
|
||||||
//BentoBox.getInstance().logDebug("Build item");
|
|
||||||
StructureRecord item = itemsToBuild.poll();
|
StructureRecord item = itemsToBuild.poll();
|
||||||
placeStructure(item);
|
placeStructure(item);
|
||||||
} else {
|
|
||||||
//BentoBox.getInstance().logDebug("Nothing to do");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void placeStructure(StructureRecord item) {
|
private void placeStructure(StructureRecord item) {
|
||||||
//BentoBox.getInstance().logDebug("Placing structure");
|
|
||||||
// Set the semaphore - only paste one at a time
|
// Set the semaphore - only paste one at a time
|
||||||
pasting = true;
|
pasting = true;
|
||||||
// Place the structure - this cannot be done async
|
// Place the structure - this cannot be done async
|
||||||
@ -231,14 +226,13 @@ public class NewAreaListener implements Listener {
|
|||||||
if (!(addon.inWorld(chunk.getWorld()))) {
|
if (!(addon.inWorld(chunk.getWorld()))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//BentoBox.getInstance().logDebug(e.getEventName());
|
|
||||||
Pair<Integer, Integer> chunkCoords = new Pair<Integer, Integer>(chunk.getX(), chunk.getZ());
|
Pair<Integer, Integer> chunkCoords = new Pair<Integer, Integer>(chunk.getX(), chunk.getZ());
|
||||||
if (pending.containsKey(chunkCoords)) {
|
if (pending.containsKey(chunkCoords)) {
|
||||||
Iterator<StructureRecord> it = pending.get(chunkCoords).iterator();
|
Iterator<StructureRecord> it = pending.get(chunkCoords).iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
StructureRecord item = it.next();
|
StructureRecord item = it.next();
|
||||||
if (item.location().getWorld().equals(e.getWorld())) {
|
if (item.location().getWorld().equals(e.getWorld())) {
|
||||||
//BentoBox.getInstance().logDebug("Placing structure in itemsToBuild " + item);
|
// Placing structure in itemsToBuild
|
||||||
this.itemsToBuild.add(item);
|
this.itemsToBuild.add(item);
|
||||||
it.remove();
|
it.remove();
|
||||||
}
|
}
|
||||||
@ -247,8 +241,6 @@ public class NewAreaListener implements Listener {
|
|||||||
ToBePlacedStructures tbd = new ToBePlacedStructures();
|
ToBePlacedStructures tbd = new ToBePlacedStructures();
|
||||||
tbd.setReadyToBuild(pending);
|
tbd.setReadyToBuild(pending);
|
||||||
toPlace.saveObjectAsync(tbd);
|
toPlace.saveObjectAsync(tbd);
|
||||||
} else {
|
|
||||||
//BentoBox.getInstance().logDebug("Nothing to build in this chunk");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -394,7 +386,7 @@ public class NewAreaListener implements Listener {
|
|||||||
int y = Integer.parseInt(coords[1].strip());
|
int y = Integer.parseInt(coords[1].strip());
|
||||||
int z = Integer.parseInt(coords[2].strip()) + center.getBlockZ();
|
int z = Integer.parseInt(coords[2].strip()) + center.getBlockZ();
|
||||||
Location location = new Location(world, x, y, z);
|
Location location = new Location(world, x, y, z);
|
||||||
//BentoBox.getInstance().logDebug("Structure " + name + " will be placed at " + location);
|
// Structure will be placed at location
|
||||||
readyToBuild.computeIfAbsent(new Pair<>(x >> 4, z >> 4), k -> new ArrayList<>())
|
readyToBuild.computeIfAbsent(new Pair<>(x >> 4, z >> 4), k -> new ArrayList<>())
|
||||||
.add(new StructureRecord(name, "minecraft:" + name, location, rotation, mirror, noMobs));
|
.add(new StructureRecord(name, "minecraft:" + name, location, rotation, mirror, noMobs));
|
||||||
this.itemsToBuild
|
this.itemsToBuild
|
||||||
@ -411,8 +403,6 @@ public class NewAreaListener implements Listener {
|
|||||||
return list1;
|
return list1;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
//BentoBox.getInstance().logDebug("mergedMap size = " + mergedMap.size());
|
|
||||||
//BentoBox.getInstance().logDebug("readyToBuild size = " + readyToBuild.size());
|
|
||||||
// Save the list
|
// Save the list
|
||||||
tbd.setReadyToBuild(mergedMap);
|
tbd.setReadyToBuild(mergedMap);
|
||||||
toPlace.saveObjectAsync(tbd);
|
toPlace.saveObjectAsync(tbd);
|
||||||
@ -520,7 +510,6 @@ public class NewAreaListener implements Listener {
|
|||||||
spawnMob(b, bjb);
|
spawnMob(b, bjb);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
BentoBox.getInstance().logDebug("We have an error");
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -553,17 +542,12 @@ public class NewAreaListener implements Listener {
|
|||||||
} else if (bjb.getPool().contains("villagers")) {
|
} else if (bjb.getPool().contains("villagers")) {
|
||||||
type = EntityType.VILLAGER;
|
type = EntityType.VILLAGER;
|
||||||
}
|
}
|
||||||
// if (type == null) {
|
|
||||||
// BentoBox.getInstance().logDebug(bjb.getPool());
|
|
||||||
// }
|
|
||||||
// Spawn it
|
// Spawn it
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
Entity e = b.getWorld().spawnEntity(b.getRelative(BlockFace.UP).getLocation(), type);
|
Entity e = b.getWorld().spawnEntity(b.getRelative(BlockFace.UP).getLocation(), type);
|
||||||
if (e != null) {
|
if (e != null) {
|
||||||
e.setPersistent(true);
|
e.setPersistent(true);
|
||||||
}
|
}
|
||||||
// BentoBox.getInstance().logDebug("Spawned a " + type + " at " +
|
|
||||||
// b.getRelative(BlockFace.UP).getLocation());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -650,12 +634,10 @@ public class NewAreaListener implements Listener {
|
|||||||
|
|
||||||
private ToBePlacedStructures loadToDos() {
|
private ToBePlacedStructures loadToDos() {
|
||||||
if (!toPlace.objectExists(TODO)) {
|
if (!toPlace.objectExists(TODO)) {
|
||||||
//BentoBox.getInstance().logDebug("No TODO list");
|
|
||||||
return new ToBePlacedStructures();
|
return new ToBePlacedStructures();
|
||||||
}
|
}
|
||||||
ToBePlacedStructures list = toPlace.loadObject(TODO);
|
ToBePlacedStructures list = toPlace.loadObject(TODO);
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
//BentoBox.getInstance().logDebug("TODO list is null");
|
|
||||||
return new ToBePlacedStructures();
|
return new ToBePlacedStructures();
|
||||||
}
|
}
|
||||||
if (!list.getReadyToBuild().isEmpty()) {
|
if (!list.getReadyToBuild().isEmpty()) {
|
||||||
|
@ -15,13 +15,6 @@ public abstract class AbstractMetaData {
|
|||||||
public abstract String nmsData(Block block);
|
public abstract String nmsData(Block block);
|
||||||
|
|
||||||
protected String getData(TileEntity te, String method, String field) {
|
protected String getData(TileEntity te, String method, String field) {
|
||||||
/*
|
|
||||||
for (Method m : te.getClass().getMethods()) {
|
|
||||||
BentoBox.getInstance().logDebug(m.getName() + " returns " + m.getReturnType() + " and has these parameters "
|
|
||||||
+ m.getParameterTypes());
|
|
||||||
}
|
|
||||||
te.getUpdateTag();
|
|
||||||
*/
|
|
||||||
try {
|
try {
|
||||||
// Check if the method 'j' exists
|
// Check if the method 'j' exists
|
||||||
Method updatePacketMethod = te.getClass().getDeclaredMethod(method);
|
Method updatePacketMethod = te.getClass().getDeclaredMethod(method);
|
||||||
|
Loading…
Reference in New Issue
Block a user