net.kyori.text.format.TextColor Java Examples

The following examples show how to use net.kyori.text.format.TextColor. 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: CommandHelper.java    From GriefDefender with MIT License 6 votes vote down vote up
public static Component getFriendlyContextString(Claim claim, Set<Context> contexts) {
    if (contexts.isEmpty()) {
        return TextComponent.of("[]", TextColor.WHITE);
    }

    TextComponent.Builder builder = TextComponent.builder();
    final Iterator<Context> iterator = contexts.iterator();
    while (iterator.hasNext()) {
        final Context context = iterator.next();
        builder.append("\n[", TextColor.WHITE)
            .append(context.getKey(), TextColor.GREEN)
            .append("=", TextColor.GRAY)
            .append(context.getValue(), TextColor.WHITE);

        if (iterator.hasNext()) {
            builder.append("], ");
        } else {
            builder.append("]");
        }
    }
    return builder.build();
}
 
Example #2
Source File: ClaimOptionBase.java    From GriefDefender with MIT License 6 votes vote down vote up
private Component getHoverContextComponent(Set<Context> contexts) {
    if (contexts.isEmpty()) {
        return TextComponent.empty();
    }

    TextComponent.Builder builder = TextComponent.builder()
                .append("\n\nContexts: \n");

    for (Context context : contexts) {
        final String key = context.getKey();
        final String value = context.getValue();
        TextColor keyColor = TextColor.AQUA;
        builder.append(key, keyColor)
                .append("=", TextColor.WHITE)
                .append(value.replace("minecraft:", ""), TextColor.GRAY)
                .append("\n");
    }

    return builder.build();
}
 
Example #3
Source File: MatchFooterTabEntry.java    From PGM with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public BaseComponent getContent(TabView view) {
  TextComponent.Builder content = TextComponent.builder();

  MatchPlayer viewer = match.getPlayer(view.getViewer());

  if (viewer.getCompetitor() != null
      && viewer.getSettings().getValue(SettingKey.STATS).equals(SettingValue.STATS_ON)) {
    content.append(match.getModule(StatsMatchModule.class).getBasicStatsMessage(viewer.getId()));
    content.append("\n");
  }

  content
      .append(TranslatableComponent.of("match.info.time", TextColor.GRAY))
      .append(": ", TextColor.GRAY)
      .append(
          TimeUtils.formatDuration(match.getDuration()),
          this.match.isRunning() ? TextColor.GREEN : TextColor.GOLD);

  return TextTranslations.toBaseComponent(
      content.colorIfAbsent(TextColor.DARK_GRAY).build(), view.getViewer());
}
 
Example #4
Source File: CommandClaimDelete.java    From GriefDefender with MIT License 6 votes vote down vote up
private static Consumer<CommandSource> createConfirmationConsumer(Player player, Claim claim, boolean deleteTopLevelClaim) {
    return confirm -> {
        final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId());
        GDCauseStackManager.getInstance().pushCause(player);
        ClaimResult claimResult = GriefDefenderPlugin.getInstance().dataStore.deleteClaim(claim, !deleteTopLevelClaim);
        GDCauseStackManager.getInstance().popCause();
        if (!claimResult.successful()) {
            GriefDefenderPlugin.sendMessage(player, claimResult.getMessage().orElse(MessageCache.getInstance().PLUGIN_EVENT_CANCEL));
            return;
        }

        playerData.onClaimDelete();
        playerData.revertClaimVisual((GDClaim) claim);

        if (claim.isTown()) {
            playerData.inTown = false;
            playerData.townChat = false;
        }

        final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.DELETE_CLAIM_SUCCESS, 
            ImmutableMap.of("player", claim.getOwnerDisplayName().color(TextColor.AQUA)));
        GriefDefenderPlugin.sendMessage(player, message);
    };
}
 
Example #5
Source File: MapPoolCommand.java    From PGM with GNU Affero General Public License v3.0 6 votes vote down vote up
@Command(aliases = "votenext", desc = "Vote for the next map", usage = "map")
public static void voteNext(
    MatchPlayer player,
    CommandSender sender,
    MapOrder mapOrder,
    @Switch('o') boolean forceOpen,
    @Text MapInfo map)
    throws CommandException {
  MapPool pool = getMapPoolManager(sender, mapOrder).getActiveMapPool();
  MapPoll poll = pool instanceof VotingPool ? ((VotingPool) pool).getCurrentPoll() : null;
  if (poll == null) {
    player.sendWarning(TranslatableComponent.of("vote.noVote"));
    return;
  }
  boolean voteResult = poll.toggleVote(map, ((Player) sender).getUniqueId());

  Component voteAction =
      TranslatableComponent.of(
          voteResult ? "vote.for" : "vote.abstain",
          voteResult ? TextColor.GREEN : TextColor.RED,
          map.getStyledName(MapNameStyle.COLOR));
  player.sendMessage(voteAction);
  poll.sendBook(player, forceOpen);
}
 
Example #6
Source File: MapInfoImpl.java    From PGM with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public Component getStyledName(MapNameStyle style) {
  TextComponent.Builder name = TextComponent.builder(getName());

  if (style.isColor) name.color(TextColor.GOLD);
  if (style.isHighlight) name.decoration(TextDecoration.UNDERLINED, true);
  if (style.showAuthors) {
    return TranslatableComponent.of(
        "misc.authorship",
        TextColor.DARK_PURPLE,
        name.build(),
        TextFormatter.list(
            getAuthors().stream()
                .map(c -> c.getName(NameStyle.PLAIN).color(TextColor.RED))
                .collect(Collectors.toList()),
            TextColor.DARK_PURPLE));
  }

  return name.build();
}
 
Example #7
Source File: MapOrderCommand.java    From PGM with GNU Affero General Public License v3.0 6 votes vote down vote up
@Command(
    aliases = {"nextmap", "mn", "mapnext", "nm", "next"},
    desc = "Show which map is playing next")
public void nextmap(Audience audience, CommandSender sender, MapOrder mapOrder) {
  final MapInfo next = mapOrder.getNextMap();

  if (next == null) {
    sender.sendMessage(ChatColor.RED + TextTranslations.translate("map.noNextMap", sender));
    return;
  }

  audience.sendMessage(
      TranslatableComponent.of(
          "map.nextMap",
          TextColor.DARK_PURPLE,
          next.getStyledName(MapNameStyle.COLOR_WITH_AUTHORS)));
}
 
Example #8
Source File: ListCommand.java    From PGM with GNU Affero General Public License v3.0 6 votes vote down vote up
private void sendTeamInfo(
    Audience viewer,
    CommandSender sender,
    Component teamName,
    Collection<MatchPlayer> players,
    int max) {
  Component teamLine =
      TextComponent.builder()
          .append(teamName)
          .append(": ", TextColor.GRAY)
          .append(Integer.toString(getSize(players, false)))
          .append(
              max != -1
                  ? TextComponent.of("/" + Integer.toString(max), TextColor.GRAY)
                  : TextComponent.empty())
          .append(
              getSize(players, true) > 0 && sender.hasPermission(Permissions.STAFF)
                  ? formatVanishCount(players)
                  : TextComponent.empty())
          .build();
  viewer.sendMessage(teamLine);
  if (!players.isEmpty()) {
    viewer.sendMessage(formatNames(players, sender));
  }
}
 
Example #9
Source File: FreezeMatchModule.java    From PGM with GNU Affero General Public License v3.0 6 votes vote down vote up
private void thaw(MatchPlayer freezee, Component senderName, boolean silent) {
  frozenPlayers.remove(freezee.getBukkit());

  Component thawed = TranslatableComponent.of("moderation.freeze.unfrozen");
  Component by = TranslatableComponent.of("misc.by", senderName);

  TextComponent.Builder thawedTitle = TextComponent.builder().append(thawed);
  if (!silent) {
    thawedTitle.append(" ").append(by);
  }

  freezee.getBukkit().hideTitle();
  freezee.playSound(THAW_SOUND);
  freezee.sendMessage(thawedTitle.color(TextColor.GREEN).build());

  ChatDispatcher.broadcastAdminChatMessage(
      TranslatableComponent.of(
          "moderation.freeze.broadcast.thaw",
          TextColor.GRAY,
          senderName,
          freezee.getName(NameStyle.CONCISE)),
      match);
}
 
Example #10
Source File: EconomyUtil.java    From GriefDefender with MIT License 6 votes vote down vote up
public void sellCancelConfirmation(CommandSource src, Claim claim, Sign sign) {
    final Player player = (Player) src;
    final GDClaim gdClaim = (GDClaim) claim;
    // check sell access
    if (gdClaim.allowEdit(player) != null) {
        GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().CLAIM_NOT_YOURS);
        return;
    }

    final Component sellCancelConfirmationText = TextComponent.builder()
            .append("\n[")
            .append(MessageCache.getInstance().LABEL_CONFIRM.color(TextColor.GREEN))
            .append("]\n")
            .clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(src, createSellCancelConfirmed(src, claim, sign), true)))
            .build();
    final Component message = TextComponent.builder()
            .append(MessageCache.getInstance().ECONOMY_CLAIM_SALE_CANCEL_CONFIRMATION)
            .append("\n")
            .append(sellCancelConfirmationText)
            .build();
    GriefDefenderPlugin.sendMessage(src, message);
}
 
Example #11
Source File: SamplerModule.java    From spark with GNU General Public License v3.0 6 votes vote down vote up
private void handleUpload(SparkPlatform platform, CommandResponseHandler resp, Sampler sampler, ThreadNodeOrder threadOrder, String comment, MergeMode mergeMode) {
    platform.getPlugin().executeAsync(() -> {
        byte[] output = sampler.formCompressedDataPayload(platform.getPlugin().getPlatformInfo(), resp.sender(), threadOrder, comment, mergeMode);
        try {
            String key = SparkPlatform.BYTEBIN_CLIENT.postContent(output, SPARK_SAMPLER_MEDIA_TYPE, false).key();
            String url = SparkPlatform.VIEWER_URL + key;

            resp.broadcastPrefixed(TextComponent.of("Sampling results:", TextColor.GOLD));
            resp.broadcast(TextComponent.builder(url)
                    .color(TextColor.GRAY)
                    .clickEvent(ClickEvent.openUrl(url))
                    .build()
            );

            platform.getActivityLog().addToLog(Activity.urlActivity(resp.sender(), System.currentTimeMillis(), "Sampler", url));
        } catch (IOException e) {
            resp.broadcastPrefixed(TextComponent.of("An error occurred whilst uploading the results.", TextColor.RED));
            e.printStackTrace();
        }
    });
}
 
Example #12
Source File: GDActiveFlagData.java    From GriefDefender with MIT License 6 votes vote down vote up
public TextColor getColor() {
    if (this.type == Type.CLAIM) {
        return TextColor.YELLOW;
    }
    if (this.type == Type.CLAIM_PARENT_INHERIT) {
        return TextColor.AQUA;
    }
    if (this.type == Type.OVERRIDE) {
        return TextColor.RED;
    }
    if (this.type == Type.OWNER_OVERRIDE_PARENT_INHERIT) {
        return TextColor.DARK_RED;
    }
    if (this.type == Type.DEFAULT) {
        return TextColor.LIGHT_PURPLE;
    }
    return TextColor.GRAY;
}
 
Example #13
Source File: CommandPagination.java    From GriefDefender with MIT License 6 votes vote down vote up
@CommandAlias("gd:pagination")
@Description("Used internally by GD for pagination purposes.")
public void execute(CommandSender src, String[] args) throws CommandException {
    if (args == null || args.length == 0) {
        return;
    }

    final String id = args[0];
    final ActivePagination activePagination = GDPaginationHolder.getInstance().getActivePagination(src, id);
    if (activePagination == null) {
        TextAdapter.sendComponent(src, TextComponent.of("Source " + src.getName() + " has no paginations!", TextColor.RED));
        return;
    }

    final String action = args[1];
    if (action.equals("page")) {
        activePagination.currentPage();
    } else if (action.equals("next")) {
        activePagination.nextPage();
    } else if (action.equals("prev")) {
        activePagination.previousPage();
    } else {
        int page = Integer.parseInt(action);
        activePagination.specificPage(page);
    }
}
 
Example #14
Source File: CommandClaimDelete.java    From GriefDefender with MIT License 6 votes vote down vote up
private static Consumer<CommandSender> createConfirmationConsumer(Player player, Claim claim, boolean deleteTopLevelClaim) {
    return confirm -> {
        final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId());
        GDCauseStackManager.getInstance().pushCause(player);
        ClaimResult claimResult = GriefDefenderPlugin.getInstance().dataStore.deleteClaim(claim, !deleteTopLevelClaim);
        GDCauseStackManager.getInstance().popCause();
        if (!claimResult.successful()) {
            GriefDefenderPlugin.sendMessage(player, claimResult.getMessage().orElse(MessageCache.getInstance().PLUGIN_EVENT_CANCEL));
            return;
        }

        playerData.onClaimDelete();
        playerData.revertClaimVisual((GDClaim) claim);

        if (claim.isTown()) {
            playerData.inTown = false;
            playerData.townChat = false;
        }

        final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.DELETE_CLAIM_SUCCESS, 
            ImmutableMap.of("player", claim.getOwnerDisplayName().color(TextColor.AQUA)));
        GriefDefenderPlugin.sendMessage(player, message);
    };
}
 
Example #15
Source File: TextFormatter.java    From PGM with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Gets a list of text.
 *
 * @param texts A collection of text.
 * @param color The color of the list separators.
 * @return A text list.
 */
public static Component list(Collection<? extends Component> texts, TextColor color) {
  final List<? extends Component> textList =
      texts instanceof List ? (List) texts : new ArrayList<>(texts);
  switch (textList.size()) {
    case 0:
      return TextComponent.empty();
    case 1:
      return textList.get(0);
    case 2:
      return TranslatableComponent.of("misc.list.pair", color, textList);
    default:
      final Iterator<? extends Component> textIterator = textList.iterator();
      Component a =
          TranslatableComponent.of(
              "misc.list.start", color, textIterator.next(), textIterator.next());
      Component b = textIterator.next();
      while (textIterator.hasNext()) {
        a = TranslatableComponent.of("misc.list.middle", color, a, b);
        b = textIterator.next();
      }
      return TranslatableComponent.of("misc.list.end", color, a, b);
  }
}
 
Example #16
Source File: Lang.java    From VoxelGamesLibv2 with MIT License 6 votes vote down vote up
@Nonnull
public static String legacyColors(@Nonnull String message) {
    StringBuilder result = new StringBuilder();
    String[] tokens = message.split("\\{|}");
    outer:
    for (String token : tokens) {
        for (TextColor color : TextColor.values()) {
            if (color.name().equalsIgnoreCase(token)) {
                result.append(color);
                continue outer;
            }
        }

        result.append(token);
    }

    return result.toString();
}
 
Example #17
Source File: UIHelper.java    From GriefDefender with MIT License 6 votes vote down vote up
public static Component getFriendlyContextString(Claim claim, Set<Context> contexts) {
    if (contexts.isEmpty()) {
        return TextComponent.of("[]", TextColor.WHITE);
    }

    TextComponent.Builder builder = TextComponent.builder();
    final Iterator<Context> iterator = contexts.iterator();
    while (iterator.hasNext()) {
        final Context context = iterator.next();
        builder.append("\n[", TextColor.WHITE)
            .append(context.getKey(), TextColor.GREEN)
            .append("=", TextColor.GRAY)
            .append(context.getValue(), TextColor.WHITE);

        if (iterator.hasNext()) {
            builder.append("], ");
        } else {
            builder.append("]");
        }
    }
    return builder.build();
}
 
Example #18
Source File: ScoreMatchModule.java    From PGM with GNU Affero General Public License v3.0 6 votes vote down vote up
private void playerScore(ScoreBox box, MatchPlayer player, double points) {
  checkState(player.isParticipating());

  if (points == 0) return;

  this.incrementScore(player.getCompetitor(), points);
  box.setLastScoreTime(player.getState(), Instant.now());

  int wholePoints = (int) points;
  if (wholePoints < 1) return;

  match.sendMessage(
      TranslatableComponent.of(
          "scorebox.scored",
          player.getName(NameStyle.COLOR),
          TranslatableComponent.of(
              wholePoints == 1 ? "misc.point" : "misc.points",
              TextComponent.of(Integer.toString(wholePoints), TextColor.DARK_AQUA)),
          player.getParty().getName()));
  player.playSound(new Sound("random.levelup"));
}
 
Example #19
Source File: EconomyUtil.java    From GriefDefender with MIT License 6 votes vote down vote up
public void economyCreateClaimConfirmation(Player player, GDPlayerData playerData, int height, Vector3i point1, Vector3i point2, ClaimType claimType, boolean cuboid, Claim parent) {
    GDClaim claim = new GDClaim(player.getWorld(), point1, point2, claimType, player.getUniqueId(), cuboid);
    claim.parent = (GDClaim) parent;
    final GDPermissionUser user = PermissionHolderCache.getInstance().getOrCreateUser(player);
    final int claimCost = BlockUtil.getInstance().getClaimBlockCost(player.getWorld(), claim.lesserBoundaryCorner, claim.greaterBoundaryCorner, claim.cuboid);
    final Double economyBlockCost = GDPermissionManager.getInstance().getInternalOptionValue(TypeToken.of(Double.class), user, Options.ECONOMY_BLOCK_COST, claim);
    final double requiredFunds = claimCost * economyBlockCost;
    final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ECONOMY_CLAIM_BUY_CONFIRMATION,
            ImmutableMap.of("amount", "$" + String.format("%.2f", requiredFunds)));
    final Component buyConfirmationText = TextComponent.builder()
            .append(message)
            .append(TextComponent.builder()
                .append("\n[")
                .append(MessageCache.getInstance().LABEL_CONFIRM.color(TextColor.GREEN))
                .append("]\n")
                .clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(player, economyClaimBuyConfirmed(player, playerData, height, requiredFunds, point1, point2, claimType, cuboid, parent), true))).build())
            .build();
    GriefDefenderPlugin.sendMessage(player, buyConfirmationText);
}
 
Example #20
Source File: CommandClaimSchematic.java    From GriefDefender with MIT License 5 votes vote down vote up
private static Consumer<CommandSender> displayConfirmationConsumer(CommandSender src, Claim claim, ClaimSchematic schematic) {
    return confirm -> {
        final Component schematicConfirmationText = TextComponent.builder("")
                .append("\n[")
                .append(MessageCache.getInstance().LABEL_CONFIRM.color(TextColor.GREEN))
                .append("]\n")
                .clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(src, createConfirmationConsumer(src, claim, schematic), true)))
                .hoverEvent(HoverEvent.showText(GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.SCHEMATIC_RESTORE_CONFIRMATION))).build();
        TextAdapter.sendComponent(src, schematicConfirmationText);
    };
}
 
Example #21
Source File: SettingCommand.java    From PGM with GNU Affero General Public License v3.0 5 votes vote down vote up
private void sendCurrentSetting(MatchPlayer player, SettingKey key, SettingValue value) {
  player.sendMessage(
      TranslatableComponent.of(
          "setting.get",
          TextComponent.of(key.getName()),
          TextComponent.of(value.getName(), TextColor.GREEN)));
}
 
Example #22
Source File: VelocityConsole.java    From Velocity with MIT License 5 votes vote down vote up
@Override
protected void runCommand(String command) {
  try {
    if (!this.server.getCommandManager().execute(this, command)) {
      sendMessage(TextComponent.of("Command not found.", TextColor.RED));
    }
  } catch (Exception e) {
    logger.error("An error occurred while running this command.", e);
  }
}
 
Example #23
Source File: ListCommand.java    From PGM with GNU Affero General Public License v3.0 5 votes vote down vote up
private Component formatNames(Collection<MatchPlayer> players, CommandSender sender) {
  List<Component> names =
      players.stream()
          .filter(mp -> sender.hasPermission(Permissions.STAFF) || !isVanished(mp.getId()))
          .map(mp -> mp.getName(NameStyle.VERBOSE))
          .collect(Collectors.toList());

  return TextFormatter.list(names, TextColor.GRAY);
}
 
Example #24
Source File: HealthModule.java    From spark with GNU General Public License v3.0 5 votes vote down vote up
public static TextComponent formatTps(double tps) {
    TextColor color;
    if (tps > 18.0) {
        color = TextColor.GREEN;
    } else if (tps > 16.0) {
        color = TextColor.YELLOW;
    } else {
        color = TextColor.RED;
    }

    return TextComponent.of( (tps > 20.0 ? "*" : "") + Math.min(Math.round(tps * 100.0) / 100.0, 20.0), color);
}
 
Example #25
Source File: ObserverToolsMatchModule.java    From PGM with GNU Affero General Public License v3.0 5 votes vote down vote up
private ItemStack createToolItem(MatchPlayer player) {
  ItemStack tool = new ItemStack(TOOL_MATERIAL);
  ItemMeta meta = tool.getItemMeta();
  Component displayName =
      TranslatableComponent.of("setting.displayName", TextColor.AQUA, TextDecoration.BOLD);
  Component lore = TranslatableComponent.of("setting.lore", TextColor.GRAY);
  meta.setDisplayName(TextTranslations.translateLegacy(displayName, player.getBukkit()));
  meta.setLore(Lists.newArrayList(TextTranslations.translateLegacy(lore, player.getBukkit())));
  meta.addItemFlags(ItemFlag.values());
  tool.setItemMeta(meta);
  return tool;
}
 
Example #26
Source File: ClaimOptionBase.java    From GriefDefender with MIT License 5 votes vote down vote up
private void appendContexts(TextComponent.Builder builder, Set<Context> contexts) {
    // check source/target
    Component source = null;
    Component target = null;
    final Component whiteOpenBracket = TextComponent.of("[", TextColor.WHITE);
    final Component whiteCloseBracket = TextComponent.of("]", TextColor.WHITE);
    for (Context context : contexts) {
        if (context.getKey().equals(ContextKeys.SOURCE)) {
            source = TextComponent.builder()
                        .append(whiteOpenBracket)
                        .append("s", TextColor.GREEN)
                        .append("=", TextColor.WHITE)
                        .append(context.getValue().replace("minecraft:", ""), TextColor.GOLD)
                        .append(whiteCloseBracket)
                        .hoverEvent(HoverEvent.showText(MessageCache.getInstance().LABEL_SOURCE))
                        .build();
            builder.append(" ").append(source);
        } else if (context.getKey().equals(ContextKeys.TARGET)) {
            target = TextComponent.builder()
                    .append(whiteOpenBracket)
                    .append("t", TextColor.GREEN)
                    .append("=", TextColor.WHITE)
                    .append(context.getValue().replace("minecraft:", ""), TextColor.GOLD)
                    .append(whiteCloseBracket)
                    .hoverEvent(HoverEvent.showText(MessageCache.getInstance().LABEL_TARGET))
                    .build();
            builder.append(" ").append(target);
        }
    }
}
 
Example #27
Source File: TextFormatter.java    From PGM with GNU Affero General Public License v3.0 5 votes vote down vote up
public static TextColor convert(Enum<?> color) {
  TextColor textColor = TextColor.WHITE;
  try {
    textColor = TextColor.valueOf(color.name());
  } catch (IllegalArgumentException e) {
    // If not found use default
  }
  return textColor;
}
 
Example #28
Source File: CommandGDVersion.java    From GriefDefender with MIT License 5 votes vote down vote up
@CommandAlias("gdversion")
@Description("Displays GriefDefender's version information.")
@Subcommand("version")
public void execute(CommandSender src) {

    Component gpVersion = TextComponent.builder("")
            .append(GriefDefenderPlugin.GD_TEXT)
            .append("Running ")
            .append("GriefDefender " + GriefDefenderPlugin.IMPLEMENTATION_VERSION, TextColor.AQUA)
            .build();
    Component bukkitVersion = TextComponent.builder("")
            .append(GriefDefenderPlugin.GD_TEXT)
            .append("Running ")
            .append(Bukkit.getVersion(), TextColor.YELLOW)
            .build();

    String permissionPlugin = Bukkit.getPluginManager().getPlugin("LuckPerms").getDescription().getFullName();
    Component permVersion = TextComponent.builder("")
            .append(GriefDefenderPlugin.GD_TEXT)
            .append("Running ")
            .append(permissionPlugin, TextColor.GREEN)
            .build();
    TextAdapter.sendComponent(src, TextComponent.builder("")
            .append(gpVersion)
            .append("\n")
            .append(bukkitVersion)
            .append("\n")
            .append(permVersion)
            .build());
}
 
Example #29
Source File: GDClaim.java    From GriefDefender with MIT License 5 votes vote down vote up
public Component getFriendlyNameType(ClaimType claimType, boolean upper) {
    if (claimType == ClaimTypes.ADMIN) {
        if (upper) {
            return TextComponent.of(claimType.getName().toUpperCase(), TextColor.RED);
        }
        return TextComponent.of("Admin", TextColor.RED);
    }

    if (claimType == ClaimTypes.BASIC) {
        if (upper) {
            return TextComponent.of(claimType.getName().toUpperCase(), TextColor.YELLOW);
        }
        return TextComponent.of("Basic", TextColor.YELLOW);
    }

    if (claimType == ClaimTypes.SUBDIVISION) {
        if (upper) {
            return TextComponent.of(claimType.getName().toUpperCase(), TextColor.AQUA);
        }
        return TextComponent.of("Subdivision", TextColor.AQUA);
    }

    if (upper) {
        return TextComponent.of(claimType.getName().toUpperCase(), TextColor.GREEN);
    }
    return TextComponent.of("Town", TextColor.GREEN);
}
 
Example #30
Source File: UIHelper.java    From GriefDefender with MIT License 5 votes vote down vote up
public static TextColor getPermissionMenuTypeColor(MenuType type) {
    TextColor color = TextColor.LIGHT_PURPLE;
    if (type == MenuType.DEFAULT) {
        color = TextColor.LIGHT_PURPLE;
    } else if (type == MenuType.CLAIM) {
        color = TextColor.GOLD;
    } else if (type == MenuType.INHERIT) {
        color = TextColor.AQUA;
    } else {
        color = TextColor.RED;
    }

    return color;
}