當前位置: 首頁>>代碼示例>>Java>>正文


Java Order.POST屬性代碼示例

本文整理匯總了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()));
	}
}
 
開發者ID:Karanum,項目名稱:AdamantineShield,代碼行數:16,代碼來源:LiquidFlowListener.java

示例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;
        }
    }
}
 
開發者ID:caseif,項目名稱:Inferno,代碼行數:17,代碼來源:PlayerConnectionListener.java

示例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);
}
 
開發者ID:BadgeUp,項目名稱:badgeup-sponge-client,代碼行數:17,代碼來源:GeneralEventListener.java

示例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));
	}
}
 
開發者ID:Karanum,項目名稱:AdamantineShield,代碼行數:11,代碼來源:PlayerBlockChangeListener.java

示例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));
	}
}
 
開發者ID:Karanum,項目名稱:AdamantineShield,代碼行數:7,代碼來源:PlayerBlockChangeListener.java

示例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));
	}
}
 
開發者ID:Karanum,項目名稱:AdamantineShield,代碼行數:12,代碼來源:MobBlockChangeListener.java

示例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));
	}
}
 
開發者ID:Karanum,項目名稱:AdamantineShield,代碼行數:8,代碼來源:MobBlockChangeListener.java

示例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));
	}
}
 
開發者ID:Karanum,項目名稱:AdamantineShield,代碼行數:12,代碼來源:EntityBlockChangeListener.java

示例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));
	}
}
 
開發者ID:Karanum,項目名稱:AdamantineShield,代碼行數:8,代碼來源:EntityBlockChangeListener.java

示例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);
}
 
開發者ID:gabizou,項目名稱:HappyTrails,代碼行數:36,代碼來源:HappyTrails.java

示例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));
}
 
開發者ID:simon816,項目名稱:ChatUI,代碼行數:12,代碼來源:ChatUILib.java

示例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());
}
 
開發者ID:lucko,項目名稱:LuckPerms,代碼行數:15,代碼來源:SpongeConnectionListener.java

示例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);
}
 
開發者ID:Valandur,項目名稱:Web-API,代碼行數:27,代碼來源:WebAPI.java

示例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());
        }
    }
}
 
開發者ID:caseif,項目名稱:Inferno,代碼行數:9,代碼來源:RollbackInventoryListener.java

示例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());
    }
}
 
開發者ID:caseif,項目名稱:Inferno,代碼行數:10,代碼來源:RollbackEntityListener.java


注:本文中的org.spongepowered.api.event.Order.POST屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。