下面列出了org.bukkit.ChatColor#YELLOW 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Call when failed load economy system, and use this to check the reason.
*
* @return The reason of error.
*/
static BootError econError() {
// Check Vault is installed
if (Bukkit.getPluginManager().getPlugin("Vault") == null
&& Bukkit.getPluginManager().getPlugin("Reserve") == null) {
// Vault not installed
return new BootError(QuickShop.getInstance().getLogger(),
"Vault or Reserve is not installed or loaded!",
"Make sure you installed Vault or Reserve.");
}
// Vault is installed
if (Bukkit.getPluginManager().getPlugin("CMI") != null) {
// Found may in-compatiable plugin
return new BootError(QuickShop.getInstance().getLogger(),
"No Economy plugin detected, did you installed and loaded them? Make sure they loaded before QuickShop.",
"Make sure you have an economy plugin hooked into Vault or Reserve.",
ChatColor.YELLOW + "Incompatibility detected: CMI Installed",
"Download CMI Edition of Vault might fix this.");
}
return new BootError(QuickShop.getInstance().getLogger(),
"No Economy plugin detected, did you installed and loaded them? Make sure they loaded before QuickShop.",
"Install an economy plugin to get Vault or Reserve working.");
}
private ChatColor pingZoneColor(int millis) {
int zone = millis / 50;
if(zone < 1) {
return ChatColor.AQUA;
}
if(zone < 2) {
return ChatColor.GREEN;
}
if(zone < 3) {
return ChatColor.YELLOW;
}
if(zone < 4) {
return ChatColor.GOLD;
}
return ChatColor.RED;
}
@Override
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
if (!testPermission(sender)) return true;
double tps = Math.min(20, Math.round(net.minecraft.server.MinecraftServer.currentTps * 10) / 10.0);
ChatColor color;
if (tps > 19.2D) {
color = ChatColor.GREEN;
} else if (tps > 17.4D) {
color = ChatColor.YELLOW;
} else {
color = ChatColor.RED;
}
sender.sendMessage(ChatColor.GOLD + "[TPS] " + color + tps);
return true;
}
public EscapePlan() {
super("escape-plan", ChatColor.YELLOW + "Escape Plan");
setLore("§bSteve Co. Space Program!",
"§bProvides a quick escape from your foes.",
"§b... or just send 'em into spaaaace!",
"§bUse on open areas.");
}
/**
* Determines the scoreboard slot value based on an internal Minecraft integer
* @param i the scoreboard slot value
*/
public ScoreboardSlot(int i) {
//Initialize displaySlot
switch(i) {
case 0: displaySlot = DisplaySlot.PLAYER_LIST; break;
case 1: displaySlot = DisplaySlot.SIDEBAR; break;
case 2: displaySlot = DisplaySlot.BELOW_NAME; break;
default: displaySlot = DisplaySlot.SIDEBAR; break;
}
//Initialize teamColor
switch(i) {
case 3: teamColor = ChatColor.BLACK; break;
case 4: teamColor = ChatColor.DARK_BLUE; break;
case 5: teamColor = ChatColor.DARK_GREEN; break;
case 6: teamColor = ChatColor.DARK_AQUA; break;
case 7: teamColor = ChatColor.DARK_RED; break;
case 8: teamColor = ChatColor.DARK_PURPLE; break;
case 9: teamColor = ChatColor.GOLD; break;
case 10: teamColor = ChatColor.GRAY; break;
case 11: teamColor = ChatColor.DARK_GRAY; break;
case 12: teamColor = ChatColor.BLUE; break;
case 13: teamColor = ChatColor.GREEN; break;
case 14: teamColor = ChatColor.AQUA; break;
case 15: teamColor = ChatColor.RED; break;
case 16: teamColor = ChatColor.LIGHT_PURPLE; break;
case 17: teamColor = ChatColor.YELLOW; break;
case 18: teamColor = ChatColor.WHITE; break;
default: teamColor = null; break;
}
}
@Override
public ItemStack getIcon(Player viewer) {
ItemStack i = super.getIcon(viewer);
ItemMeta meta = i.getItemMeta();
ChatColor c = this.petType == null ? ChatColor.YELLOW : (viewer.hasPermission("echopet.pet.type." + this.getPetType().toString().toLowerCase().replace("_", ""))) ? ChatColor.GREEN : ChatColor.RED;
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', c + this.getName()));
i.setItemMeta(meta);
if (this.petType == PetType.HUMAN && i.getItemMeta() instanceof SkullMeta) {
SkullMeta sm = (SkullMeta) i.getItemMeta();
sm.setOwner(viewer.getName());
i.setItemMeta(sm);
}
return i;
}
public static ChatColor convertDyeColorToChatColor(DyeColor dye) {
switch (dye) {
case WHITE:
return ChatColor.WHITE;
case ORANGE:
return ChatColor.GOLD;
case MAGENTA:
return ChatColor.LIGHT_PURPLE;
case LIGHT_BLUE:
return ChatColor.BLUE;
case YELLOW:
return ChatColor.YELLOW;
case LIME:
return ChatColor.GREEN;
case PINK:
return ChatColor.RED;
case GRAY:
return ChatColor.DARK_GRAY;
case SILVER:
return ChatColor.GRAY;
case CYAN:
return ChatColor.DARK_AQUA;
case PURPLE:
return ChatColor.DARK_PURPLE;
case BLUE:
return ChatColor.DARK_BLUE;
case BROWN:
return ChatColor.GOLD;
case GREEN:
return ChatColor.DARK_GREEN;
case RED:
return ChatColor.DARK_RED;
case BLACK:
return ChatColor.BLACK;
}
return ChatColor.WHITE;
}
private static String getDevHelpMessage() {
return ChatColor.GREEN + "Lukkit dev commands:\n" +
ChatColor.YELLOW + " - \"/lukkit dev\" " + ChatColor.GRAY + "- The root command for developer actions (shows this message)\n" +
ChatColor.YELLOW + " - \"/lukkit dev reload (plugin name)\" " + ChatColor.GRAY + "- Reloads the source file and clears all loaded requires\n" +
ChatColor.YELLOW + " - \"/lukkit dev unload (plugin name)\" " + ChatColor.GRAY + "- Unloads the source file and clears all loaded requires\n" +
ChatColor.YELLOW + " - \"/lukkit dev pack (plugin name)\" " + ChatColor.GRAY + "- Packages the plugin (directory) into a .lkt file for publishing\n" +
ChatColor.YELLOW + " - \"/lukkit dev unpack (plugin name)\" " + ChatColor.GRAY + "- Unpacks the plugin (.lkt) to a directory based plugin\n" +
ChatColor.YELLOW + " - \"/lukkit dev last-error\" " + ChatColor.GRAY + "- Gets the last error thrown by a plugin and sends the message to the sender. Also prints the stacktrace to the console.\n" +
ChatColor.YELLOW + " - \"/lukkit dev errors [index]\" " + ChatColor.GRAY + "- Either prints out all 10 errors with stacktraces or prints out the specified error at the given index [1 - 10]\n" +
ChatColor.YELLOW + " - \"/lukkit dev help\" " + ChatColor.GRAY + "- Shows this message";
}
private ChatColor tpsColor(double tps) {
if (tps >= 19) {
return ChatColor.GREEN;
} else if (tps >= 17) {
return ChatColor.DARK_GREEN;
} else if (tps >= 15) {
return ChatColor.YELLOW;
} else if (tps >= 10) {
return ChatColor.GOLD;
}
return ChatColor.RED;
}
@Override
public ItemStack getIcon(Player viewer) {
ItemData itemData = getItemData();
ChatColor c = this.petType == null ? ChatColor.YELLOW : (viewer.hasPermission("echopet.pet.type." + this.getPetType().toString().toLowerCase().replace("_", ""))) ? ChatColor.GREEN : ChatColor.RED;
itemData = itemData.withDisplayName(ChatColor.translateAlternateColorCodes('&', c + this.getName()));
if (this.petType == PetType.HUMAN && itemData instanceof SkullItemData) {
itemData = ((SkullItemData) itemData).withOwner(viewer.getUniqueId());
}
return itemData.createStack(1);
}
public RepulsionBomb() {
super("repulsion-bomb", ChatColor.YELLOW + "Repulsion Bomb", Material.COAL);
setLore("§bLeft-click to throw the bomb.",
"§bIt will explode after a few seconds.");
setDefaultConfig("fuse", 45);
setDefaultConfig("radius", 11);
setDefaultConfig("force", 1.8d);
}
public CommandAliasHelpTopic(String alias, String aliasFor, HelpMap helpMap) {
this.aliasFor = aliasFor.startsWith("/") ? aliasFor : "/" + aliasFor;
this.helpMap = helpMap;
this.name = alias.startsWith("/") ? alias : "/" + alias;
Validate.isTrue(!this.name.equals(this.aliasFor), "Command " + this.name + " cannot be alias for itself");
this.shortText = ChatColor.YELLOW + "Alias for " + ChatColor.WHITE + this.aliasFor;
}
@Override
public ChatColor getColor() {
return ChatColor.YELLOW;
}
public String getFormattedTitle() {
return " " + ChatColor.YELLOW + title;
}
private String result() {
return ChatColor.YELLOW + "[" + ChatColor.DARK_GREEN + votedYes.size() + " " + ChatColor.DARK_RED + votedNo.size() + ChatColor.YELLOW + "]";
}
public String getStatusMessage() {
ChatColor neutral = ChatColor.YELLOW;
return ChatColor.GOLD.toString() + this.getTimeLeftSeconds() + neutral + " seconds left in poll " + this.getActionString(neutral) + neutral + " " + this.formatForAgainst(neutral);
}
public static String getWarningMessage(String msg) {
if (msg == null) return null;
else return ChatColor.YELLOW + " \u26A0 " + ChatColor.RED + ChatColor.translateAlternateColorCodes('`', msg);
}
@Override
@SneakyThrows(IOException.class)
public void onEnable() {
EchoPet.setPlugin(this);
isUsingNetty = CommonReflection.isUsingNetty();
this.configManager = new YAMLConfigManager(this);
COMMAND_MANAGER = new CommandManager(this);
// Make sure that the plugin is running under the correct version to prevent errors
if (NmsVersion.current() == null || !INMS.isSupported()) {
EchoPet.LOG.log(ChatColor.RED + "SonarPet " + ChatColor.GOLD
+ this.getDescription().getVersion() + ChatColor.RED
+ " is not compatible with this version of CraftBukkit");
EchoPet.LOG.log(ChatColor.RED + "Initialisation failed. Please update the plugin.");
DynamicPluginCommand cmd = new DynamicPluginCommand(this.cmdString, new String[0], "", "",
new VersionIncompatibleCommand(this, this.cmdString, ChatColor.YELLOW +
"SonarPet " + ChatColor.GOLD + this.getDescription().getVersion() + ChatColor.YELLOW + " is not compatible with this version of CraftBukkit. Please update the plugin.",
"echopet.pet", ChatColor.YELLOW + "You are not allowed to do that."),
null, this);
COMMAND_MANAGER.register(cmd);
return;
}
EntityRegistry entityRegistry;
if (CitizensEntityRegistryHack.isNeeded()) {
getLogger().warning("Attempting to inject citizens compatibility hack....");
entityRegistry = CitizensEntityRegistryHack.createInstance();
getLogger().warning("Successfully injected citizens compatibility hack!");
} else {
//noinspection deprecation // We check for citizens first ;)
entityRegistry = INMS.getInstance().createDefaultEntityRegistry();
}
this.entityRegistry = Objects.requireNonNull(entityRegistry);
this.loadConfiguration();
PluginManager manager = getServer().getPluginManager();
MANAGER = new PetManager();
SQL_MANAGER = new SqlPetManager();
if (OPTIONS.useSql()) {
this.prepareSqlDatabase();
}
// Register custom commands
// Command string based off the string defined in config.yml
// By default, set to 'pet'
// PetAdmin command draws from the original, with 'admin' on the end
this.cmdString = OPTIONS.getCommandString();
this.adminCmdString = OPTIONS.getCommandString() + "admin";
DynamicPluginCommand petCmd = new DynamicPluginCommand(this.cmdString, new String[0], "Create and manage your own custom pets.", "Use /" + this.cmdString + " help to see the command list.", new PetCommand(this.cmdString), null, this);
petCmd.setTabCompleter(new CommandComplete());
COMMAND_MANAGER.register(petCmd);
COMMAND_MANAGER.register(new DynamicPluginCommand(this.adminCmdString, new String[0], "Create and manage the pets of other players.", "Use /" + this.adminCmdString + " help to see the command list.", new PetAdminCommand(this.adminCmdString), null, this));
// Initialize hook classes
for (ClassPath.ClassInfo hookType : ClassPath.from(getClass().getClassLoader()).getTopLevelClasses("net.techcable.sonarpet.nms.entity.type")) {
if (!hookType.load().isAnnotationPresent(EntityHook.class)) continue;
for (EntityHookType type : hookType.load().getAnnotation(EntityHook.class).value()) {
if (!type.isActive()) continue;
hookRegistry.registerHookClass(type, hookType.load().asSubclass(IEntityPet.class));
}
}
// Register listeners
manager.registerEvents(new MenuListener(), this);
manager.registerEvents(new PetEntityListener(this), this);
manager.registerEvents(new PetOwnerListener(), this);
if (VersionNotificationListener.isNeeded()) {
manager.registerEvents(new VersionNotificationListener(), this);
PluginVersioning.INSTANCE.sendOutdatedVersionNotification(Bukkit.getConsoleSender());
}
//manager.registerEvents(new ChunkListener(), this);
this.vanishProvider = new VanishProvider(this);
this.worldGuardProvider = new WorldGuardProvider(this);
}
public void openTeamSelection(Game game) {
BedwarsOpenTeamSelectionEvent openEvent = new BedwarsOpenTeamSelectionEvent(game, this.player);
BedwarsRel.getInstance().getServer().getPluginManager().callEvent(openEvent);
if (openEvent.isCancelled()) {
return;
}
HashMap<String, Team> teams = game.getTeams();
int nom = (teams.size() % 9 == 0) ? 9 : (teams.size() % 9);
Inventory inv =
Bukkit.createInventory(this.player, teams.size() + (9 - nom),
BedwarsRel._l(this.player, "lobby.chooseteam"));
for (Team team : teams.values()) {
List<Player> players = team.getPlayers();
if (players.size() >= team.getMaxPlayers()) {
continue;
}
Wool wool = new Wool(team.getColor().getDyeColor());
ItemStack is = wool.toItemStack(1);
ItemMeta im = is.getItemMeta();
im.setDisplayName(team.getChatColor() + team.getName());
ArrayList<String> teamplayers = new ArrayList<>();
int teamPlayerSize = team.getPlayers().size();
int maxPlayers = team.getMaxPlayers();
String current = "0";
if (teamPlayerSize >= maxPlayers) {
current = ChatColor.RED + String.valueOf(teamPlayerSize);
} else {
current = ChatColor.YELLOW + String.valueOf(teamPlayerSize);
}
teamplayers.add(ChatColor.GRAY + "(" + current + ChatColor.GRAY + "/" + ChatColor.YELLOW
+ String.valueOf(maxPlayers) + ChatColor.GRAY + ")");
teamplayers.add(ChatColor.WHITE + "---------");
for (Player teamPlayer : players) {
teamplayers.add(team.getChatColor() + ChatColor.stripColor(teamPlayer.getDisplayName()));
}
im.setLore(teamplayers);
is.setItemMeta(im);
inv.addItem(is);
}
this.player.openInventory(inv);
}
public static ItemStack getMenuButton(Player p) {
return new CustomItem(MENU_BUTTON, ChatColor.YELLOW + SlimefunPlugin.getLocalization().getMessage(p, "guide.title.settings"), "", "&7\u21E8 " + SlimefunPlugin.getLocalization().getMessage(p, "guide.tooltips.open-category"));
}