Skip to content

Commit

Permalink
Fixed some bugs. Added more log output.
Browse files Browse the repository at this point in the history
  • Loading branch information
kniffo80 committed Dec 20, 2016
1 parent ac4d4ad commit e591e5e
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 15 deletions.
3 changes: 2 additions & 1 deletion src/main/java/de/kniffo80/mobplugin/AutoSpawnTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,9 @@ private void prepareMaxSpawns() {
maxSpawns.get(Zombie.NETWORK_ID), maxSpawns.get(ZombieHorse.NETWORK_ID), maxSpawns.get(ZombieVillager.NETWORK_ID)));
}

public boolean entitySpawnAllowed(Level level, int networkId) {
public boolean entitySpawnAllowed(Level level, int networkId, String entityName) {
int count = countEntity(level, networkId);
FileLogger.debug(String.format("Found %s/%s living %s", count, maxSpawns.get(networkId), entityName));
if (count < maxSpawns.get(networkId)) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected SpawnResult spawn (IPlayer iPlayer) {
Position pos = ((Player)iPlayer).getPosition();
Level level = ((Player)iPlayer).getLevel();

if (this.spawnTask.entitySpawnAllowed(level, getEntityNetworkId())) {
if (this.spawnTask.entitySpawnAllowed(level, getEntityNetworkId(), getEntityName())) {
if (pos != null) {
// get a random safe position for spawn
pos.x += this.spawnTask.getRandomSafeXZCoord(50, 26, 6);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public SpawnResult spawn(IPlayer iPlayer, Position pos, Level level) {
this.spawnTask.createEntity(getEntityName(), pos.add(0, 1.3, 0));
}

FileLogger.info(String.format("Spawn for %s at %d,%d,%d with lightlevel %d and blockId %d, result: %s", iPlayer.getName(), pos.x, pos.y, pos.z, blockLightLevel, blockId, result));
FileLogger.info(String.format("Bat spawn for %s at %s,%s,%s with lightlevel %s and blockId %s, result: %s", iPlayer.getName(), pos.x, pos.y, pos.z, blockLightLevel, blockId, result));

return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public SpawnResult spawn(IPlayer iPlayer, Position pos, Level level) {
this.spawnTask.createEntity(getEntityName(), pos.add(0, 1.7, 0));
}

FileLogger.info(String.format("Spawn for %s at %d,%d,%d with lightlevel %d and blockId %d, result: %s", iPlayer.getName(), pos.x, pos.y, pos.z, blockLightLevel, blockId, result));
FileLogger.info(String.format("Chicken spawn for %s at %s,%s,%s with lightlevel %s and blockId %s, result: %s", iPlayer.getName(), pos.x, pos.y, pos.z, blockLightLevel, blockId, result));

return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public SpawnResult spawn(IPlayer iPlayer, Position pos, Level level) {
this.spawnTask.createEntity(getEntityName(), pos.add(0, 2.3, 0));
}

FileLogger.info(String.format("Spawn for %s at %d,%d,%d with lightlevel %d and blockId %d, result: %s", iPlayer.getName(), pos.x, pos.y, pos.z, blockLightLevel, blockId, result));
FileLogger.info(String.format("Cow spawn for %s at %s,%s,%s with lightlevel %s and blockId %s, result: %s", iPlayer.getName(), pos.x, pos.y, pos.z, blockLightLevel, blockId, result));

return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public SpawnResult spawn(IPlayer iPlayer, Position pos, Level level) {
this.spawnTask.createEntity(getEntityName(), pos.add(0, 2.8, 0));
}

FileLogger.info(String.format("Spawn for %s at %d,%d,%d with lightlevel %d and blockId %d, result: %s", iPlayer.getName(), pos.x, pos.y, pos.z, blockLightLevel, blockId, result));
FileLogger.info(String.format("Creeper spawn for %s at %s,%s,%s with lightlevel %s and blockId %s, result: %s", iPlayer.getName(), pos.x, pos.y, pos.z, blockLightLevel, blockId, result));

return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public SpawnResult spawn(IPlayer iPlayer, Position pos, Level level) {
this.spawnTask.createEntity(getEntityName(), pos.add(0, 3.8, 0));
}

FileLogger.info(String.format("Spawn for %s at %d,%d,%d with lightlevel %d and blockId %d, result: %s", iPlayer.getName(), pos.x, pos.y, pos.z, blockLightLevel, blockId, result));
FileLogger.info(String.format("Enderman spawn for %s at %s,%s,%s with lightlevel %s and blockId %s, result: %s", iPlayer.getName(), pos.x, pos.y, pos.z, blockLightLevel, blockId, result));

return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public SpawnResult spawn(IPlayer iPlayer, Position pos, Level level) {
this.spawnTask.createEntity(getEntityName(), pos.add(0, 1.9, 0));
}

FileLogger.info(String.format("Spawn for %s at %d,%d,%d with lightlevel %d and blockId %d, result: %s", iPlayer.getName(), pos.x, pos.y, pos.z, blockLightLevel, blockId, result));
FileLogger.info(String.format("Ocelot spawn for %s at %s,%s,%s with lightlevel %s and blockId %s, result: %s", iPlayer.getName(), pos.x, pos.y, pos.z, blockLightLevel, blockId, result));

return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public SpawnResult spawn(IPlayer iPlayer, Position pos, Level level) {
this.spawnTask.createEntity(getEntityName(), pos.add(0, 1.9, 0));
}

FileLogger.info(String.format("Spawn for %s at %d,%d,%d with lightlevel %d and blockId %d, result: %s", iPlayer.getName(), pos.x, pos.y, pos.z, blockLightLevel, blockId, result));
FileLogger.info(String.format("Pig spawn for %s at %s,%s,%s with lightlevel %s and blockId %s, result: %s", iPlayer.getName(), pos.x, pos.y, pos.z, blockLightLevel, blockId, result));

return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public SpawnResult spawn(IPlayer iPlayer, Position pos, Level level) {
this.spawnTask.createEntity(getEntityName(), pos.add(0, 1.75, 0));
}

FileLogger.info(String.format("Spawn for %s at %d,%d,%d with lightlevel %d and blockId %d, result: %s", iPlayer.getName(), pos.x, pos.y, pos.z, blockLightLevel, blockId, result));
FileLogger.info(String.format("Rabbit spawn for %s at %s,%s,%s with lightlevel %s and blockId %s, result: %s", iPlayer.getName(), pos.x, pos.y, pos.z, blockLightLevel, blockId, result));

return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public SpawnResult spawn(IPlayer iPlayer, Position pos, Level level) {
this.spawnTask.createEntity(getEntityName(), pos.add(0, 2.3, 0));
}

FileLogger.info(String.format("Spawn for %s at %d,%d,%d with lightlevel %d and blockId %d, result: %s", iPlayer.getName(), pos.x, pos.y, pos.z, blockLightLevel, blockId, result));
FileLogger.info(String.format("Sheep spawn for %s at %s,%s,%s with lightlevel %s and blockId %s, result: %s", iPlayer.getName(), pos.x, pos.y, pos.z, blockLightLevel, blockId, result));

return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public SpawnResult spawn(IPlayer iPlayer, Position pos, Level level) {
this.spawnTask.createEntity(getEntityName(), pos.add(0, 2.8, 0));
}

FileLogger.info(String.format("Spawn for %s at %d,%d,%d with lightlevel %d, result: %s", iPlayer.getName(), pos.x, pos.y, pos.z, blockLightLevel, result));
FileLogger.info(String.format("Skeleton spawn for %s at %s,%s,%s with lightlevel %s, result: %s", iPlayer.getName(), pos.x, pos.y, pos.z, blockLightLevel, result));

return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public SpawnResult spawn(IPlayer iPlayer, Position pos, Level level) {
this.spawnTask.createEntity(getEntityName(), pos.add(0, 2.12, 0));
}

FileLogger.info(String.format("Spawn for %s at %d,%d,%d with lightlevel %d and blockId %d, result: %s", iPlayer.getName(), pos.x, pos.y, pos.z, blockLightLevel, blockId, result));
FileLogger.info(String.format("Spider spawn for %s at %s,%s,%s with lightlevel %s and blockId %s, result: %s", iPlayer.getName(), pos.x, pos.y, pos.z, blockLightLevel, blockId, result));

return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public SpawnResult spawn(IPlayer iPlayer, Position pos, Level level) {
this.spawnTask.createEntity(getEntityName(), pos.add(0, 1.9, 0));
}

FileLogger.info(String.format("Spawn for %s at %s,%s,%s with lightlevel %d and biomeId %d, result: %s", iPlayer.getName(), pos.x, pos.y, pos.z, blockLightLevel, biomeId, result));
FileLogger.info(String.format("Wolf spawn for %s at %s,%s,%s with lightlevel %s and biomeId %s, result: %s", iPlayer.getName(), pos.x, pos.y, pos.z, blockLightLevel, biomeId, result));

return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public SpawnResult spawn(IPlayer iPlayer, Position pos, Level level) {
this.spawnTask.createEntity(getEntityName(), pos.add(0, 2.8, 0));
}

FileLogger.info(String.format("Spawn for %s at %d,%d,%d with lightlevel %d, result: %s", iPlayer.getName(), pos.x, pos.y, pos.z, blockLightLevel, result));
FileLogger.info(String.format("Zombie spawn for %s at %s,%s,%s with lightlevel %s, result: %s", iPlayer.getName(), pos.x, pos.y, pos.z, blockLightLevel, result));

return result;
}
Expand Down

0 comments on commit e591e5e

Please sign in to comment.