Java Code Examples for org.bukkit.ChatColor

The following are top voted examples for showing how to use org.bukkit.ChatColor. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: McLink   File: ItemId.java   View source code 6 votes vote down vote up
public static ItemStack attach(ItemStack it, String id) {
	ItemStack i = it.clone();
	ItemMeta m = i.getItemMeta();
	
	List<String> lore = new ArrayList<String>();
	
	lore.addAll(Arrays.asList(new String[] {ChatColor.RESET + "" + ChatColor.DARK_GRAY + id}));
	if (m.getLore() != null && !m.getLore().isEmpty()) {
		lore.add("");
		lore.addAll(m.getLore());
	}
	
	m.setLore(lore);
	i.setItemMeta(m);
	
	return i;
}
 
Example 2
Project: Warzone   File: CycleCommands.java   View source code 6 votes vote down vote up
@Command(aliases = {"start"}, desc = "Start the match.")
@CommandPermissions({"tgm.start"})
public static void start(CommandContext cmd, CommandSender sender) {
    MatchStatus matchStatus = TGM.get().getMatchManager().getMatch().getMatchStatus();
    if (matchStatus == MatchStatus.PRE) {
        int time = StartCountdown.START_TIME;
        if (cmd.argsLength() > 0) {
            try {
                time = cmd.getInteger(0);
            } catch (CommandNumberFormatException e) {
                sender.sendMessage(ChatColor.RED + "Unknown time \"" + cmd.getString(0) + "\"");
            }
        }
        TGM.get().getModule(StartCountdown.class).start(time);
    } else {
        sender.sendMessage(ChatColor.RED + "The match cannot be started at this time.");
    }
}
 
Example 3
Project: ProjectAres   File: PollCommands.java   View source code 6 votes vote down vote up
@Command(
   aliases = {"veto"},
   desc = "Veto the current poll.",
   min = 0,
   max = 0
)
@CommandPermissions("poll.veto")
public static void veto(CommandContext args, CommandSender sender) throws CommandException {
    PollManager pollManager = PGM.getPollManager();
    if(pollManager.isPollRunning()) {
        pollManager.endPoll(PollEndReason.Cancelled);
        Bukkit.getServer().broadcastMessage(ChatColor.RED + "Poll vetoed by " + sender.getName());
    } else {
        throw new CommandException("There is currently no poll running.");
    }
}
 
Example 4
Project: Kineticraft   File: GUICutsceneEditor.java   View source code 6 votes vote down vote up
@Override
public void addItems() {
    for (int i = 0; i < cutscene.getStages().size(); i++) {
        CutsceneStage stage = cutscene.getStages().get(i);
        ItemWrapper iw = addItem(Material.PAPER, ChatColor.YELLOW + "Stage " + (i + 1),
                "Actions: " + ChatColor.YELLOW + stage.getActions().size(), "")
                .leftClick(ce -> new GUIStageEditor(ce.getPlayer(), stage)).rightClick(ce -> {
                    cutscene.getStages().remove(stage);
                    reconstruct();
                });
        stage.getActions().stream().map(a -> a.getName() + " (" + a + a.getColor() + ")").forEach(iw::addLore);
        iw.addLoreAction("Left", "Edit Stage").addLoreAction("Right", "Remove Stage");
    }

    toRight(1);
    addItem(Material.WOOL, ChatColor.GREEN + "Add Stage", "Click here to add a stage.").leftClick(ce -> {
        cutscene.getStages().add(new CutsceneStage());
        reconstruct();
    });
}
 
Example 5
Project: Hub   File: GuiWellCraft.java   View source code 6 votes vote down vote up
private ItemStack makeRemainingPowders()
{
    int remaining = this.getRemainingPowders();

    ItemStack stack = new ItemStack(Material.SUGAR, remaining);
    ItemMeta meta = stack.getItemMeta();
    meta.setDisplayName(ChatColor.YELLOW + "" + remaining + " poussières d'\u272F");

    List<String> lore = new ArrayList<>();
    lore.add(ChatColor.DARK_GRAY + "Poussières restantes");
    lore.add("");
    lore.add(ChatColor.GRAY + "Vous devez encore placer " + ChatColor.AQUA + remaining);
    lore.add(ChatColor.AQUA + "poussières d'\u272F" + ChatColor.GRAY + " avant de");
    lore.add(ChatColor.GRAY + "pouvoir valider.");

    meta.setLore(lore);

    stack.setItemMeta(meta);

    return stack;
}
 
Example 6
Project: Uranium   File: VanillaCommandWrapper.java   View source code 6 votes vote down vote up
public static int dispatch(CommandSender sender, String commandLine)
{
    int pos = commandLine.indexOf( ' ' );
    if ( pos == -1 )
    {
        pos = commandLine.length();
    }
    String name = commandLine.substring( 0, pos );
    if ( !allowedCommands.contains( name ) )
    {
        return -1;
    }
    if ( !sender.hasPermission( "bukkit.command." + name ) )
    {
        sender.sendMessage( ChatColor.RED + "You do not have permission for this command" );
        return 0;
    }
    net.minecraft.command.ICommandSender listener = getListener( sender );
    if ( listener == null )
    {
        return -1;
    }
    return net.minecraft.server.MinecraftServer.getServer().getCommandManager().executeCommand( listener, commandLine );
}
 
Example 7
Project: BlockBall   File: UpdateUtils.java   View source code 6 votes vote down vote up
/**
 * Checks if the given plugin version and spigot resource Id is the same by doing and webRequest and printing the result into the console
 *
 * @param resourceId spigot resourceId
 * @param prefix     prefix
 * @param pluginName pluginName
 * @param plugin     plugin
 * @throws IOException exception
 */
public static void checkPluginUpToDateAndPrintMessage(long resourceId, String prefix, String pluginName, Plugin plugin) throws IOException {
    if (!isPluginUpToDate(resourceId, plugin)) {
        if (plugin.getDescription().getVersion().endsWith("SNAPSHOT")) {
            Bukkit.getServer().getConsoleSender().sendMessage(prefix + ChatColor.YELLOW + "================================================");
            Bukkit.getServer().getConsoleSender().sendMessage(prefix + ChatColor.YELLOW + "You are using a snapshot of " + pluginName);
            Bukkit.getServer().getConsoleSender().sendMessage(prefix + ChatColor.YELLOW + "Please check regularly if there is a new version");
            Bukkit.getServer().getConsoleSender().sendMessage(prefix + ChatColor.YELLOW + "================================================");
        } else {
            Bukkit.getServer().getConsoleSender().sendMessage(prefix + ChatColor.YELLOW + "================================================");
            Bukkit.getServer().getConsoleSender().sendMessage(prefix + ChatColor.YELLOW + pluginName + " is outdated");
            Bukkit.getServer().getConsoleSender().sendMessage(prefix + ChatColor.YELLOW + "Please download the latest version from spigotmc.org");
            Bukkit.getServer().getConsoleSender().sendMessage(prefix + ChatColor.YELLOW + "================================================");
        }
    }
}
 
Example 8
Project: Warzone   File: CycleCommands.java   View source code 6 votes vote down vote up
@Command(aliases = {"end"}, desc = "End the match.")
@CommandPermissions({"tgm.end"})
public static void end(CommandContext cmd, CommandSender sender) {
    MatchStatus matchStatus = TGM.get().getMatchManager().getMatch().getMatchStatus();
    if (matchStatus == MatchStatus.MID) {
        if (cmd.argsLength() > 0) {
            MatchTeam matchTeam = TGM.get().getModule(TeamManagerModule.class).getTeamFromInput(cmd.getJoinedStrings(0));
            if (matchTeam == null) {
                sender.sendMessage(ChatColor.RED + "Unable to find team \"" + cmd.getJoinedStrings(0) + "\"");
                return;
            }
            TGM.get().getMatchManager().endMatch(matchTeam);
        } else {
            TGM.get().getMatchManager().endMatch(TGM.get().getModule(TeamManagerModule.class).getTeams().get(1));
        }
    } else {
        sender.sendMessage(ChatColor.RED + "No match in progress.");
    }
}
 
Example 9
Project: Kineticraft   File: CommandDelHome.java   View source code 6 votes vote down vote up
@Override
protected void onCommand(CommandSender sender, String[] args) {
    Player player = (Player) sender;
    KCPlayer kcPlayer = KCPlayer.getWrapper(player);

    if (args[0].equalsIgnoreCase("bed")) {
        player.sendMessage(ChatColor.RED + "You can't remove this home.");
        return;
    }

    if (!kcPlayer.getHomes().containsKey(args[0])) {
        player.sendMessage(ChatColor.RED + "You do not have a home set with this name.");
        return;
    }

    sender.sendMessage(ChatColor.GREEN + "Removed home '" + args[0] + "'.");
    kcPlayer.getHomes().remove(args[0]);
}
 
Example 10
Project: ProjectAres   File: ProximityAlarmModule.java   View source code 6 votes vote down vote up
public static ProximityAlarmDefinition parseDefinition(MapModuleContext context, Element elAlarm) throws InvalidXMLException {
    ProximityAlarmDefinition definition = new ProximityAlarmDefinition();
    FilterParser filterParser = context.needModule(FilterParser.class);
    definition.detectFilter = filterParser.parseProperty(elAlarm, "detect");
    definition.alertFilter = filterParser.property(elAlarm, "notify").optionalGet(() -> new InverseFilter(definition.detectFilter));
    definition.detectRegion = context.needModule(RegionParser.class).property(elAlarm, "region").required();
    definition.alertMessage = elAlarm.getAttributeValue("message"); // null = no message

    if(definition.alertMessage != null) {
        definition.alertMessage = ChatColor.translateAlternateColorCodes('`', definition.alertMessage);
    }
    Attribute attrFlareRadius = elAlarm.getAttribute("flare-radius");
    definition.flares = attrFlareRadius != null;
    if(definition.flares) {
        definition.flareRadius = XMLUtils.parseNumber(attrFlareRadius, Double.class);
    }

    return definition;
}
 
Example 11
Project: FactionsXL   File: ResourceMenu.java   View source code 6 votes vote down vote up
private void setupGUI() {
    gui = Bukkit.createInventory(null, 27, FMessage.TRADE_RESOURCE_TITLE.getMessage(resource.getName(), faction.getName()));
    ItemStack banner = faction.getBannerStack();
    ItemMeta meta = banner.getItemMeta();
    meta.setDisplayName(ChatColor.GOLD + faction.getName());
    meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
    banner.setItemMeta(meta);
    gui.setItem(0, BACK);
    gui.setItem(1, banner);
    gui.setItem(2, banner);
    gui.setItem(3, banner);
    gui.setItem(5, banner);
    gui.setItem(6, banner);
    gui.setItem(7, banner);
    gui.setItem(8, banner);
    gui.setItem(13, importButton);
    gui.setItem(22, exportButton);
}
 
Example 12
Project: Scorch   File: Guilds.java   View source code 6 votes vote down vote up
public static void demote(Player executor, Player target)throws SQLException, ClassNotFoundException{
    int exR = getGuildRanking(executor);
    int plR = getGuildRanking(target);
    if(getGuildId(executor) != getGuildId(target)){
        executor.sendMessage(ChatColor.RED + "You can not demote players in other guilds!");
        return;
    }
    if(exR == 4 && plR != 1){
        setGuildRanking(target, plR - 1);
        sendGuildMessage(getGuildId(target), ChatColor.DARK_RED + target.getName() + ChatColor.RED + " has been demoted to " + (getGuildRanking(target) == 2 ? ChatColor.GOLD + "MODERATOR!" : getGuildRanking(target) == 1 ? ChatColor.GOLD + "MEMBER!" : ChatColor.DARK_RED + "ERROR: CONTACT SERVER ADMIN."), false);
    } else if(exR == 4){
        executor.sendMessage(ChatColor.RED + "This player is already a member! To remove them from the guild, type /kick <player>");
    } else if(exR == 3 && plR == 2){
        setGuildRanking(target, plR - 1);
        sendGuildMessage(getGuildId(target), ChatColor.DARK_RED + target.getName() + ChatColor.RED + " has been demoted to " + (getGuildRanking(target) == 2 ? ChatColor.GOLD + "MODERATOR!" : getGuildRanking(target) == 1 ? ChatColor.GOLD + "MEMBER!" : ChatColor.DARK_RED + "ERROR: CONTACT SERVER ADMIN."), false);
    } else if (exR == 3 && (plR == 3 || plR == 4)){
        executor.sendMessage(ChatColor.RED + "You can not demote this player!");
    } else if (exR == 2 || exR == 1 || exR == 0){
        executor.sendMessage(ChatColor.RED + "You can not demote players!");
    }
}
 
Example 13
Project: SamaGamesCore   File: CommandStart.java   View source code 6 votes vote down vote up
@Override
public boolean onCommand(CommandSender sender, String label, String[] arguments)
{
    if (!hasPermission(sender, "api.game.start"))
        return true;

    if(SamaGamesAPI.get().getGameManager().getGame() == null)
    {
        sender.sendMessage(ChatColor.RED + "Ceci n'est pas un serveur de jeu.");
        return true;
    }

    SamaGamesAPI.get().getGameManager().getGame().startGame();
    Bukkit.broadcastMessage(ChatColor.GREEN + "Le jeu a été démarré par " + sender.getName());

    return true;
}
 
Example 14
Project: BlockBall   File: ArenaCommandExecutor.java   View source code 6 votes vote down vote up
@Override
public void show() {
    this.player.sendMessage("");
    this.player.sendMessage(HEADER_STANDARD);
    this.player.sendMessage("");
    this.player.sendMessage(Language.PREFIX + "1 - Set match time");
    this.player.sendMessage(Language.PREFIX + "2 - Set lobby time");
    this.player.sendMessage(Language.PREFIX + "3 - Set lobby spawnpoint");
    this.player.sendMessage(Language.PREFIX + "4 - Set redteam sign");
    this.player.sendMessage(Language.PREFIX + "5 - Set blueteam sign");
    this.player.sendMessage(Language.PREFIX + "6 - Set leaving sign");
    this.player.sendMessage(Language.PREFIX + "7 - Set game countdowntitle");
    this.player.sendMessage(Language.PREFIX + "8 - Set game countdownsubtitle");
    this.player.sendMessage(Language.PREFIX + "9 - Reset this page");
    this.player.sendMessage(Language.PREFIX + "10 - Save settings");
    this.player.sendMessage(Language.PREFIX + ChatColor.GREEN + MENU_BACK);
    this.player.sendMessage(Language.PREFIX + ChatColor.RED + MENU_EXIT);
    this.player.sendMessage("");
    this.player.sendMessage(FOOTER_STANDARD);
    this.player.sendMessage("");
}
 
Example 15
Project: EmojiChat   File: EmojiChatListener.java   View source code 6 votes vote down vote up
@EventHandler(priority = EventPriority.HIGH)
void onChat(AsyncPlayerChatEvent event) {
	if (!event.getPlayer().hasPermission("emojichat.use") || !event.getPlayer().hasPermission("emojichat.use.chat"))
		return; // Don't do anything if they don't have permission
	
	String message = event.getMessage();
	
	// Checks if the user disabled shortcuts via /emojichat toggle
	if (!plugin.getEmojiHandler().hasShortcutsOff(event.getPlayer())) {
		message = plugin.getEmojiHandler().translateShorthand(message);
	}
	
	// Replace shortcuts with emojis
	message = plugin.getEmojiHandler().toEmojiFromChat(message);
	
	// If the message contains a disabled character
	if (plugin.getEmojiHandler().containsDisabledCharacter(message)) {
		event.setCancelled(true);
		event.getPlayer().sendMessage(ChatColor.RED + "Oops! You can't use disabled emoji characters!");
		return;
	}
	
	event.setMessage(message);
}
 
Example 16
Project: CloudNet   File: MobSelector.java   View source code 6 votes vote down vote up
private String initPatterns(String x, ServerInfo serverInfo)
{
    return x.replace("%server%", serverInfo.getServiceId().getServerId())
            .replace("%id%", serverInfo.getServiceId().getId() + "")
            .replace("%host%", serverInfo.getHost())
            .replace("%port%", serverInfo.getPort() + "")
            .replace("%memory%", serverInfo.getMemory() + "MB")
            .replace("%online_players%", serverInfo.getOnlineCount() + "")
            .replace("%max_players%", serverInfo.getMaxPlayers() + "")
            .replace("%motd%", ChatColor.translateAlternateColorCodes('&', serverInfo.getMotd()))
            .replace("%state%", serverInfo.getServerState().name() + "")
            .replace("%wrapper%", serverInfo.getServiceId().getWrapperId() + "")
            .replace("%extra%", serverInfo.getServerConfig().getExtra())
            .replace("%template%", serverInfo.getTemplate().getName())
            .replace("%group%", serverInfo.getServiceId().getGroup());
}
 
Example 17
Project: ZentrelaRPG   File: EditNameCommand.java   View source code 6 votes vote down vote up
@Override
public void executePlayer(Player p, PlayerDataRPG pd, String[] args) {
    ItemStack item = p.getInventory().getItemInMainHand();
    if (item.hasItemMeta()) {
        ItemMeta im = item.getItemMeta();
        StringBuilder sb = new StringBuilder();
        for (int k = 1; k < args.length; k++) {
            sb.append(args[k]);
            sb.append(' ');
        }
        String name = ChatColor.translateAlternateColorCodes('&', sb.toString().trim());
        im.setDisplayName(name);
        item.setItemMeta(im);
        p.sendMessage("Updated item.");
    }
}
 
Example 18
Project: Hub   File: GuiMain.java   View source code 6 votes vote down vote up
private static String[] makeButtonLore(String[] description, boolean clickOpen, boolean clickTeleport)
{
    List<String> lore = new ArrayList<>();
    String[] loreArray = new String[] {};

    if (description != null)
    {
        for (String string : description)
            lore.add(ChatColor.GRAY + string);

        if (clickOpen || clickTeleport)
            lore.add("");
    }

    if (clickOpen)
        lore.add(ChatColor.DARK_GRAY + "\u25B6 Cliquez pour ouvrir le menu");

    if (clickTeleport)
        lore.add(ChatColor.DARK_GRAY + "\u25B6 Cliquez pour être téléporté");

    return lore.toArray(loreArray);
}
 
Example 19
Project: Chambers   File: GameTask.java   View source code 6 votes vote down vote up
@Override
public void run() {
	Game game = Chambers.getInstance().getGameManager().getGame();
	game.setTotalTime(game.getTotalTime() + 1);
	if (game.getInvincibilityTime() > 0) {
		game.setInvincibilityTime(game.getInvincibilityTime() - 1);
	} else if (game.getInvincibilityTime() == 0 && game.getTotalTime() == 60) {
		Bukkit.broadcastMessage(ChatColor.RED + "Invincibility is now disabled and PvP has now been enabled!");
	}
	if (game.getTotalTime() == 30) {
		String kothName = game.getKothName();
		Koth koth = new Koth(kothName == null ? game.getMapName() : kothName, 480);
		Chambers.getInstance().getKothManager().setKoth(koth);
		new KothTask().runTaskTimerAsynchronously(Chambers.getInstance(), 0L, 20L);
		Chambers.getInstance().getKothManager().broadcastMessage(ChatColor.BLUE + koth.getName() + ChatColor.YELLOW + " can now be contested.");
	}
	if (game.getTotalTime() % 3 == 0 && game.getTotalTime() != 0) {
		Chambers.getInstance().getProfileManager().getAllPlayingProfiles().forEach(profile -> profile.setBalance(profile.getBalance() + 3));
	}
	if (game.getStatus() == GameStatus.OVER) {
		cancel();
	}
}
 
Example 20
Project: Hub   File: JukeboxManager.java   View source code 6 votes vote down vote up
public String skipSong(boolean becauseMehs)
{
    if (this.currentPlaylist != null && this.currentPlaylist.getPlayer().isPlaying())
    {
        if (becauseMehs)
            this.hub.getServer().broadcastMessage(JUKEBOX_TAG + ChatColor.RED + "La musique est passée car elle a reçu plus de 33% de votes négatifs.");

        this.currentPlaylist.getPlayer().setPlaying(false);

        if (this.nextSong())
            return JUKEBOX_TAG + ChatColor.GREEN + "Musique suivante jouée.";
        else
            return JUKEBOX_TAG + ChatColor.GOLD + "La musique a été arrêtée mais la playlist est vide.";
    }
    else
    {
        return JUKEBOX_TAG + ChatColor.RED + "Aucun son n'est lu actuellement.";
    }
}
 
Example 21
Project: HCFCore   File: ModeratorMode.java   View source code 6 votes vote down vote up
@EventHandler
public void onRecord(PlayerInteractEvent e)
{
  Player p = e.getPlayer();
  if ((modMode.contains(p.getName())) && (p.getItemInHand().getType() == Material.EYE_OF_ENDER) && (e.getAction().toString().contains("RIGHT")))
  { 
    Player random = Bukkit.getOnlinePlayers()[new java.util.Random().nextInt(Bukkit.getOnlinePlayers().length)];
    if (Bukkit.getOnlinePlayers().length == 1)
      p.sendMessage(ChatColor.RED + "§6§ §rOops, seems like there are not enough players to use this.");
      e.setCancelled(true);
    if (Bukkit.getOnlinePlayers().length > 1) {
      if (p != random) {
        p.teleport(random);
        p.sendMessage(ChatColor.YELLOW + " §6§ §rYou were teleported randomly to §c" + random.getName() + "§r.");
        e.setCancelled(true);
      }
      if (p == random) {
      	p.sendMessage(ChatColor.YELLOW + "§6§ §rOops, seems like we accidently found you. Please try again!");
      	e.setCancelled(true);
      }
    }
  }
}
 
Example 22
Project: Chambers   File: KothMoveListener.java   View source code 6 votes vote down vote up
@EventHandler
public void onPlayerLeaveClaim(PlayerLeaveClaimEvent event) {
	if (event.getClaim() == null) {
		return;
	}
	Team team = event.getClaim().getOwner();
	if (team.getType() == TeamType.KOTH_CAP) {
		Koth koth = Chambers.getInstance().getKothManager().getKoth();
		Profile profile = Chambers.getInstance().getProfileManager().getProfileByUuid(event.getPlayer().getUniqueId());
		if (profile.getProfileStatus() != ProfileStatus.PLAYING) {
			return;
		}
		if (koth.getCapper() != null && koth.getCapper() == profile) {
			koth.setCapper(null);
			if (koth.getTime() <= 180) {
				Chambers.getInstance().getKothManager().broadcastMessage("The control of " + ChatColor.BLUE + koth.getName() + ChatColor.YELLOW + "has been lost.");
			}
			profile.sendMessage(Chambers.getInstance().getKothManager().getKothFormat() + "You have lost control of the KOTH.");
		}
		if (koth.getCapQueue().contains(profile)) {
			koth.getCapQueue().remove(profile);
		}
	}
}
 
Example 23
Project: uppercore   File: TextUtil.java   View source code 6 votes vote down vote up
public static String translateCustom(String text) {
    char[] b = text.toCharArray();
    if (b.length == 0) return text;
    if (b.length >= 2 && b[0] == CUSTOM_CONTROL_CHAR) {
        ChatColor color = ChatColor.getByChar(b[1]);
        if (color != null)
            return separator(color);
        switch (b[1]) {
            case '|':
                return center(b, 2, false);
            case '>':
                return leftPad(b, 2, false);
            case '<':
                return new String(b, 2, b.length - 2);
            case CUSTOM_CONTROL_CHAR:
                return new String(b, 1, b.length - 1);
        }
    }
    return text;
}
 
Example 24
Project: uppercore   File: TextUtil.java   View source code 6 votes vote down vote up
public static String translate(String text) {
    char[] b = text.toCharArray();
    if (b.length == 0) return text;
    if (b.length >= 2 && b[0] == CUSTOM_CONTROL_CHAR) {
        ChatColor color = ChatColor.getByChar(b[1]);
        if (color != null)
            return separator(color);
        switch (b[1]) {
            case '|':
                return center(b, 2, true);
            case '>':
                return leftPad(b, 2, true);
            case '<':
                return translatePlain(b, 2);
            case CUSTOM_CONTROL_CHAR:
                return translatePlain(b, 1);
        }
    }
    return translatePlain(b, 0);
}
 
Example 25
Project: HCFCore   File: CoordsCommand.java   View source code 6 votes vote down vote up
@Override
  public boolean onCommand(CommandSender p, Command command, String label, String[] args) {
      if (!(p instanceof Player)) {
          p.sendMessage(ChatColor.RED + "This command is only executable by players.");
          return true;
      }
p.sendMessage("§8§m----------------------------------");
p.sendMessage("§4§lImportant Coordinates");
p.sendMessage(" ");
p.sendMessage("§7* §d§lCandy §7(KoTH) §8§ §f500, 500 §7(Overworld)");
p.sendMessage("§7* §e§lTower §7(KoTH) §8§ §f-500, 500 §7(Overworld)");
p.sendMessage("§7* §b§lShip §7(KoTH ) §8§ §f500, -500 §7(Overworld)");
p.sendMessage("§7* §c§lMountain §7(KoTH) §8§ §f-500, -500 §7(Overworld)"); 
p.sendMessage("§7* §6§lGlowstone Mountain §8§ §f-500, 500 §7(Nether)");
p.sendMessage("§7* §9§lEnd §7(KoTH) §8§ §f11, 8 §7(End)");
p.sendMessage(" ");
p.sendMessage("§7* §3§lEnd Portals §8§ §f750 750 §7(All Quadrants)");
p.sendMessage("§8§m----------------------------------");
      return true;
  }
 
Example 26
Project: DoubleRunner   File: DoubleRunnerGameLoop.java   View source code 6 votes vote down vote up
@Override
public void createDeathmatchEvent()
{
    this.game.setWorldBorderSize(50.0D, 6L * 60L);

    this.nextEvent = new TimedEvent(0, 30, "PvP activé", ChatColor.RED, false, () ->
    {
        this.game.enableDamages();
        this.game.enablePVP();

        this.game.getCoherenceMachine().getMessageManager().writeCustomMessage("Les dégats et le PvP sont maintenant activés. Bonne chance !", true);
        this.game.getCoherenceMachine().getMessageManager().writeCustomMessage("La map est maintenant en réduction constante pendant les 6 prochaines minutes.", true);

        this.createReducingEvent();
    });
}
 
Example 27
Project: Lukkit   File: CommandPlugin.java   View source code 6 votes vote down vote up
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
    if (command.getName().equals("luaplugin")) {
        if (!commandSender.hasPermission("lukkitplus.pl")) {
            commandSender.sendMessage(ChatColor.RED + "Sorry, you don't have permission.");
            return true;
        }
        if (strings.length != 1) {
            commandSender.sendMessage(ChatColor.RED + "Usage: /luaplugin <name>");
            return true;
        }
        LuaPlugin plugin = Environment.findByName(strings[0]);
        if (plugin == null) {
            commandSender.sendMessage(ChatColor.RED + "Plugin specified doesn't exist.");
            return true;
        }
        commandSender.sendMessage("Name: " + ChatColor.GREEN + plugin.getName());
        commandSender.sendMessage("Version: " + ChatColor.GREEN + plugin.getVersion());
        commandSender.sendMessage("Description: " + ChatColor.GREEN + plugin.getDescription());
        return true;
    }
    return false;
}
 
Example 28
Project: BlockBall   File: ArenaCommandExecutor.java   View source code 6 votes vote down vote up
@Override
public void show() {
    this.player.sendMessage("");
    this.player.sendMessage(HEADER_STANDARD);
    this.player.sendMessage("");
    if (this.mode == 0) {
        this.player.sendMessage(Language.PREFIX + "1 - Set message");
        this.player.sendMessage(Language.PREFIX + "2 - Toggle bossbar");
        this.player.sendMessage(Language.PREFIX + "3 - Save bossbar settings");
    } else if (this.mode == 1) {
        this.player.sendMessage(Language.PREFIX + "1 - Set message");
        this.player.sendMessage(Language.PREFIX + "2 - Toggle bossbar");
        this.player.sendMessage(Language.PREFIX + "3 - Set color");
        this.player.sendMessage(Language.PREFIX + "4 - Set flag");
        this.player.sendMessage(Language.PREFIX + "5 - Set style");
        this.player.sendMessage(Language.PREFIX + "6 - Reset this page");
        this.player.sendMessage(Language.PREFIX + "7 - Save bossbar settings");
    }
    this.player.sendMessage(Language.PREFIX + ChatColor.GREEN + MENU_BACK);
    this.player.sendMessage(Language.PREFIX + ChatColor.RED + MENU_EXIT);
    this.player.sendMessage("");
    this.player.sendMessage(FOOTER_STANDARD);
    this.player.sendMessage("");
}
 
Example 29
Project: Hub   File: GuiSwitchHub.java   View source code 5 votes vote down vote up
@Override
public void onClick(Player player, ItemStack stack, String action, ClickType clickType)
{
    if (action.startsWith("Hub_"))
    {
        if (action.split("_")[1].equals(SamaGamesAPI.get().getServerName().split("_")[1]))
        {
            player.sendMessage(ChatColor.RED + "Vous ne pouvez pas aller sur votre hub actuel !");
            return;
        }
        else if (this.hub.getHubRefresher().getHubByID(Integer.parseInt(action.split("_")[1])).getConnectedPlayers() >= 120)
        {
            player.sendMessage(ChatColor.RED + "Le hub sélectionné est plein !");
            return;
        }

        ByteArrayDataOutput out = ByteStreams.newDataOutput();
        out.writeUTF("Connect");
        out.writeUTF(action);
        player.sendPluginMessage(this.hub, "BungeeCord", out.toByteArray());

        // TODO: Use API
        // SamaGamesAPI.get().getPlayerManager().connectToServer(player.getUniqueId(), action);
    }
    else if (action.equals("page_back"))
    {
        this.hub.getGuiManager().openGui(player, new GuiSwitchHub(this.hub, (this.page - 1)));
    }
    else if (action.equals("page_next"))
    {
        this.hub.getGuiManager().openGui(player, new GuiSwitchHub(this.hub, (this.page + 1)));
    }
    else if (action.equals("back"))
    {
        this.hub.getGuiManager().openGui(player, new GuiMain(this.hub));
    }
}
 
Example 30
Project: HCFCore   File: FactionInvitesArgument.java   View source code 5 votes vote down vote up
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    if (!(sender instanceof Player)) {
        sender.sendMessage(ChatColor.RED + "Only players can have faction invites.");
        return true;
    }

    List<String> receivedInvites = new ArrayList<>();
    for (Faction faction : plugin.getFactionManager().getFactions()) {
        if (faction instanceof PlayerFaction) {
            PlayerFaction targetPlayerFaction = (PlayerFaction) faction;
            if (targetPlayerFaction.getInvitedPlayerNames().contains(sender.getName())) {
                receivedInvites.add(targetPlayerFaction.getDisplayName(sender));
            }
        }
    }

    PlayerFaction playerFaction = plugin.getFactionManager().getPlayerFaction((Player) sender);
    String delimiter = ChatColor.WHITE + ", " + ChatColor.GRAY;

    if (playerFaction != null) {
        Set<String> sentInvites = playerFaction.getInvitedPlayerNames();
        sender.sendMessage(ChatColor.AQUA + "Sent by " + playerFaction.getDisplayName(sender) + ChatColor.AQUA + " (" + sentInvites.size() + ')' + ChatColor.DARK_AQUA + ": " + ChatColor.GRAY
                + (sentInvites.isEmpty() ? "Your faction has not invited anyone." : StringUtils.join(sentInvites, delimiter) + '.'));
    }

    sender.sendMessage(ChatColor.AQUA + "Requested (" + receivedInvites.size() + ')' + ChatColor.DARK_AQUA + ": " + ChatColor.GRAY
            + (receivedInvites.isEmpty() ? "No factions have invited you." : StringUtils.join(receivedInvites, ChatColor.WHITE + delimiter) + '.'));

    return true;
}
 
Example 31
Project: HCFCore   File: LogoutTimer.java   View source code 5 votes vote down vote up
public void run(Player player) {
    long remainingMillis = getRemaining(player);
    if (remainingMillis > 0L) {
        player.sendMessage(getDisplayName() + ChatColor.BLUE + " timer is disconnecting you in " + ChatColor.BOLD + DurationFormatter.getRemaining(remainingMillis, true, false) + ChatColor.BLUE
                + '.');
    }
}
 
Example 32
Project: DragonEggDrop   File: DragonTemplate.java   View source code 5 votes vote down vote up
/**
 * Construct a new DragonTemplate object
 * 
 * @param identifier the name to identify this template
 * @param name the name of the dragon. Can be null
 * @param barStyle the style of the bar. Can be null
 * @param barColour the colour of the bar. Can be null
 */
public DragonTemplate(String identifier, String name, BarStyle barStyle, BarColor barColour) {
	Validate.notEmpty(identifier, "Idenfitier must not be empty or null");
	
	this.file = null;
	this.configFile = null;
	this.identifier = identifier;
	
	this.name = (name != null ? ChatColor.translateAlternateColorCodes('&', name) : null);
	this.barStyle = (barStyle != null ? barStyle : BarStyle.SOLID);
	this.barColour = (barColour != null ? barColour : BarColor.PINK);
	this.loot = new DragonLoot(this);
}
 
Example 33
Project: BedwarsXP   File: XPItemShop.java   View source code 5 votes vote down vote up
private ItemStack toItemStack(VillagerTrade trade, Player player, Game game) {
	ItemStack tradeStack = trade.getRewardItem().clone();
	Method colorable = Utils.getColorableMethod(tradeStack.getType());
	ItemMeta meta = tradeStack.getItemMeta();
	ItemStack item1 = trade.getItem1();
	ItemStack item2 = trade.getItem2();
	if ((tradeStack.getType().equals(Material.STAINED_GLASS))
			|| (tradeStack.getType().equals(Material.WOOL))
			|| (tradeStack.getType().equals(Material.STAINED_CLAY))) {
		tradeStack.setDurability((short) game.getPlayerTeam(player)
				.getColor().getDyeColor().getData());
	} else if (colorable != null) {
		colorable.setAccessible(true);
		try {
			colorable.invoke(meta, new Object[] { game
					.getPlayerTeam(player).getColor().getColor() });
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	List<String> lores = meta.getLore();
	if (lores == null) {
		lores = new ArrayList<String>();
	}
	if (trade instanceof XPVillagerTrade) {
		lores.add("��a" + ((XPVillagerTrade) trade).getXP() + " ����");
	} else {
		lores.add(ChatColor.WHITE + String.valueOf(item1.getAmount()) + " "
				+ item1.getItemMeta().getDisplayName());
		if (item2 != null) {
			lores.add(ChatColor.WHITE + String.valueOf(item2.getAmount())
					+ " " + item2.getItemMeta().getDisplayName());
		}
	}
	meta.setLore(lores);
	tradeStack.setItemMeta(meta);
	return tradeStack;
}
 
Example 34
Project: Kineticraft   File: Restrictions.java   View source code 5 votes vote down vote up
@EventHandler
public void onVehicleMove(VehicleMoveEvent evt) {
    String fly = evt.getVehicle().getPassengers().stream().filter(e -> e instanceof Player).map(Entity::getName)
            .collect(Collectors.joining(", "));

    if (evt.getVehicle().getType() == EntityType.BOAT && !Flight.checkNearby(evt.getFrom(), Material.WATER, Material.STATIONARY_WATER)
            && fly.length() > 0 && evt.getTo().getY() > evt.getFrom().getY() && evt.getVehicle().getVelocity().getY() <= 0)
        Core.alertStaff("[BoatFly] " + ChatColor.GRAY + fly + " may be using BoatFly.");
}
 
Example 35
Project: ProjectAres   File: TeamCommands.java   View source code 5 votes vote down vote up
@Command(
    aliases = {"myteam", "mt"},
    desc = "Shows you what team you are on",
    min = 0,
    max = 0
)
@CommandPermissions("pgm.myteam")
public void myteam(CommandContext args, CommandSender sender) throws CommandException {
    MatchPlayer player = CommandUtils.senderToMatchPlayer(sender);
    if(player.getParty() instanceof Team) {
        sender.sendMessage(ChatColor.GRAY + PGMTranslations.t("command.gameplay.myteam.message", player, player.getParty().getColoredName() + ChatColor.GRAY));
    } else {
        throw new CommandException(PGMTranslations.get().t("command.gameplay.myteam.notOnTeam", sender));
    }
}
 
Example 36
Project: HCFCore   File: ClaimableFaction.java   View source code 5 votes vote down vote up
/**
 * Prints details about this {@link Faction} to a {@link CommandSender}.
 *
 * @param sender
 *            the sender to print to
 */
@Override
public void printDetails(CommandSender sender) {
    sender.sendMessage(ChatColor.DARK_GRAY + BukkitUtils.STRAIGHT_LINE_DEFAULT);
    sender.sendMessage(' ' + getDisplayName(sender));
    for (Claim claim : claims) {
        Location location = claim.getCenter();
        sender.sendMessage(ChatColor.YELLOW + "  Location: " + ChatColor.RED + '(' + ENVIRONMENT_MAPPINGS.get(location.getWorld().getEnvironment()) + ", " + location.getBlockX() + " | "
                + location.getBlockZ() + ')');
    }

    sender.sendMessage(ChatColor.DARK_GRAY + BukkitUtils.STRAIGHT_LINE_DEFAULT);
}
 
Example 37
Project: HCFCore   File: RawcastCommand.java   View source code 5 votes vote down vote up
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{
  if (args.length < 1)
  {
    sender.sendMessage(ChatColor.RED + "Usage: " + "/rawcast");
    return true;
  }
  String arg;
  String requiredNode;
  int position = 0;
  if ((args.length > 2) && ((arg = args[0]).startsWith("-p")))
  {
    int position1 = 1;
    requiredNode = arg.substring(2, arg.length());
  }
  else
  {
    position = 0;
    requiredNode = null;
  }
  String message = StringUtils.join(args, ' ', position, args.length);
  if (message.length() < 3)
  {
    sender.sendMessage(ChatColor.RED + "Broadcasts must be at least 3 characters.");
    return true;
  }
  message = ChatColor.translateAlternateColorCodes('&', message);
  if (requiredNode != null) {
    Bukkit.broadcast(message, requiredNode);
  } else {
    Bukkit.broadcastMessage(message);
  }
  return true;
}
 
Example 38
Project: Mob-AI   File: CommandHandler.java   View source code 5 votes vote down vote up
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
  	if (!(sender instanceof Player)) {
      	sender.sendMessage("This command can't be executed from the console");
          return false;
}
  	else {
  		Player psender = (Player)sender;
  		if (args.length > 0){
  			Boolean onlyNearestMob = plugin.getConfig().getBoolean("OnlyNearestMob");
      		if (onlyNearestMob){
      			//TODO: Nearest entity
      		}
      		else {
      			Integer range = plugin.getConfig().getInt("BlockDistance");
      			Location ploc = psender.getLocation();
      			List<Entity> entities = getEntities(ploc, range);
      			String chatPrefix = plugin.getConfig().getString("ChatPrefix");
      			if (entities.isEmpty()) psender.sendMessage(
      				(Object)ChatColor.DARK_GRAY + "[" + 
      				(Object)ChatColor.DARK_AQUA + chatPrefix + 
      				(Object)ChatColor.DARK_GRAY + "] " +
      				(Object)ChatColor.DARK_RED + "Error: No entity near you!"
      			);
      		}
  		}
  		else {
  			psender.sendMessage(
  				(Object)ChatColor.DARK_AQUA + "--=== "      +  
  				(Object)ChatColor.YELLOW + "USAGE:"         + 
  				(Object)ChatColor.DARK_AQUA + " ===--\n- "  +
  				(Object)ChatColor.YELLOW + "/mob YOUR TEXT" +
  				(Object)ChatColor.DARK_AQUA + " -\n"        +
  				"--==============--"
  			);
  		}
  		return true;
  	}
  }
 
Example 39
Project: ProjectAres   File: RotationEditCommands.java   View source code 5 votes vote down vote up
@Command(
    aliases = {"append", "a"},
    desc = "Append a map to the end of the rotation",
    usage = "[map name]",
    min = 1,
    max = -1
)
@CommandPermissions("pgm.rotation.append")
public static void append(CommandContext args, CommandSender sender) throws CommandException {
    PGMMap map = CommandUtils.getMap(args.getJoinedStrings(0), sender);

    apply(new AppendTransformation(map));
    sender.sendMessage(ChatColor.DARK_PURPLE + "Appended " + ChatColor.GOLD + map.getInfo().name + ChatColor.DARK_PURPLE + " to the rotation.");
}
 
Example 40
Project: ProjectAres   File: AdminCommands.java   View source code 5 votes vote down vote up
@Command(
    aliases = {"skip"},
    desc = "Skip maps in the rotation",
    usage = "[n] - defaults to 1",
    min = 0,
    max = 1
)
@CommandPermissions("pgm.skip")
public void skip(CommandContext args, CommandSender sender) throws CommandException {
    RotationManager manager = PGM.getMatchManager().getRotationManager();
    RotationState rotation = manager.getRotation();

    if(args.argsLength() > 0) {
        int n = args.getInteger(0, 1);
        rotation = rotation.skip(n);
        sender.sendMessage(
                ChatColor.GREEN +
                PGMTranslations.get().t("command.admin.skip.successMultiple", sender,
                        PGMTranslations.get().t(n == 1 ? "maps.singularCompound" : "maps.pluralCompound", sender, n),
                        rotation.getNext().getInfo().getShortDescription(sender) + ChatColor.GREEN
                )
        );
    } else {
        PGMMap skippedMap = rotation.getNext();
        rotation = rotation.skip(1);
        sender.sendMessage(ChatColor.GREEN + PGMTranslations.get().t("command.admin.skip.success", sender, skippedMap.getInfo().getShortDescription(sender) + ChatColor.GREEN));
    }

    manager.setRotation(rotation);
}