Search in sources :

Example 1 with PlayerData

use of com.github.euonmyoji.newhonor.configuration.PlayerData in project NewHonor-SpongePlugin by euOnmyoji.

the class NewHonor method onPlayerDie.

@Listener
public void onPlayerDie(RespawnPlayerEvent event) {
    Player p = event.getTargetEntity();
    PlayerData pd = new PlayerData(p);
    Task.builder().execute(() -> doSomething(pd)).async().name("newhonor - (die) init Player" + p.getName()).submit(this);
    MessageChannel newChannel = MessageChannel.combined(p.getMessageChannel(), mMessage);
    p.setMessageChannel(newChannel);
}
Also used : Player(org.spongepowered.api.entity.living.player.Player) MessageChannel(org.spongepowered.api.text.channel.MessageChannel) PlayerData(com.github.euonmyoji.newhonor.configuration.PlayerData) Listener(org.spongepowered.api.event.Listener)

Example 2 with PlayerData

use of com.github.euonmyoji.newhonor.configuration.PlayerData in project NewHonor-SpongePlugin by euOnmyoji.

the class NewHonor method onClientConnectionJoin.

@Listener
public void onClientConnectionJoin(ClientConnectionEvent.Join event) {
    Player p = event.getTargetEntity();
    PlayerData pd = new PlayerData(p);
    Task.builder().execute(() -> {
        if (!pd.init()) {
            logger.error("初始化玩家" + p.getName() + "," + p.getUniqueId() + ",头衔数据失败!");
        }
        doSomething(pd);
    }).async().delayTicks(20).name("newhonor - init Player" + p.getName()).submit(this);
    MessageChannel originalChannel = event.getOriginalChannel();
    MessageChannel newChannel = MessageChannel.combined(p.getMessageChannel(), originalChannel, mMessage);
    p.setMessageChannel(newChannel);
}
Also used : Player(org.spongepowered.api.entity.living.player.Player) MessageChannel(org.spongepowered.api.text.channel.MessageChannel) PlayerData(com.github.euonmyoji.newhonor.configuration.PlayerData) Listener(org.spongepowered.api.event.Listener)

Aggregations

PlayerData (com.github.euonmyoji.newhonor.configuration.PlayerData)2 Player (org.spongepowered.api.entity.living.player.Player)2 Listener (org.spongepowered.api.event.Listener)2 MessageChannel (org.spongepowered.api.text.channel.MessageChannel)2