本文整理汇总了Java中net.gtaun.util.event.HandlerPriority类的典型用法代码示例。如果您正苦于以下问题:Java HandlerPriority类的具体用法?Java HandlerPriority怎么用?Java HandlerPriority使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HandlerPriority类属于net.gtaun.util.event包,在下文中一共展示了HandlerPriority类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: moveObject
import net.gtaun.util.event.HandlerPriority; //导入依赖的package包/类
@Override
public void moveObject(float x, float y, float z, float speed, float rX, float rY, float rZ) {
stopEventNode.cancelAll();
movingObjectsForPlayer.clear();
visibleObjects.entrySet().stream().filter(set -> !set.getValue().isDestroyed()).forEach(set -> {
set.getValue().move(x, y, z, speed, rX, rY, rZ);
movingObjectsForPlayer.add(set.getKey());
stopEventNode.registerHandler(PlayerObjectMovedEvent.class, HandlerPriority.HIGH, Attentions.create().object(set.getValue()), (e) -> {
if(movingObjectsForPlayer.contains(e.getPlayer()))
movingObjectsForPlayer.remove(e.getPlayer());
checkIfAllObjectsMoved(stopEventNode, x, y, z, rX, rY, rZ);
});
stopEventNode.registerHandler(PlayerDisconnectEvent.class, HandlerPriority.HIGH, Attentions.create().object(set.getKey()), (e) -> {
if(movingObjectsForPlayer.contains(e.getPlayer()))
movingObjectsForPlayer.remove(e.getPlayer());
checkIfAllObjectsMoved(stopEventNode, x, y, z, rX, rY, rZ);
});
});
}
开发者ID:Shoebill,项目名称:shoebill-streamer,代码行数:20,代码来源:DynamicSampObjectImpl.java
示例2: editObject
import net.gtaun.util.event.HandlerPriority; //导入依赖的package包/类
@Override
public void editObject(Player player) {
visibleObjects.entrySet().stream().filter(set -> !set.getValue().isDestroyed() && set.getKey() == player)
.forEach(set -> {
set.getKey().editPlayerObject(set.getValue());
final EventManagerNode node = eventManagerNode.createChildNode();
node.registerHandler(PlayerEditPlayerObjectEvent.class, HandlerPriority.NORMAL, Attentions.create().object(player).object(set.getValue()), (e) -> {
if(e.getObject().getId() == SampObject.INVALID_ID) return;
PlayerEditDynamicObject event = new PlayerEditDynamicObject(player, this, e.getEditResponse(), e.getNewLocation(), e.getNewRotation());
eventManager.dispatchEvent(event, player, this);
if(e.getEditResponse() == ObjectEditResponse.CANCEL || e.getEditResponse() == ObjectEditResponse.FINAL) {
if (event.isSave()) {
this.location = e.getNewLocation();
this.rotation = e.getNewRotation();
update();
}
node.cancelAll();
node.destroy();
}
});
});
}
开发者ID:Shoebill,项目名称:shoebill-streamer,代码行数:23,代码来源:DynamicSampObjectImpl.java
示例3: onInit
import net.gtaun.util.event.HandlerPriority; //导入依赖的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
示例4: PlayerOverridePreferences
import net.gtaun.util.event.HandlerPriority; //导入依赖的package包/类
public PlayerOverridePreferences(PlayerPreferences preferences, EventManager eventManager)
{
this.eventManager = eventManager;
this.preferences = preferences;
this.limits = new LinkedList<>();
eventManager.registerHandler(PlayerPreferencesUpdateEvent.class, HandlerPriority.NORMAL, Attentions.create().object(preferences), (e) -> dispatchUpdateEvent());
}
开发者ID:GTAUN,项目名称:wl-vehicle-manager,代码行数:9,代码来源:PlayerOverridePreferences.java
示例5: PlayerManager
import net.gtaun.util.event.HandlerPriority; //导入依赖的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
示例6: onInit
import net.gtaun.util.event.HandlerPriority; //导入依赖的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.util.event.HandlerPriority类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论