me.rayzr522.jsonmessage.JSONMessage Java Examples

The following examples show how to use me.rayzr522.jsonmessage.JSONMessage. 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: GuildWarJoinTask.java    From Guilds with MIT License 6 votes vote down vote up
@Override
public void run() {
    players.forEach(p -> {
        Player player = Bukkit.getPlayer(p);
        if (player != null) {
            JSONMessage.actionbar(joinMsg.replace("{amount}", String.valueOf(timeLeft)), player);
        }
    });
    timeLeft--;
    if (timeLeft == 0) {
        challenge.setJoinble(false);
        if (!challengeHandler.checkEnoughJoined(challenge)) {
            challenge.getChallenger().sendMessage(guilds.getCommandManager(), Messages.WAR__NOT_ENOUGH_JOINED);
            challenge.getDefender().sendMessage(guilds.getCommandManager(), Messages.WAR__NOT_ENOUGH_JOINED);
            challenge.getArena().setInUse(false);
            challengeHandler.removeChallenge(challenge);
            cancel();
            return;
        }
        List<UUID> warReady = Stream.concat(challenge.getChallengePlayers().stream(), challenge.getDefendPlayers().stream()).collect(Collectors.toList());
        new GuildWarReadyTask(guilds, readyTime, warReady, readyMsg, challenge, challengeHandler).runTaskTimer(guilds, 0L, 20L);
        cancel();
    }
}
 
Example #2
Source File: InviteCmd.java    From SkyWarsReloaded with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean run() {
	Party party = Party.getParty(player);
	if (party == null) {
		player.sendMessage(new Messaging.MessageFormatter().format("party.mustcreate"));
		return false;
	}
	
	if (!party.getLeader().equals(player.getUniqueId())) {
		player.sendMessage(new Messaging.MessageFormatter().format("party.mustbepartyleader"));
		return false;
	}
	
	String invite = args[1];
	Player invited = null;
	for (Player p: Bukkit.getOnlinePlayers()) {
		if (p.getName().equalsIgnoreCase(invite)) {
			invited = p;
		}
	}
	
	if (invited != null && invited != player) {
		Party inv = Party.getPartyOfInvite(invited);
		if (inv != null) {
			player.sendMessage(new Messaging.MessageFormatter().setVariable("player", invited.getName()).format("party.pendingInvite"));
			return true;
		}
		party.invite(invited);
		invited.sendMessage(new Messaging.MessageFormatter().setVariable("leader", player.getName()).setVariable("partyname", party.getPartyName()).format("party.invite"));

		JSONMessage.create(new Messaging.MessageFormatter().format("party.clicktoaccept"))
				.color(ChatColor.GOLD)
				.tooltip(new Messaging.MessageFormatter().format("party.clicktoaccept"))
				.color(ChatColor.AQUA)
				.runCommand("/swp a")
				.send(invited);

		player.sendMessage(new Messaging.MessageFormatter().setVariable("player", invited.getName()).format("party.invited"));
	} else {
		player.sendMessage(new Messaging.MessageFormatter().setVariable("player",  invite).format("party.couldnotfind"));
	}
	return true;
}