Preserve JARVIS menus while porting gameplay, Citizens NPCs and plugin-only CI

This commit is contained in:
unimatrixgit 2026-11-29 01:54:16 +01:00
commit dbf4bb25ff

View file

@ -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);
}