Guest User

Untitled

a guest
Jul 9th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. @Listener
  2. public void onServer(GameStartedServerEvent _e) {
  3. World world = Sponge.getServer().getWorld("world").get();
  4. Location<World> location = new Location<World>(world, -68, 69, 720);
  5.  
  6. Entity banker = world.createEntity(EntityTypes.VILLAGER, location.getPosition());
  7. banker.offer(Keys.AI_ENABLED, false);
  8. banker.offer(Keys.INVULNERABLE, true);
  9. banker.offer(Keys.CAREER, Careers.CLERIC);
  10. banker.offer(Keys.CUSTOM_NAME_VISIBLE, true);
  11. banker.offer(Sponge.getDataManager().getManipulatorBuilder(TradeOfferData.class).get().create());
  12. banker.offer(Keys.DISPLAY_NAME, Text.of(TextColors.GOLD, "Banker"));
  13. try (CauseStackManager.StackFrame frame = Sponge.getCauseStackManager().pushCauseFrame()) {
  14. frame.addContext(EventContextKeys.SPAWN_TYPE, SpawnTypes.PLUGIN);
  15. world.spawnEntity(banker);
  16. }
  17. }
Add Comment
Please, Sign In to add comment