Preserve JARVIS menus while porting gameplay, Citizens NPCs and plugin-only CI
This commit is contained in:
parent
a16b7adc1d
commit
dbf4bb25ff
1 changed files with 2251 additions and 196035 deletions
|
|
@ -8,7 +8,7 @@ final class QuartermasterNpc implements Listener{
|
|||
QuartermasterNpc(JavaPlugin plugin,Consumer<Player> open){this.plugin=plugin;this.open=open;Bukkit.getPluginManager().registerEvents(this,plugin);Bukkit.getScheduler().runTaskLater(plugin,()->Bukkit.getWorlds().forEach(this::ensure),60);}
|
||||
private void ensure(World world){
|
||||
if(world.getEnvironment()!=World.Environment.NORMAL&&!world.getName().equals("guild_lobby"))return;
|
||||
var spawn=world.getSpawnLocation();spawn.getChunk().load();if(world.getEntitiesByClass(Villager.class).stream().anyMatch(e->e.getPersistentDataContainer().has(key,PersistentDataType.BYTE)))return;
|
||||
var spawn=world.getSpawnLocation();spawn.getChunk().load();if(world.getEntitiesByClass(LivingEntity.class).stream().anyMatch(e->e.getPersistentDataContainer().has(key,PersistentDataType.BYTE)))return;
|
||||
var at=spawn.clone().add(3,0,0);if(!at.getBlock().isPassable()||!at.clone().add(0,1,0).getBlock().isPassable()||!at.clone().add(0,-1,0).getBlock().getType().isSolid())at=spawn.clone();
|
||||
Villager npc=world.spawn(at,Villager.class);npc.setAI(false);npc.setInvulnerable(true);npc.setPersistent(true);npc.setRemoveWhenFarAway(false);npc.setSilent(true);npc.setCollidable(false);npc.setProfession(Villager.Profession.ARMORER);npc.customName(Component.text("Gurney Halleck · Quartermaster",NamedTextColor.GOLD));npc.setCustomNameVisible(true);npc.getPersistentDataContainer().set(key,PersistentDataType.BYTE,(byte)1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff