本文整理汇总了Java中org.spongepowered.api.util.Identifiable类的典型用法代码示例。如果您正苦于以下问题:Java Identifiable类的具体用法?Java Identifiable怎么用?Java Identifiable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Identifiable类属于org.spongepowered.api.util包,在下文中一共展示了Identifiable类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: accumulateContexts
import org.spongepowered.api.util.Identifiable; //导入依赖的package包/类
@Override
public void accumulateContexts(Subject calculable, Set<Context> accumulator)
{
Optional<CommandSource> sourceOptional = calculable.getCommandSource();
if (sourceOptional.isPresent())
{
CommandSource source = sourceOptional.get();
if (source instanceof Identifiable)
{
UUID uuid = ((Identifiable) source).getUniqueId();
if (this.plugin.getVirtualChestActions().isPlayerActivated(uuid))
{
accumulator.add(this.contextInAction);
SubjectData data = source.getTransientSubjectData();
Map<String, Boolean> permissions = data.getPermissions(Collections.singleton(this.contextInAction));
this.logger.debug("Ignored {} permission(s) for {} (context):", permissions.size(), uuid);
permissions.forEach((permission, state) -> this.logger.debug("- {} ({})", permission, state));
}
else
{
accumulator.add(this.contextNotInAction);
}
}
}
}
开发者ID:ustc-zzzz,项目名称:VirtualChest,代码行数:26,代码来源:VirtualChestPermissionManager.java
示例2: matches
import org.spongepowered.api.util.Identifiable; //导入依赖的package包/类
@Override
public boolean matches(Context context, Subject subject)
{
Optional<CommandSource> sourceOptional = subject.getCommandSource();
if (sourceOptional.isPresent())
{
CommandSource source = sourceOptional.get();
if (source instanceof Identifiable)
{
UUID uuid = ((Identifiable) source).getUniqueId();
if (this.plugin.getVirtualChestActions().isPlayerActivated(uuid))
{
return this.contextInAction.equals(context);
}
else
{
return this.contextNotInAction.equals(context);
}
}
}
return false;
}
开发者ID:ustc-zzzz,项目名称:VirtualChest,代码行数:23,代码来源:VirtualChestPermissionManager.java
示例3: getID
import org.spongepowered.api.util.Identifiable; //导入依赖的package包/类
@Override
public String getID(CommandSource commandSource) {
if (commandSource instanceof Identifiable) {
Identifiable identifiable = (Identifiable) commandSource;
return identifiable.getUniqueId().toString();
} else {
throw new IllegalArgumentException("Not (yet?) implemented: " + commandSource.toString());
}
}
开发者ID:vorburger,项目名称:SwissKnightMinecraft,代码行数:10,代码来源:CommandSourceIdentifierHelperImpl.java
示例4: getUUID
import org.spongepowered.api.util.Identifiable; //导入依赖的package包/类
@Override
public UUID getUUID(String name) {
Optional<Player> player = Sponge.getServer().getPlayer(name);
if (player.isPresent()) {
return player.get().getUniqueId();
}
Optional<User> user = userStorageService.get(name);
return user.map(Identifiable::getUniqueId).orElse(null);
}
开发者ID:IntellectualSites,项目名称:PlotSquared,代码行数:10,代码来源:SpongeOnlineUUIDWrapper.java
示例5: getArmorStandAt
import org.spongepowered.api.util.Identifiable; //导入依赖的package包/类
public Optional<ArmorStand> getArmorStandAt(Block block) {
return blockToArmorStand.computeIfAbsent(block, k -> findArmorStandAt(k).map(Identifiable::getUniqueId))
.flatMap(id -> block.getWorld().flatMap(extent -> extent.getEntity(id)).map(ArmorStand.class::cast));
}
开发者ID:Limeth,项目名称:CustomItemLibrary,代码行数:5,代码来源:CustomItemServiceImpl.java
示例6: execute
import org.spongepowered.api.util.Identifiable; //导入依赖的package包/类
@Override
public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
if (!(src instanceof Player)) {
src.sendMessage(Text.of("You must be a player to use this command (for now ;) )!"));
return CommandResult.empty();
}
Optional<RegionService> optService = Sponge.getServiceManager().provide(RegionService.class);
if (!optService.isPresent()) {
src.sendMessage(Text.of(TextColors.DARK_RED, "The region service is not currently running."));
return CommandResult.empty();
}
RegionService service = optService.get();
Player player = (Player) src;
Optional<Region> optRef = service.getSelectedRegion(player);
if (!optRef.isPresent()) {
player.sendMessage(Text.of(TextColors.RED, "You do not currently have a region selected."));
return CommandResult.empty();
}
Region ref = optRef.get();
if (!ref.getMembers().contains(player.getUniqueId())) {
player.sendMessage(Text.of(TextColors.RED, "You must be a member of the region to modify it!"));
return CommandResult.empty();
}
List<UUID> newMembers = args.<User>getAll("player").stream().map(Identifiable::getUniqueId).filter(
a -> !ref.getMembers().contains(a)
).collect(Collectors.toList());
ref.addMember(newMembers);
player.sendMessage(Text.of(TextColors.YELLOW, "Added ", newMembers.size(), " players to the region."));
return CommandResult.success();
}
开发者ID:Skelril,项目名称:Skree,代码行数:42,代码来源:RegionAddMemberCommand.java
示例7: execute
import org.spongepowered.api.util.Identifiable; //导入依赖的package包/类
@Override
public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
if (!(src instanceof Player)) {
src.sendMessage(Text.of("You must be a player to use this command (for now ;) )!"));
return CommandResult.empty();
}
Optional<RegionService> optService = Sponge.getServiceManager().provide(RegionService.class);
if (!optService.isPresent()) {
src.sendMessage(Text.of(TextColors.DARK_RED, "The region service is not currently running."));
return CommandResult.empty();
}
RegionService service = optService.get();
Player player = (Player) src;
Optional<Region> optRef = service.getSelectedRegion(player);
if (!optRef.isPresent()) {
player.sendMessage(Text.of(TextColors.RED, "You do not currently have a region selected."));
return CommandResult.empty();
}
Region ref = optRef.get();
if (!ref.getMembers().contains(player.getUniqueId())) {
player.sendMessage(Text.of(TextColors.RED, "You must be a member of the region to modify it!"));
return CommandResult.empty();
}
List<UUID> oldMembers = args.<User>getAll("player").stream().map(Identifiable::getUniqueId).filter(
a -> ref.getMembers().contains(a)
).collect(Collectors.toList());
ref.remMember(oldMembers);
player.sendMessage(Text.of(TextColors.YELLOW, "Removed ", oldMembers.size(), " players from the region."));
return CommandResult.success();
}
开发者ID:Skelril,项目名称:Skree,代码行数:42,代码来源:RegionRemMemberCommand.java
示例8: toUUID
import org.spongepowered.api.util.Identifiable; //导入依赖的package包/类
private UUID toUUID(CommandSource src)
{
return src instanceof Identifiable ? ((Identifiable) src).getUniqueId() : UUID.nameUUIDFromBytes(src.getIdentifier().getBytes());
}
开发者ID:CubeEngine,项目名称:modules-main,代码行数:5,代码来源:RegionManager.java
注:本文中的org.spongepowered.api.util.Identifiable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论