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


Java Player.remove方法代碼示例

本文整理匯總了Java中org.spongepowered.api.entity.living.player.Player.remove方法的典型用法代碼示例。如果您正苦於以下問題:Java Player.remove方法的具體用法?Java Player.remove怎麽用?Java Player.remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.spongepowered.api.entity.living.player.Player的用法示例。


在下文中一共展示了Player.remove方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: removePlayer

import org.spongepowered.api.entity.living.player.Player; //導入方法依賴的package包/類
void removePlayer(Player player) {
    final Iterator<Map.Entry<PlayerWrapper, Trail>> iterator = this.playerTrails.entrySet().iterator();
    for (; iterator.hasNext(); ) {
        final Map.Entry<PlayerWrapper, Trail> next = iterator.next();
        if (next.getKey().playerId.equals(player.getUniqueId())) {
            iterator.remove();
            break;
        }
    }
    player.remove(TrailData.class);

}
 
開發者ID:gabizou,項目名稱:HappyTrails,代碼行數:13,代碼來源:HappyTrails.java

示例2: resetPlayer

import org.spongepowered.api.entity.living.player.Player; //導入方法依賴的package包/類
static public void resetPlayer(Player player){
    if (player.supports(VigilateKeys.OLD_GAME_MODE)) {

        player.getValue(VigilateKeys.OLD_GAME_MODE).ifPresent(
                (value -> player.offer(Keys.GAME_MODE, value.get()))
        );
        player.getValue(VigilateKeys.OLD_IS_FLYING).ifPresent(
                (value -> player.offer(Keys.IS_FLYING, value.get()))
        );
        player.getValue(VigilateKeys.OLD_AFFECTS_SPAWNING).ifPresent(
                (value -> player.offer(Keys.AFFECTS_SPAWNING, value.get()))
        );
        player.getValue(VigilateKeys.OLD_VANISH).ifPresent(
                (value -> player.offer(Keys.VANISH, value.get()))
        );
        player.getValue(VigilateKeys.OLD_VANISH_PREVENTS_TARGETING).ifPresent(
                (value -> player.offer(Keys.VANISH_PREVENTS_TARGETING, value.get()))
        );
        player.getValue(VigilateKeys.OLD_VANISH_IGNORES_COLLISION).ifPresent(
                (value -> player.offer(Keys.VANISH_IGNORES_COLLISION, value.get()))
        );
        player.getValue(VigilateKeys.OLD_FLYING_SPEED).ifPresent(
                (value -> player.offer(Keys.FLYING_SPEED, value.get()))
        );

        World world = Sponge.getServer().getWorld(
                player.get(VigilateKeys.OLD_LOCATION_WORLD).orElse("world")
        ).orElse(Sponge.getServer().getWorlds().iterator().next());

        Location<World> loc = new Location<>(
                world,
                player.get(VigilateKeys.OLD_LOCATION_X).orElse(0.0),
                player.get(VigilateKeys.OLD_LOCATION_Y).orElse(0.0),
                player.get(VigilateKeys.OLD_LOCATION_Z).orElse(0.0)
        );

        player.setLocation(loc);

        player.remove(ViewerData.class);
    }

    player.clearTitle();
}
 
開發者ID:Lergin,項目名稱:Vigilate,代碼行數:44,代碼來源:Camera.java


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