本文整理匯總了Java中org.spongepowered.api.event.Order.PRE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Order.PRE屬性的具體用法?Java Order.PRE怎麽用?Java Order.PRE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.spongepowered.api.event.Order
的用法示例。
在下文中一共展示了Order.PRE屬性的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onIncomingMessage
@Listener(order = Order.PRE, beforeModifications = true)
@IsCancelled(Tristate.UNDEFINED)
public void onIncomingMessage(MessageChannelEvent.Chat event, @Root Player player) {
if (getView(player).handleIncoming(event.getRawMessage())) {
// No plugins should interpret this as chat
event.setCancelled(true);
event.setChannel(MessageChannel.TO_NONE);
}
}
示例2: onPreInitialize
@Listener(order = Order.PRE)
public void onPreInitialize(GamePreInitializationEvent event) {
InfernoCore.initialize();
CommonDataFiles.createCoreDataFiles();
registerEventListeners();
this.stats.start();
}
示例3: onPlayerJoin
/**
* Link the connection and the player objects as soon as possible.
* @param event The event
*/
@Listener(order = Order.PRE)
public void onPlayerJoin(ClientConnectionEvent.Join event) {
Player player = event.getTargetEntity();
SpongeConnection connection = SpongeConnection.get(player.getConnection());
connection.setPlayer(player);
}
示例4: onPlayerDeath
@Listener(order = Order.PRE)
public void onPlayerDeath(DestructEntityEvent.Death event) {
Optional<DamageSource> optDmgSrc = event.getCause().first(DamageSource.class);
if (optDmgSrc.isPresent() && event.getTargetEntity() instanceof Player) {
if (event.getMessage().toPlain().contains(DAMAGE_TYPE.getId())) {
event.setMessage(Text.of(((Player) event.getTargetEntity()).getName(), " was killed by an ancient enchantment"));
}
}
}
示例5: onPlayerAuth
@Listener(order = Order.PRE)
public void onPlayerAuth(ClientConnectionEvent.Auth event) {
try (Connection con = SQLHandle.getConnection()) {
DSLContext create = DSL.using(con);
UUID uuid = event.getProfile().getUniqueId();
Record1<Timestamp> result = create.select(PLAYERS.LAST_LOGIN).from(PLAYERS).where(PLAYERS.UUID.equal(uuid.toString())).fetchOne();
Timestamp timestamp = result.getValue(PLAYERS.LAST_LOGIN);
lastPlayerLogin.put(uuid, timestamp.getTime());
} catch (SQLException e) {
e.printStackTrace();
}
}
示例6: onPlayerDisconnectPre
@Listener(order=Order.PRE)
public void onPlayerDisconnectPre(final ClientConnectionEvent.Disconnect event) {
this.plugin.getEServer().disconnects.add(event.getTargetEntity().getUniqueId());
}
示例7: onGamePreInit
@Listener(order = Order.PRE)
public void onGamePreInit(GamePreInitializationEvent event) {
this.server = this.game.getServer();
new FaweSponge(this);
Settings.IMP.QUEUE.PARALLEL_THREADS = 1;
}
示例8: onPlayerCombat
@Listener(order = Order.PRE)
public void onPlayerCombat(DamageEntityEvent event) {
createFor(event).parse(event);
}