当前位置: 首页>>代码示例>>Java>>正文


Java PlayerUpdateEvent类代码示例

本文整理汇总了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();
        }
    });
}
 
开发者ID:Shoebill,项目名称:shoebill-streamer,代码行数:12,代码来源:PlayerData.java

示例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()));
}
 
开发者ID:GTAUN,项目名称:wl-race,代码行数:13,代码来源:TrackEditor.java

示例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());
       });
     */
}
 
开发者ID:Alf21,项目名称:event-system,代码行数:72,代码来源:PlayerManager.java

示例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();
	});
}
 
开发者ID:GTAUN,项目名称:wl-race,代码行数:42,代码来源:RacingPlayerContentImpl.java


注:本文中的net.gtaun.shoebill.event.player.PlayerUpdateEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。