本文整理汇总了Java中net.gtaun.shoebill.event.player.PlayerUpdateEvent类的典型用法代码示例。如果您正苦于以下问题:Java PlayerUpdateEvent类的具体用法?Java PlayerUpdateEvent怎么用?Java PlayerUpdateEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PlayerUpdateEvent类属于net.gtaun.shoebill.event.player包,在下文中一共展示了PlayerUpdateEvent类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onInit
import net.gtaun.shoebill.event.player.PlayerUpdateEvent; //导入依赖的package包/类
@Override
protected void onInit() {
lastTick = System.currentTimeMillis();
streamer.updatePlayer(player);
eventManagerNode.registerHandler(PlayerUpdateEvent.class, (e) -> {
if(System.currentTimeMillis() - lastTick >= 100) {
streamer.updatePlayer(player);
lastTick = System.currentTimeMillis();
}
});
}
示例2: onInit
import net.gtaun.shoebill.event.player.PlayerUpdateEvent; //导入依赖的package包/类
@Override
protected void onInit()
{
eventManagerNode.registerHandler(PlayerUpdateEvent.class, HandlerPriority.NORMAL, Attentions.create().object(player), (e) ->
{
if (player.getUpdateCount() % 40 == 0) updateMapIcons();
});
final LocalizedStringSet stringSet = raceService.getLocalizedStringSet();
player.sendMessage(Color.LIGHTBLUE, stringSet.format(player, "TrackEditor.StartEditingTrackMessage", track.getName()));
}
示例3: PlayerManager
import net.gtaun.shoebill.event.player.PlayerUpdateEvent; //导入依赖的package包/类
public PlayerManager() throws IOException
{
eventManager = EventSystem.getInstance().getEventManagerInstance();
commandManager = new PlayerCommandManager(eventManager);
commandManager.registerCommands(new Commands());
commandManager.installCommandHandler(HandlerPriority.NORMAL);
CommandGroup playerCommands = new CommandGroup();
playerCommands.registerCommands(new Commands());
commandManager.registerChildGroup(playerCommands, "player");
commandManager.setUsageMessageSupplier((player, prefix, command) -> {
String message;
if(command.getHelpMessage() == null)
{
message = prefix + command;
for (CommandParameter param : command.getParameters()) {
message += " [" + param + "]";
}
}
else {
message = command.getHelpMessage();
}
return message;
});
//--
eventManager.registerHandler(PlayerUpdateEvent.class, (e) -> {
playerLifecycle = EventSystem.getInstance().getPlayerLifecycleHolder().getObject(e.getPlayer(), PlayerData.class);
playerLifecycle.setPlayerState(PlayerState.UPDATING);
playerLifecycle.setLastUpdate(System.currentTimeMillis());
if(!e.getPlayer().isNpc())
EventBase.checkEvent(e.getPlayer());
});
eventManager.registerHandler(PlayerWeaponShotEvent.class, EventBase::onPlayerWeaponShot);
eventManager.registerHandler(PlayerTakeDamageEvent.class, EventBase::onPlayerTakeDamage);
eventManager.registerHandler(PlayerConnectEvent.class, (e) -> {
playerLifecycle = EventSystem.getInstance().getPlayerLifecycleHolder().getObject(e.getPlayer(), PlayerData.class);
playerLifecycle.setPlayerState(PlayerState.CONNECTED);
});
eventManager.registerHandler(PlayerDisconnectEvent.class, (e) -> {
playerLifecycle = EventSystem.getInstance().getPlayerLifecycleHolder().getObject(e.getPlayer(), PlayerData.class);
playerLifecycle.setPlayerState(PlayerState.NONE);
EventBase.leaveEvent(e.getPlayer());
});
eventManager.registerHandler(PlayerDeathEvent.class, (e) -> {
e.getPlayer().clearAnimations(0);
e.getPlayer().setHealth(1.0f);
EventBase.onPlayerDeath(e.getPlayer());
});
eventManager.registerHandler(PlayerKeyStateChangeEvent.class, EventBase::onPlayerKeyStateChange);
eventManager.registerHandler(PlayerSpawnEvent.class, (e) -> {
e.getPlayer().setHealth(100);
EventBase.onPlayerSpawn(e.getPlayer());
});
/*
eventManager.registerHandler(PlayerChangeLanguageEvent.class, e -> {
// EventSystem.getInstance().setPlayerLanguage(e.getPlayer(), e.getLanguage().getAbbr());
});
*/
}
示例4: onInit
import net.gtaun.shoebill.event.player.PlayerUpdateEvent; //导入依赖的package包/类
@Override
protected void onInit()
{
scriptExecutor = ScriptExecutorFactory.createCheckpointScriptExecutor(player);
hudWidget = new RacingHudWidget(rootEventManager, raceService, player, this);
hudWidget.init();
addDestroyable(hudWidget);
if (player.isInAnyVehicle()) lastVehicleModel = player.getVehicle().getModelId();
eventManagerNode.registerHandler(PlayerUpdateEvent.class, HandlerPriority.NORMAL, Attentions.create().object(player), (e) ->
{
if (player.getUpdateCount() % 40 != 0) return;
updateMapIcons();
});
eventManagerNode.registerHandler(PlayerDeathEvent.class, HandlerPriority.NORMAL, Attentions.create().object(player), (e) ->
{
if (racing.getSetting().getDeathRule() == DeathRule.KNOCKOUT) racing.leave(player);
});
eventManagerNode.registerHandler(PlayerSpawnEvent.class, HandlerPriority.BOTTOM, Attentions.create().object(player), (e) ->
{
if (lastVehicleModel != 0)
{
createTempVehicle(lastVehicleModel);
tempVehicle.setLocation(lastPassLocation);
tempVehicle.setVelocity(lastPassVelocity);
}
else
{
player.setLocation(lastPassLocation);
}
});
eventManagerNode.registerHandler(PlayerStateChangeEvent.class, HandlerPriority.NORMAL, Attentions.create().object(player), (e) ->
{
if (player.isInAnyVehicle()) lastVehicleModel = player.getVehicle().getModelId();
});
}