Java Code Examples for com.dsh105.powermessage.core.PowerMessage

The following examples show how to use com.dsh105.powermessage.core.PowerMessage. These examples are extracted from open source projects. 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 Project: SonarPet   Author: TechzoneMC   File: PetCommand.java    License: 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 Project: HoloAPI   Author: DSH105   File: ScriptBuilderPrompt.java    License: 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 Project: HoloAPI   Author: DSH105   File: InfoCommand.java    License: 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 Project: EchoPet   Author: DSH105   File: PetCommand.java    License: 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);
}