本文整理匯總了Java中org.spongepowered.api.event.Order.POST屬性的典型用法代碼示例。如果您正苦於以下問題:Java Order.POST屬性的具體用法?Java Order.POST怎麽用?Java Order.POST使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.spongepowered.api.event.Order
的用法示例。
在下文中一共展示了Order.POST屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onLiquidFlow
@Listener(order = Order.POST)
public void onLiquidFlow(ChangeBlockEvent.Pre e) {
if (e.getLocations().isEmpty()) return;
Location<World> loc = e.getLocations().get(0);
BlockSnapshot snapshot = loc.getExtent().createSnapshot(loc.getBlockPosition());
Optional<MatterProperty> matter = snapshot.getState().getProperty(MatterProperty.class);
if (matter.isPresent() && matter.get().getValue() == Matter.LIQUID) {
String name = "Water";
BlockType type = snapshot.getState().getType();
if (type == BlockTypes.LAVA || type == BlockTypes.FLOWING_LAVA)
name = "Lava";
db.addToQueue(new BlockQueueEntry(snapshot, ActionType.FLOW, name, new Date().getTime()));
}
}
示例2: onPlayerQuit
@Listener(order = Order.POST)
public void onPlayerQuit(ClientConnectionEvent.Disconnect event) {
Optional<Challenger> ch = CommonCore.getChallenger(event.getTargetEntity().getUniqueId());
if (ch.isPresent()) {
// store the player to disk so their inventory and location can be popped later
((InfernoRound) ch.get().getRound()).removeChallenger(ch.get(), true, true);
CommonPlayerHelper.setOfflineFlag(event.getTargetEntity().getUniqueId());
}
for (Minigame mg : CommonCore.getMinigames().values()) {
if (((InfernoMinigame) mg).getLobbyWizardManager().hasPlayer(event.getTargetEntity().getUniqueId())) {
((InfernoMinigame) mg).getLobbyWizardManager().removePlayer(event.getTargetEntity().getUniqueId());
break;
}
}
}
示例3: pickupItem
@Listener(order = Order.POST)
@Exclude({ChangeInventoryEvent.Pickup.Pre.class})
public void pickupItem(ChangeInventoryEvent.Pickup event, @Root Player player) {
List<SlotTransaction> transactions = event.getTransactions();
if (transactions.isEmpty()) {
return;
}
int itemQuantity = transactions.get(0).getFinal().getQuantity() - transactions.get(0).getOriginal().getQuantity();
// Sometimes it's 0 for some odd reason
if (itemQuantity == 0) {
return;
}
processEvent(event, player, itemQuantity);
}
示例4: onBlockPlace
@Listener(order = Order.POST)
public void onBlockPlace(ChangeBlockEvent.Place e, @Root Player p) {
long time = new Date().getTime();
for (Transaction<BlockSnapshot> transaction : e.getTransactions()) {
UUID id = p.getUniqueId();
if (transaction.getOriginal().getState().getType() != BlockTypes.AIR) {
db.addToQueue(new BlockQueueEntry(transaction.getOriginal(), ActionType.DESTROY, id.toString(), time));
}
db.addToQueue(new BlockQueueEntry(transaction.getFinal(), ActionType.PLACE, id.toString(), time));
}
}
示例5: onBlockBreak
@Listener(order = Order.POST)
public void onBlockBreak(ChangeBlockEvent.Break e, @Root Player p) {
long time = new Date().getTime();
for (Transaction<BlockSnapshot> transaction : e.getTransactions()) {
db.addToQueue(new BlockQueueEntry(transaction.getOriginal(), ActionType.DESTROY, p.getUniqueId().toString(), time));
}
}
示例6: onBlockPlace
@Listener(order = Order.POST)
public void onBlockPlace(ChangeBlockEvent.Place e, @Root Agent a) {
if (a instanceof Player) return;
long time = new Date().getTime();
for (Transaction<BlockSnapshot> transaction : e.getTransactions()) {
String type = a.getType().getName();
if (transaction.getOriginal().getState().getType() != BlockTypes.AIR) {
db.addToQueue(new BlockQueueEntry(transaction.getOriginal(), ActionType.MOB_DESTROY, type, time));
}
db.addToQueue(new BlockQueueEntry(transaction.getFinal(), ActionType.MOB_PLACE, type, time));
}
}
示例7: onBlockBreak
@Listener(order = Order.POST)
public void onBlockBreak(ChangeBlockEvent.Break e, @Root Agent a) {
if (a instanceof Player) return;
long time = new Date().getTime();
for (Transaction<BlockSnapshot> transaction : e.getTransactions()) {
db.addToQueue(new BlockQueueEntry(transaction.getOriginal(), ActionType.MOB_DESTROY, a.getType().getName(), time));
}
}
示例8: onBlockPlace
@Listener(order = Order.POST)
public void onBlockPlace(ChangeBlockEvent.Place e, @Root Entity ent) {
if (ent instanceof Player || ent instanceof Agent) return;
long time = new Date().getTime();
for (Transaction<BlockSnapshot> transaction : e.getTransactions()) {
String name = ent.getType().getName();
if (transaction.getOriginal().getState().getType() != BlockTypes.AIR) {
db.addToQueue(new BlockQueueEntry(transaction.getOriginal(), ActionType.MOB_DESTROY, name, time));
}
db.addToQueue(new BlockQueueEntry(transaction.getFinal(), ActionType.MOB_PLACE, name, time));
}
}
示例9: onBlockBreak
@Listener(order = Order.POST)
public void onBlockBreak(ChangeBlockEvent.Break e, @Root Entity ent) {
if (ent instanceof Player || ent instanceof Agent) return;
long time = new Date().getTime();
for (Transaction<BlockSnapshot> transaction : e.getTransactions()) {
db.addToQueue(new BlockQueueEntry(transaction.getOriginal(), ActionType.MOB_DESTROY, ent.getType().getName(), time));
}
}
示例10: onServerStart
@Listener(order = Order.POST)
public void onServerStart(GameStartedServerEvent event) {
// Hey! The server has started!
this.logger.info("Hello world!");
// Try loading some configuration settings for a welcome message to players
// when they join!
this.particleTask = Task.builder()
.intervalTicks(1)
.name("Particle Spawner")
.execute(() -> {
if (this.playerTrails.isEmpty()) {
return;
}
final Iterator<Map.Entry<PlayerWrapper, Trail>> iterator = this.playerTrails.entrySet().iterator();
for (; iterator.hasNext(); ) {
Map.Entry<PlayerWrapper, Trail> entry = iterator.next();
final Trail value = entry.getValue();
final PlayerWrapper playerId = entry.getKey();
final Player player;
try {
player = playerId.getPlayer();
} catch (Exception e) {
iterator.remove();
continue;
}
if (playerId.cooldown > 0) {
playerId.cooldown--;
continue;
}
playerId.cooldown = value.period;
value.playEffect(player);
}
})
.submit(this);
}
示例11: onOutgoingMessage
@Listener(order = Order.POST)
public void onOutgoingMessage(MessageChannelEvent event) {
if (!event.getChannel().isPresent() || event.isMessageCancelled()) {
return;
}
CommandSource source = null;
Object rootCause = event.getCause().root();
if (rootCause instanceof CommandSource) {
source = (CommandSource) rootCause;
}
event.setChannel(new WrapOutputChannel(event.getChannel().get(), source));
}
示例12: onClientLeave
@Listener(order = Order.POST)
public void onClientLeave(ClientConnectionEvent.Disconnect e) {
/* We don't actually remove the user instance here, as Sponge likes to keep performing checks
on players when they disconnect. The instance gets cleared up on a housekeeping task
after a period of inactivity. */
final UuidCache cache = this.plugin.getUuidCache();
// Unload the user from memory when they disconnect
cache.clearCache(e.getTargetEntity().getUniqueId());
// Register with the housekeeper, so the User's instance will stick
// around for a bit after they disconnect
this.plugin.getUserManager().getHouseKeeper().registerUsage(e.getTargetEntity().getUniqueId());
}
示例13: onBlockUpdateStatusChange
@Listener(order = Order.POST)
public void onBlockUpdateStatusChange(BlockOperationStatusChangeEvent event) {
BlockOperation on = event.getBlockOperation();
switch (on.getStatus()) {
case DONE:
logger.info("Block op " + on.getUUID() + " is done");
break;
case ERRORED:
logger.warn("Block op " + on.getUUID() + " failed: " + on.getError());
break;
case CANCELED:
logger.info("Block op " + on.getUUID() + " was canceled");
break;
case PAUSED:
logger.info("Block op " + on.getUUID() + " paused");
break;
case RUNNING:
logger.info("Block op " + on.getUUID() + " started");
break;
}
webHookService.notifyHooks(WebHookService.WebHookType.BLOCK_OPERATION_STATUS, event);
}
示例14: onChangeInventory
@Listener(order = Order.POST)
public void onChangeInventory(ChangeInventoryEvent event) {
if (event.getTargetInventory() instanceof CarriedInventory<?>) {
Optional<?> carrier = ((CarriedInventory) event.getTargetInventory()).getCarrier();
if (carrier.isPresent() && carrier.get() instanceof TileEntityCarrier) {
checkBlockChange(((TileEntityCarrier) carrier.get()).getLocation().createSnapshot());
}
}
}
示例15: onTargetEntity
@Listener(order = Order.POST)
public void onTargetEntity(TargetEntityEvent event) {
if (event instanceof MoveEntityEvent) {
return; // listening to move events is not f*cking necessary
}
if (event.getTargetEntity().getType() != EntityTypes.PLAYER) {
InfernoRollbackAgent.checkEntityChange(event.getTargetEntity());
}
}