本文整理匯總了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);
}
示例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();
}