本文整理汇总了Java中org.spongepowered.api.entity.living.player.Player.offer方法的典型用法代码示例。如果您正苦于以下问题:Java Player.offer方法的具体用法?Java Player.offer怎么用?Java Player.offer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.spongepowered.api.entity.living.player.Player
的用法示例。
在下文中一共展示了Player.offer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setPlayer
import org.spongepowered.api.entity.living.player.Player; //导入方法依赖的package包/类
void setPlayer(Player player, Trail trail) {
boolean existed = false;
for (final Map.Entry<PlayerWrapper, Trail> next : this.playerTrails.entrySet()) {
if (next.getKey().playerId.equals(player.getUniqueId())) {
next.setValue(trail);
existed = true;
break;
}
}
if (!existed) {
this.playerTrails.put(new PlayerWrapper(player), trail);
}
final TrailData trailData = player.get(TrailData.class).orElseGet(() -> new TrailData(trail));
trailData.setTrail(trail);
player.offer(trailData);
}
示例2: setDisplayName
import org.spongepowered.api.entity.living.player.Player; //导入方法依赖的package包/类
@Override
public void setDisplayName(String name) {
if(!Sponge.isServerAvailable()) return;
Optional<Player> optionalP = Sponge.getServer().getPlayer(this.getUniqueId());
if(!optionalP.isPresent()) return;
Player p = optionalP.get();
p.offer(Keys.DISPLAY_NAME, Text.of(name)); //TODO: Formatting issues may occur
}
示例3: viewCamera
import org.spongepowered.api.entity.living.player.Player; //导入方法依赖的package包/类
public void viewCamera(Player player){
if(!this.canUseCamera(player)){
return; // shouldn't have the ability to even execute the command
}
if (player.supports(VigilateKeys.OLD_GAME_MODE)) {
player.get(VigilateKeys.CAMERA).orElse("");
if(Vigilate.getInstance().getCameras().containsKey(id)){
Vigilate.getInstance().getCameras().get(id).endViewCamera(player);
}
}
player.offer(new ViewerDataManipulatorBuilder().create());
player.getValue(Keys.GAME_MODE).ifPresent(
(value -> player.offer(VigilateKeys.OLD_GAME_MODE, value.get()))
);
player.getValue(Keys.IS_FLYING).ifPresent(
(value -> player.offer(VigilateKeys.OLD_IS_FLYING, value.get()))
);
player.getValue(Keys.AFFECTS_SPAWNING).ifPresent(
(value -> player.offer(VigilateKeys.OLD_AFFECTS_SPAWNING, value.get()))
);
player.getValue(Keys.VANISH).ifPresent(
(value -> player.offer(VigilateKeys.OLD_VANISH, value.get()))
);
player.getValue(Keys.VANISH_PREVENTS_TARGETING).ifPresent(
(value -> player.offer(VigilateKeys.OLD_VANISH_PREVENTS_TARGETING, value.get()))
);
player.getValue(Keys.VANISH_IGNORES_COLLISION).ifPresent(
(value -> player.offer(VigilateKeys.OLD_VANISH_IGNORES_COLLISION, value.get()))
);
player.getValue(Keys.FLYING_SPEED).ifPresent(
(value -> player.offer(VigilateKeys.OLD_FLYING_SPEED, value.get()))
);
player.offer(VigilateKeys.OLD_LOCATION_WORLD, player.getLocation().getExtent().getName());
player.offer(VigilateKeys.OLD_LOCATION_X, player.getLocation().getX());
player.offer(VigilateKeys.OLD_LOCATION_Y, player.getLocation().getY());
player.offer(VigilateKeys.OLD_LOCATION_Z, player.getLocation().getZ());
player.offer(Keys.GAME_MODE, GameModes.CREATIVE);
player.offer(Keys.AFFECTS_SPAWNING, false);
player.offer(Keys.VANISH, true);
player.offer(Keys.VANISH_PREVENTS_TARGETING, true);
player.offer(Keys.VANISH_IGNORES_COLLISION, true);
player.offer(Keys.FLYING_SPEED, 0.0);
player.offer(Keys.IS_FLYING, true);
player.offer(VigilateKeys.CAMERA, this.getId());
player.setLocation(this.getLocation());
Title title = Title.builder()
.fadeIn(20)
.fadeOut(20)
.title(Text.EMPTY)
.subtitle(plugin.translations.CAMERA_VIEW_TITLE.apply(this.templateVariables()).toText())
.stay(100000)
.build();
player.sendTitle(title);
player.sendMessage(plugin.translations.CAMERA_VIEW, this.templateVariables());
}