当前位置: 首页>>代码示例>>Java>>正文


Java PaginationList类代码示例

本文整理汇总了Java中org.spongepowered.api.service.pagination.PaginationList的典型用法代码示例。如果您正苦于以下问题:Java PaginationList类的具体用法?Java PaginationList怎么用?Java PaginationList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PaginationList类属于org.spongepowered.api.service.pagination包,在下文中一共展示了PaginationList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import org.spongepowered.api.service.pagination.PaginationList; //导入依赖的package包/类
@Override
public CommandResult execute(CommandSource source, CommandContext context) throws CommandException
{
    HashSet<Faction> factionsList = new HashSet<>(FactionLogic.getFactions());
    List<Text> helpList = new ArrayList<>();

    for(Faction faction: factionsList)
    {
        String tag = "";
        if(faction.Tag != null && !faction.Tag.equals("")) tag = "[" + faction.Tag + "] ";

        Text factionHelp = Text.builder()
                .append(Text.builder()
                        .append(Text.of(TextColors.AQUA, "- " + tag + faction.Name + " (" + faction.Power + "/" + PowerService.getFactionMaxPower(faction) + ")"))
                        .build())
                .build();

        helpList.add(factionHelp);
    }

    PaginationService paginationService = Sponge.getServiceManager().provide(PaginationService.class).get();
    PaginationList.Builder paginationBuilder = paginationService.builder().title(Text.of(TextColors.GREEN, "Factions List")).padding(Text.of("-")).contents(helpList);
    paginationBuilder.sendTo(source);

    return CommandResult.success();
}
 
开发者ID:Aquerr,项目名称:EagleFactions,代码行数:27,代码来源:ListCommand.java

示例2: execute

import org.spongepowered.api.service.pagination.PaginationList; //导入依赖的package包/类
@Override
public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
    List<Camera> cams = new ArrayList<>(plugin.getCameras().values());
    cams.removeIf((cam)-> !cam.canUseCamera(src));

    Iterable<Text> texts = cams.parallelStream().map((cam)->
            plugin.translations.CAMERA_LIST_ITEM.apply(cam.templateVariables())
            .onHover(TextActions.showText(
                    plugin.translations.CAMERA_LIST_ITEM_HOVER.apply(cam.templateVariables()).build()
            ))
            .onClick(TextActions.runCommand("/camera view " + cam.getId())).build()
    ).collect(Collectors.toList());

    PaginationList.builder()
            .title(plugin.translations.CAMERA_LIST_TITLE)
            .contents(texts)
            .sendTo(src);

    return CommandResult.success();
}
 
开发者ID:Lergin,项目名称:Vigilate,代码行数:21,代码来源:ListCamerasCommand.java

示例3: execute

import org.spongepowered.api.service.pagination.PaginationList; //导入依赖的package包/类
@Override
public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
	List<Text> contents = new ArrayList<>();

	contents.add(Text.of(TextColors.GOLD, "/cs help", TextColors.GRAY, " - ", TextColors.YELLOW, "Print a link to the wiki"));
	contents.add(Text.of(TextColors.GOLD, "/cs hide", TextColors.GRAY, " - ", TextColors.YELLOW, "Hide sign usage from chat"));
	contents.add(Text.of(TextColors.GOLD, "/cs report", TextColors.GRAY, " - ", TextColors.YELLOW, "Generate a personal shop report"));
	contents.add(Text.of(TextColors.GOLD, "/cs servreport", TextColors.GRAY, " - ", TextColors.YELLOW, "Generate a server shop report"));
	contents.add(Text.of(TextColors.GOLD, "/cs report [player]", TextColors.GRAY, " - ", TextColors.YELLOW, "Generate a shop report for another player"));
	contents.add(Text.of(TextColors.GOLD, "/cs config", TextColors.GRAY, " - ", TextColors.YELLOW, "Change config of the plugin"));

	PaginationList.builder()
	.title(Text.of(TextColors.GOLD, "{ ", TextColors.YELLOW, "/carrotshop", TextColors.GOLD, " }"))
	.contents(contents)
	.padding(Text.of("-"))
	.sendTo(src);
	return CommandResult.success();
}
 
开发者ID:TheoKah,项目名称:CarrotShop,代码行数:19,代码来源:ShopMainExecutor.java

示例4: execute

import org.spongepowered.api.service.pagination.PaginationList; //导入依赖的package包/类
public CommandResult execute(CommandSource src, CommandContext ctx) throws CommandException
{
	List<Text> contents = new ArrayList<>();
	Iterator<Nation> iter = DataHandler.getNations().values().iterator();
	if (!iter.hasNext())
	{
		contents.add(Text.of(TextColors.YELLOW, LanguageHandler.ERROR_NONATIONYET));
	}
	else
	{
		while (iter.hasNext())
		{
			Nation nation = iter.next();
			if (!nation.isAdmin() || src.hasPermission("nations.admin.nation.listall"))
			{
				contents.add(Text.of(Utils.nationClickable(TextColors.YELLOW, nation.getRealName()), TextColors.GOLD, " [" + nation.getNumCitizens() + "]"));
			}
		}
	}
	PaginationList.builder()
	.title(Text.of(TextColors.GOLD, "{ ", TextColors.YELLOW, LanguageHandler.HEADER_NATIONLIST, TextColors.GOLD, " }"))
	.contents(contents)
	.padding(Text.of("-"))
	.sendTo(src);
	return CommandResult.success();
}
 
开发者ID:Arckenver,项目名称:Nations,代码行数:27,代码来源:NationListExecutor.java

示例5: sendAllNews

import org.spongepowered.api.service.pagination.PaginationList; //导入依赖的package包/类
@Override
    public void sendAllNews(MessageReceiver msgReceiver) throws CommandException {
//        CommandExceptions.doOrThrow("NewsService.sendAllNews()", () -> {
            Iterable<News> newsList = newsRegistry.getAllNews();
            if (Iterables.isEmpty(newsList)) {
                msgReceiver.sendMessage(Texts.inRed("Sorry, no news."));
                return;
            } else {
                PaginationService paginationService = Sponge.getServiceManager().provide(PaginationService.class).get();
                PaginationList.Builder paginationBuilder = paginationService.builder();
                paginationBuilder.title(Text.of("NEWS"));
                paginationBuilder.contents(Iterables.transform(newsList, news -> news2text(news)));
                paginationBuilder.sendTo(msgReceiver);
            }
//        });
    }
 
开发者ID:vorburger,项目名称:ch.vorburger.minecraft.osgi,代码行数:17,代码来源:NewsServiceImpl.java

示例6: execute

import org.spongepowered.api.service.pagination.PaginationList; //导入依赖的package包/类
@Override
public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
    Collection<UserPermission> users = Users.getUsers();
    PaginationList.builder()
            .title(Text.of("Web-API users"))
            .contents(users.stream().map(u -> {
                Text editUser = Text.builder("[Change pw]")
                        .color(TextColors.YELLOW)
                        .onClick(TextActions.suggestCommand("/webapi users changepw " + u.getUsername() + " "))
                        .build();

                Text rmvUser = Text.builder(" [Remove]")
                        .color(TextColors.RED)
                        .onClick(TextActions.suggestCommand("/webapi users remove " + u.getUsername()))
                        .build();

                return Text.builder(u.getUsername() + " ").append(editUser, rmvUser).build();
            }).collect(Collectors.toList()))
            .sendTo(src);
    return CommandResult.success();
}
 
开发者ID:Valandur,项目名称:Web-API,代码行数:22,代码来源:CmdUserList.java

示例7: execute

import org.spongepowered.api.service.pagination.PaginationList; //导入依赖的package包/类
@Override
public CommandResult execute(@Nonnull CommandSource src, CommandContext args) throws CommandException {
    if (this.paginationList.isPresent()) {
        this.paginationList.get().sendTo(src);
    } else {
        final Optional<PaginationList> replacementList = getPaginationList();
        if (replacementList.isPresent()) {
            this.paginationList = replacementList;
            replacementList.get().sendTo(src);
        } else {
            src.sendMessage(Text.of(TextColors.RED, "Pagination service not found, printing out help:"));
            for (Text t : this.contents) {
                src.sendMessage(t);
            }
        }
    }

    return CommandResult.success();
}
 
开发者ID:ichorpowered,项目名称:latch,代码行数:20,代码来源:HelpCommand.java

示例8: showClaims

import org.spongepowered.api.service.pagination.PaginationList; //导入依赖的package包/类
public static void showClaims(CommandSource src, List<Claim> claims, int height, boolean visualizeClaims) {
    final String worldName = src instanceof Player ? ((Player) src).getWorld().getName() : Sponge.getServer().getDefaultWorldName();
    final boolean canListOthers = src.hasPermission(GPPermissions.LIST_OTHER_CLAIMS);
    List<Text> claimsTextList = generateClaimTextList(new ArrayList<Text>(), claims, worldName, null, src, createShowClaimsConsumer(src, claims, height, visualizeClaims), canListOthers, false);

    if (visualizeClaims && src instanceof Player) {
        Player player = (Player) src;
        final GPPlayerData playerData = GriefPreventionPlugin.instance.dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId());
        if (claims.size() > 1) {
            if (height != 0) {
                height = playerData.lastValidInspectLocation != null ? playerData.lastValidInspectLocation.getBlockY() : player.getProperty(EyeLocationProperty.class).get().getValue().getFloorY();
            }
            Visualization visualization = Visualization.fromClaims(claims, playerData.optionClaimCreateMode == 1 ? height : player.getProperty(EyeLocationProperty.class).get().getValue().getFloorY(), player.getLocation(), playerData, null);
            visualization.apply(player);
        } else {
            GPClaim gpClaim = (GPClaim) claims.get(0);
            gpClaim.getVisualizer().createClaimBlockVisuals(height, player.getLocation(), playerData);
            gpClaim.getVisualizer().apply(player);
        }
    }

    PaginationService paginationService = Sponge.getServiceManager().provide(PaginationService.class).get();
    PaginationList.Builder paginationBuilder = paginationService.builder()
            .title(Text.of(TextColors.RED,"Claim list")).padding(Text.of(TextStyles.STRIKETHROUGH, "-")).contents(claimsTextList);
    paginationBuilder.sendTo(src);
}
 
开发者ID:MinecraftPortCentral,项目名称:GriefPrevention,代码行数:27,代码来源:CommandHelper.java

示例9: executeAsync

import org.spongepowered.api.service.pagination.PaginationList; //导入依赖的package包/类
@Override
public void executeAsync(CommandSource src, CommandContext ctx)
{
	ArrayList<String> worlds = EssentialCmds.getEssentialCmds().getGame().getServer().getWorlds().stream().filter(world -> world.getProperties().isEnabled()).map(World::getName).collect(Collectors.toCollection(ArrayList::new));

	PaginationService paginationService = Sponge.getServiceManager().provide(PaginationService.class).get();
	ArrayList<Text> worldText = Lists.newArrayList();

	for (String name : worlds)
	{
		Text item = Text.builder(name)
			.onClick(TextActions.runCommand("/tpworld " + name))
			.onHover(TextActions.showText(Text.of(TextColors.WHITE, "Teleport to world ", TextColors.GOLD, name)))
			.color(TextColors.DARK_AQUA)
			.style(TextStyles.UNDERLINE)
			.build();

		worldText.add(item);
	}

	PaginationList.Builder paginationBuilder = paginationService.builder().contents(worldText).title(Text.of(TextColors.GREEN, "Showing Worlds")).padding(Text.of("-"));
	paginationBuilder.sendTo(src);
}
 
开发者ID:hsyyid,项目名称:EssentialCmds,代码行数:24,代码来源:WorldsBase.java

示例10: executeAsync

import org.spongepowered.api.service.pagination.PaginationList; //导入依赖的package包/类
@Override
public void executeAsync(CommandSource src, CommandContext ctx)
{
	ArrayList<String> rules = Utils.getRules();
	List<Text> ruleText = Lists.newArrayList();
	
	if (rules.isEmpty())
	{
		src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "The rules for this server are not defined."));
		return;
	}

	for (String rule : rules)
	{
		ruleText.add(Text.of(TextColors.GRAY, (rules.indexOf(rule) + 1) + ". ", TextColors.GOLD, rule));
	}

	PaginationService paginationService = Sponge.getServiceManager().provide(PaginationService.class).get();
	PaginationList.Builder paginationBuilder = paginationService.builder().contents(ruleText).title(Text.of(TextColors.GOLD, "Rules")).padding(Text.of("-"));
	paginationBuilder.sendTo(src);
}
 
开发者ID:hsyyid,项目名称:EssentialCmds,代码行数:22,代码来源:RuleExecutor.java

示例11: sendPlayerInfo

import org.spongepowered.api.service.pagination.PaginationList; //导入依赖的package包/类
@Override
public void sendPlayerInfo(IActiveCharacter character, List<CharacterBase> target) {
	PaginationService paginationService = game.getServiceManager().provide(PaginationService.class).get();
	PaginationList.Builder builder = paginationService.builder();
	builder.padding(Text.builder("=").color(TextColors.GREEN).build());
	List<Text> content = new ArrayList<>();
	for (CharacterBase characterBase : target) {
		String name = characterBase.getName();
		int level = character.getPrimaryClass().getLevel();
		String name1 = character.getRace().getName();
		Text.Builder b = Text.builder();
		b.append(Text.builder(" [").color(TextColors.DARK_GRAY).build())
				.append(Text.builder("SELECT").color(TextColors.GREEN).build())
				.append(Text.builder("] - ").color(TextColors.DARK_GRAY).build());
		b.append(Text.of(name));
		if (character.getPrimaryClass() != ExtendedNClass.Default) {
			b.append(Text.builder(" ").build()).append(Text.of(level));
		}
		if (character.getRace() != Race.Default) {
			b.append(Text.of(name1));
		}
		content.add(b.build());
	}
	builder.contents(content);
	builder.sendTo(character.getPlayer());
}
 
开发者ID:NeumimTo,项目名称:NT-RPG,代码行数:27,代码来源:VanilaMessaging.java

示例12: sendListOfRunes

import org.spongepowered.api.service.pagination.PaginationList; //导入依赖的package包/类
@Override
public void sendListOfRunes(IActiveCharacter character) {
	PaginationService paginationService = Sponge.getServiceManager().provide(PaginationService.class).get();
	PaginationList.Builder builder = paginationService.builder();

	List<Text> content = new ArrayList<>();
	List<Rune> r = new ArrayList<>(rwService.getRunes().values());
	Collections.sort(r, (o1, o2) -> (int) (o1.getSpawnchance() - o2.getSpawnchance()));
	for (Rune rune : r) {
		LiteralText.Builder b = Text.builder(rune.getName()).color(TextColors.GOLD);
		if (rune.getLore() != null) {
			b.append(Text.of(" - " + rune.getLore(), TextColors.WHITE, TextStyles.ITALIC));
		}
		content.add(b.build());
	}
	builder.contents(content);
	builder.linesPerPage(10);
	builder.padding(Text.builder("=").color(TextColors.DARK_GRAY).build());
	builder.sendTo(character.getPlayer());


}
 
开发者ID:NeumimTo,项目名称:NT-RPG,代码行数:23,代码来源:VanilaMessaging.java

示例13: listBuilder

import org.spongepowered.api.service.pagination.PaginationList; //导入依赖的package包/类
private PaginationList.Builder listBuilder(WorldProperties world,
                                           Map<String, List<Graveyard>> graveyardMap, Graveyards plugin) {

    List<Text> graveyardInfo = new ArrayList<>();
    graveyardMap.forEach((name, list) -> {
        graveyardInfo.add(Text.of(TextColors.GREEN, name, ":"));
        graveyardInfo.addAll(list.stream().map(graveyard -> Text.of("  ", graveyard.getName(), ": ",
                graveyard.getLocation().toString())).collect(Collectors.toList()));
    });

    PaginationService pagServ = plugin.getGame().getServiceManager().provide(PaginationService.class).get();
    PaginationList.Builder builder = pagServ.builder();
    builder.contents(graveyardInfo)
            .title(Text
                    .builder("Graveyards in ")
                    .color(TextColors.GREEN)
                    .append(Text.builder(world.getWorldName())
                            .color(TextColors.DARK_GREEN).build()).build())
            .padding(Text.of("-"));
    return builder;
}
 
开发者ID:Zerthick,项目名称:Graveyards,代码行数:22,代码来源:GraveyardListExecutor.java

示例14: sendPaginatedMessage

import org.spongepowered.api.service.pagination.PaginationList; //导入依赖的package包/类
private void sendPaginatedMessage(Node node, CommandSource source) {
    PaginationService paginationService = Sponge.getServiceManager().provide(PaginationService.class).get();
    PaginationList.Builder builder = paginationService.builder();
    List<Text> contents = node.getSubcategories().stream()
            .map(category -> Text.builder("> " + category.getName()).color(TextColors.GRAY).onClick(TextActions.executeCallback(commandSource -> {
                if (commandSource instanceof Player) {
                    sendPaginatedMessage(node.getChild(category), source);
                }
            })).build()).collect(Collectors.toList());
    for (Package p : node.getPackages()) {
        contents.add(Text.builder(p.getName()).color(TextColors.WHITE).append(Text.builder(" - ").color(TextColors.GRAY).build())
                .append(Text.builder("$x".replace("$", plugin.getServerInformation().getAccount().getCurrency().getSymbol())
                        .replace("x", "" + p.getEffectivePrice())).color(TextColors.GREEN).build())
                .onClick(TextActions.executeCallback(commandSource -> {
                    if (commandSource instanceof Player) {
                        plugin.getPlatform().executeAsync(new SendCheckoutLinkTask(plugin, p.getId(), (Player) commandSource));
                    }
                })).build());
    }
    builder.title(Text.builder(plugin.getI18n().get("sponge_listing")).color(TextColors.AQUA).build()).contents(contents).padding(Text.of("-")).sendTo(source);
}
 
开发者ID:BuycraftPlugin,项目名称:BuycraftX,代码行数:22,代码来源:ListPackagesCmd.java

示例15: execute

import org.spongepowered.api.service.pagination.PaginationList; //导入依赖的package包/类
@Override
public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException {
    checkPermission(sender, JailPermissions.UC_JAIL_JAILLIST_BASE);
    List<Jail> jails = GlobalData.get(JailKeys.JAILS).get();
    List<Text> texts = new ArrayList<>();

    //Add entry to texts for every jail
    for (Jail jail : jails) {
        texts.add(Messages.getFormatted("jail.command.jaillist.entry", "%jail%", jail.getName(), "%description%", jail.getDescription()).toBuilder().onHover(TextActions.showText(Messages.getFormatted("jail.command.jaillist.hoverentry", "%jail%", jail.getName()))).onClick(TextActions.runCommand("/jailtp " + jail.getName())).build());
    }

    //If empty send message
    if (texts.isEmpty()) {
        throw new ErrorMessageException(Messages.getFormatted(sender, "jail.command.jaillist.empty"));
    }

    //Sort alphabetically
    Collections.sort(texts);

    //Send page
    PaginationService paginationService = Sponge.getServiceManager().provide(PaginationService.class).get();
    PaginationList paginationList = paginationService.builder().contents(texts).title(Messages.getFormatted("jail.command.jaillist.header").toBuilder().color(TextColors.DARK_GREEN).build()).build();
    paginationList.sendTo(sender);
    return CommandResult.success();
}
 
开发者ID:Bammerbom,项目名称:UltimateCore,代码行数:26,代码来源:JaillistCommand.java


注:本文中的org.spongepowered.api.service.pagination.PaginationList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。