Add a random teleport npc in the safezones
This commit is contained in:
parent
9d3957cd54
commit
1fbeaa6ecd
@ -152,6 +152,24 @@ public class SpawnModule extends MiniPlugin
|
||||
|
||||
new SimpleNPC(_plugin, location, Villager.class, C.cGoldB + "Gem Hunters Tutorial", null);
|
||||
}
|
||||
{
|
||||
for (Location location : _worldData.getCustomLocation("RANDOM_TELEPORT"))
|
||||
{
|
||||
new SimpleNPC(_plugin, location, Villager.class, C.cYellowB + "Random Teleport", clicker ->
|
||||
{
|
||||
|
||||
Location toTeleport = getRandomLocation();
|
||||
|
||||
if (toTeleport == null)
|
||||
{
|
||||
clicker.sendMessage(F.main(_moduleName, "A suitable teleport location could not be found. Please try again in a few seconds."));
|
||||
return;
|
||||
}
|
||||
|
||||
clicker.teleport(toTeleport);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -174,7 +192,7 @@ public class SpawnModule extends MiniPlugin
|
||||
Block up = block.getRelative(BlockFace.UP);
|
||||
Block down = block.getRelative(BlockFace.DOWN);
|
||||
|
||||
if (block.getType() != Material.AIR || down.getType() == Material.AIR || UtilBlock.liquid(down) || UtilBlock.liquid(up) || UtilBlock.liquid(block) || _safezone.isInSafeZone(block.getLocation()) || block.getLocation().getBlockY() > MAX_SPAWNING_Y)
|
||||
if (block.getType() != Material.AIR || down.getType() == Material.AIR || down.getType() == Material.LEAVES || up.getType() == Material.LEAVES || UtilBlock.liquid(down) || UtilBlock.liquid(up) || UtilBlock.liquid(block) || _safezone.isInSafeZone(block.getLocation()) || block.getLocation().getBlockY() > MAX_SPAWNING_Y)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user