com.dsh105.powermessage.core.PowerMessage Java Examples

The following examples show how to use com.dsh105.powermessage.core.PowerMessage. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PetCommand.java    From SonarPet with GNU General Public License v3.0 5 votes vote down vote up
private Paginator<PowerMessage> getHelp(CommandSender sender) {
    ArrayList<PowerMessage> helpMessages = new ArrayList<PowerMessage>();
    for (HelpEntry he : HelpEntry.values()) {
        helpMessages.add(he.getPowerMessage(sender));
    }
    return new Paginator<PowerMessage>(helpMessages, 5);
}
 
Example #2
Source File: ScriptBuilderPrompt.java    From HoloAPI with GNU General Public License v3.0 5 votes vote down vote up
@Override
public String getPromptText(ConversationContext context) {
    if (this.currentlyEditing == 0 && lines.isEmpty()) {
        return ChatColor.DARK_AQUA + "function(hologram, player) {";
    }
    int edit = currentlyEditing;
    currentlyEditing = lines.size() - 1;
    return new PowerMessage().then(edit).colour(ChatColor.DARK_AQUA).then(lines.get(edit)).colour(ChatColor.AQUA).group().tooltip(buildCompiledOutput()).tooltip(ChatColor.YELLOW + "" + ChatColor.ITALIC + "Click to edit this line").perform("script editcurrent " + edit).exit().toJson();
}
 
Example #3
Source File: InfoCommand.java    From HoloAPI with GNU General Public License v3.0 5 votes vote down vote up
protected static void info(CommandSender sender, Collection<Hologram> holograms) {
    for (Hologram hologram : holograms) {
        ArrayList<String> list = new ArrayList<>();
        list.add(ChatColor.GOLD + "" + ChatColor.UNDERLINE + "Hologram Preview:");
        if (hologram instanceof AnimatedHologram) {
            AnimatedHologram animatedHologram = (AnimatedHologram) hologram;
            if (animatedHologram.isImageGenerated() && (HoloAPI.getAnimationLoader().exists(animatedHologram.getAnimationKey())) || HoloAPI.getAnimationLoader().existsAsUnloadedUrl(animatedHologram.getAnimationKey())) {
                list.add(ChatColor.YELLOW + "" + ChatColor.ITALIC + animatedHologram.getAnimationKey() + " (ANIMATION)");
            } else {
                Collections.addAll(list, animatedHologram.getFrames().get(0).getLines());
            }
        } else {
            if (hologram.getLines().length > 1) {
                for (StoredTag tag : hologram.serialise()) {
                    if (tag.isImage()) {
                        if (HoloAPI.getConfig(ConfigType.MAIN).getBoolean("images." + tag.getContent() + ".requiresBorder", false)) {
                            for (String s : HoloAPI.getImageLoader().getGenerator(tag.getContent()).getLines()) {
                                list.add(HoloAPI.getTagFormatter().formatBasic(ChatColor.WHITE + s));
                            }
                        } else {
                            list.add(ChatColor.YELLOW + "" + ChatColor.ITALIC + tag.getContent() + " (IMAGE)");
                        }
                    } else {
                        list.add(HoloAPI.getTagFormatter().formatBasic(ChatColor.WHITE + tag.getContent()));
                    }
                }
            } else {
                list.add(HoloAPI.getTagFormatter().formatBasic(hologram.getLines()[0]));
            }
        }
        if (list.size() > 1) {
            new PowerMessage("•• " + ChatColor.AQUA + hologram.getSaveId() + ChatColor.DARK_AQUA + " at " + (int) hologram.getDefaultX() + ", " + (int) hologram.getDefaultY() + ", " + (int) hologram.getDefaultZ() + ", " + hologram.getWorldName()).tooltip(list.toArray(StringUtil.EMPTY_STRING_ARRAY)).suggest("/holo teleport " + hologram.getSaveId()).send(sender);
        }
    }
}
 
Example #4
Source File: PetCommand.java    From EchoPet with GNU General Public License v3.0 5 votes vote down vote up
private Paginator<PowerMessage> getHelp(CommandSender sender) {
    ArrayList<PowerMessage> helpMessages = new ArrayList<PowerMessage>();
    for (HelpEntry he : HelpEntry.values()) {
        helpMessages.add(he.getPowerMessage(sender));
    }
    return new Paginator<PowerMessage>(helpMessages, 5);
}