當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。