Пример #1
0
  @EventHandler(order = Order.EARLIEST)
  public void onPlayerJoin(PlayerJoinEvent event) {
    // Refire event
    BridgePlayer player = EntityFactory.createPlayer(event.getPlayer());
    final String joinMessage = event.getMessage().asString();
    org.bukkit.event.player.PlayerJoinEvent join =
        new org.bukkit.event.player.PlayerJoinEvent(player, joinMessage);
    Bukkit.getPluginManager().callEvent(join);
    if (!joinMessage.equals(join.getJoinMessage())) {
      event.setMessage(join.getJoinMessage());
    }

    // Add components
    event.getPlayer().add(PlayerMoveComponent.class);
  }
Пример #2
0
  @EventHandler(order = Order.EARLIEST)
  public void onPlayerJoin(PlayerJoinEvent event) {

    plugin.getGame().broadcastMessage(event.getPlayer().getName() + " has joined the game");
    // Set the player's controller
    // For now, only create Survival Players
    Entity playerEntity = event.getPlayer().getEntity();
    playerEntity.setController(new SurvivalPlayer(event.getPlayer()));
    event
        .getPlayer()
        .setNetworkSynchronizer(new VanillaNetworkSynchronizer(event.getPlayer(), playerEntity));

    /*Point point = playerEntity.getLiveTransform().getPosition();
    float pitch = playerEntity.getLiveTransform().getRotation().getAxisAngles().getZ();
    float yaw = playerEntity.getLiveTransform().getRotation().getAxisAngles().getY();

    //Inform existing players of the new player
    Message update = new SpawnPlayerMessage(playerEntity.getId(), event.getPlayer().getName(),
    	(int)(point.getX() * 32), (int)(point.getY() * 32), (int)(point.getZ() * 32),
    	(int)(yaw  * 256.0F / 360.0F), (int)(pitch * 256.0F / 360.0F), 0);

    for (Player p : plugin.getGame().getOnlinePlayers()) {
    	if (!p.equals(event.getPlayer()))
    		p.getSession().send(update);
    }*/

    plugin
        .getGame()
        .getScheduler()
        .scheduleSyncDelayedTask(plugin, new LoginRunnable(event.getPlayer()), 1L);
  }
Пример #3
0
 @EventHandler(event = PlayerJoinEvent.class, order = Order.EARLIEST)
 public void onPlayerJoin(PlayerJoinEvent event) {
   plugin.wrapPlayer(event.getPlayer()).dispatchCUIHandshake();
 }