本文整理汇总了Java中net.samagames.tools.chat.fanciful.FancyMessage类的典型用法代码示例。如果您正苦于以下问题:Java FancyMessage类的具体用法?Java FancyMessage怎么用?Java FancyMessage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FancyMessage类属于net.samagames.tools.chat.fanciful包,在下文中一共展示了FancyMessage类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setSpectator
import net.samagames.tools.chat.fanciful.FancyMessage; //导入依赖的package包/类
/**
* Puts this player into spectator mode.
*/
public void setSpectator()
{
this.spectator = true;
this.stepPlayedTimeCounter();
Bukkit.getScheduler().runTask(SamaGamesAPI.get().getPlugin(), () ->
{
final Player bukkitPlayer = this.getPlayerIfOnline();
if (bukkitPlayer == null)
return;
bukkitPlayer.setGameMode(GameMode.SPECTATOR);
for (Player player : Bukkit.getOnlinePlayers())
player.hidePlayer(bukkitPlayer);
new FancyMessage("Cliquez ").color(ChatColor.YELLOW).style(ChatColor.BOLD).then("[ICI]").command("/hub").color(ChatColor.AQUA).style(ChatColor.BOLD).then(" pour retourner au hub !").color(ChatColor.YELLOW).style(ChatColor.BOLD).send(bukkitPlayer);
});
}
示例2: showPrices
import net.samagames.tools.chat.fanciful.FancyMessage; //导入依赖的package包/类
public void showPrices(Jedis jedis, Player player, String gameCodeName, String template, int id, int coins, int pearls)
{
boolean currentlyCooldown = jedis.exists("hub:event:cooldown:" + player.getUniqueId().toString() + ":" + id);
FancyMessage message = new FancyMessage("[\u25B6]").color(currentlyCooldown ? ChatColor.RED : ChatColor.GREEN);
if (!currentlyCooldown && gameCodeName != null)
{
message.command("/event create " + gameCodeName + " " + template + " " + id);
message.tooltip(ChatColor.GOLD + "» Clic pour sélectionner");
}
else if (currentlyCooldown)
{
message.tooltip(ChatColor.RED + "» Disponible dans " + this.formatCooldownDate(Long.parseLong(jedis.get("hub:event:cooldown:" + player.getUniqueId().toString() + ":" + id))));
}
else
{
message.tooltip(ChatColor.GREEN + "» Disponible");
}
message.then(" ");
if (coins > 0)
message.then(coins + " pièce" + (coins > 1 ? "s" : "")).color(ChatColor.GOLD);
if (coins > 0 && pearls > 0)
message.then(" et ").color(ChatColor.GRAY);
if (pearls > 0)
message.then(pearls + " perle" + (pearls > 1 ? "s" : "")).color(ChatColor.GREEN);
message.send(player);
}
示例3: showHelpSubCommand
import net.samagames.tools.chat.fanciful.FancyMessage; //导入依赖的package包/类
private void showHelpSubCommand(Player player, String command, String description)
{
new FancyMessage("/event " + command).color(ChatColor.YELLOW)
.command("/event " + command)
.tooltip(ChatColor.GOLD + "» Clic pour pré-remplir la commande")
.then(" : " + description).color(ChatColor.GRAY)
.send(player);
}
示例4: showRulesWarning
import net.samagames.tools.chat.fanciful.FancyMessage; //导入依赖的package包/类
public void showRulesWarning(Player player)
{
player.sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬");
new FancyMessage("Il s'agit de votre première partie sur ce jeu ! Nous vous conseillons d'aller d'abord lire les règles en").color(ChatColor.GREEN)
.then("cliquant ici").color(ChatColor.GREEN).style(ChatColor.BOLD).link(this.getWebsiteDescriptionURL())
.then(" pour accéder aux règles du jeu.").style(ChatColor.GREEN)
.send(player);
player.sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬");
}
示例5: onClick
import net.samagames.tools.chat.fanciful.FancyMessage; //导入依赖的package包/类
@Override
public void onClick(Player player, ItemStack stack, String action, ClickType clickType)
{
switch (action)
{
case "website":
new FancyMessage(ChatColor.YELLOW + "Cliquez sur ").then("[Accéder]").color(ChatColor.GOLD).style(ChatColor.BOLD).link("https://www.samagames.net/stats/" + player.getName() + ".html").then(" pour accéder à vos statistiques en ligne.").color(ChatColor.YELLOW).send(player);
break;
case "back":
this.hub.getGuiManager().openGui(player, new GuiProfile(this.hub));
break;
}
}
示例6: onClick
import net.samagames.tools.chat.fanciful.FancyMessage; //导入依赖的package包/类
@Override
public void onClick(Player player, ItemStack stack, String action, ClickType clickType)
{
switch (action)
{
case "friend":
new FancyMessage(ChatColor.YELLOW + "Cliquez sur ").then("[Inviter]").color(ChatColor.GREEN).suggest("/friends add " + this.name).then(" pour inviter ce joueur en ami.").color(ChatColor.YELLOW).send(player);
this.hub.getGuiManager().closeGui(player);
break;
case "mp":
new FancyMessage(ChatColor.YELLOW + "Cliquez sur ").then("[Envoyer]").color(ChatColor.GREEN).suggest("/msg " + this.name + " ").then(" pour envoyer un message privé à " + this.name + ".").color(ChatColor.YELLOW).send(player);
this.hub.getGuiManager().closeGui(player);
break;
case "party":
new FancyMessage(ChatColor.YELLOW + "Cliquez sur ").then("[Inviter]").color(ChatColor.GREEN).suggest("/party invite " + this.name).then(" pour inviter ce joueur dans votre partie.").color(ChatColor.YELLOW).send(player);
this.hub.getGuiManager().closeGui(player);
break;
case "stats":
this.hub.getGuiManager().openGui(player, new GuiStatistics(this.hub, this.hub.getServer().getPlayer(this.uuid)));
break;
case "back":
this.hub.getGuiManager().closeGui(player);
break;
}
}
示例7: invite
import net.samagames.tools.chat.fanciful.FancyMessage; //导入依赖的package包/类
/**
* Invite a given player to the team
*
* @param member Person who invite
* @param invited Invited person
*/
public void invite(String member, UUID invited)
{
this.invited.add(invited);
new FancyMessage("Vous avez été invité dans l'équipe " + this.teamName + " par " + member + " ")
.color(ChatColor.GOLD)
.style(ChatColor.BOLD)
.then("[Rejoindre]")
.color(ChatColor.GREEN)
.style(ChatColor.BOLD)
.command("/uhc join " + this.chatColor.getChar())
.send(Bukkit.getPlayer(invited));
}
示例8: sendRewardMessage
import net.samagames.tools.chat.fanciful.FancyMessage; //导入依赖的package包/类
/**
* Send reward message to player
*
* @param uuid Player
*/
protected void sendRewardMessage(UUID uuid)
{
Bukkit.getScheduler().runTask(SamaGamesAPI.get().getPlugin(), () ->
{
Player player = Bukkit.getPlayer(uuid);
if (player == null)
return;
Reflection.playSound(player, player.getLocation(), Reflection.PackageType.getServerVersion().equals("v1_8_R3") ? "LEVEL_UP" : "ENTITY_PLAYER_LEVELUP", 1L, 1L);
Firework firework = player.getWorld().spawn(player.getLocation(), Firework.class);
FireworkMeta fireworkMeta = firework.getFireworkMeta();
fireworkMeta.setPower(2);
fireworkMeta.addEffect(FIREWORK_EFFECT);
firework.setFireworkMeta(fireworkMeta);
String[] array = new String[this.description.length + 2];
array[0] = ChatColor.AQUA + this.displayName;
array[1] = "";
for (int i = 0; i < this.description.length; i++)
array[i + 2] = ChatColor.GRAY + this.description[i];
String finalDisplayName = "";
for (char letter : this.getDisplayName().toCharArray())
finalDisplayName += ChatColor.AQUA + "" + letter;
FancyMessage message = new FancyMessage(ChatColor.DARK_AQUA + "\u25A0 ")
.then(ChatColor.AQUA + player.getName())
.then(ChatColor.WHITE + " a débloqué l'objectif : ")
.then(finalDisplayName)
.tooltip(array)
.then(ChatColor.WHITE + " ! ")
.then(ChatColor.DARK_AQUA + "\u25A0");
try
{
FancyMessage personalMessage = new FancyMessage(ChatColor.DARK_AQUA + "\u25A0 ")
.then(ChatColor.AQUA + player.getName())
.then(ChatColor.WHITE + " a débloqué l'objectif : ")
.then(finalDisplayName)
.tooltip(array)
.then(ChatColor.WHITE + " ! ")
.then(ChatColor.DARK_AQUA + "[Tweeter]")
.tooltip(ChatColor.AQUA + "Partager sur Twitter")
.link("https://twitter.com/intent/tweet?text=Je+viens+de+d%C3%A9bloquer+l%27objectif+%27" + URLEncoder.encode(this.getDisplayName(), "UTF-8") + "%27+sur+%40SamaGames_Mc+%21")
.then(ChatColor.DARK_AQUA + " \u25A0");
personalMessage.send(player);
Bukkit.getOnlinePlayers().stream().filter(p -> p.getUniqueId() != uuid).forEach(message::send);
}
catch (UnsupportedEncodingException e)
{
e.printStackTrace();
Bukkit.getOnlinePlayers().forEach(message::send);
}
});
}
示例9: unlockRandomizedCosmetic
import net.samagames.tools.chat.fanciful.FancyMessage; //导入依赖的package包/类
public AbstractCosmetic unlockRandomizedCosmetic(Player player, Pearl pearl, Location openingLocation)
{
Collections.shuffle(this.cosmetics);
CosmeticRarity rarity = Star.getByCount(pearl.getStars()).getRandomizedRarity();
List<AbstractCosmetic> cosmeticsSelected = this.cosmetics.getByRarity(rarity);
AbstractCosmetic cosmeticSelected = cosmeticsSelected.get(new Random().nextInt(cosmeticsSelected.size()));
List<String> lore = new ArrayList<>();
lore.add(ChatColor.DARK_GRAY + "Rareté : " + cosmeticSelected.getRarity().getColor() + cosmeticSelected.getRarity().getName());
lore.add(ChatColor.DARK_GRAY + "Type : " + ChatColor.GRAY + cosmeticSelected.getCategoryName());
new FancyMessage("\u272F ").color(ChatColor.GOLD)
.then("Vous avez trouvé ").color(ChatColor.YELLOW)
.then(cosmeticSelected.getIcon().getItemMeta().getDisplayName()).tooltip(lore)
.then(" dans le cadeau !").color(ChatColor.YELLOW)
.then(" \u272F").color(ChatColor.GOLD)
.send(player);
if (cosmeticSelected.isOwned(player))
{
player.sendMessage(ChatColor.GOLD + "\u272F " + ChatColor.YELLOW + "Malheureusement, vous possédiez déjà ce cosmétique..." + ChatColor.GOLD + " \u272F");
player.sendMessage(ChatColor.GOLD + "\u272F " + ChatColor.YELLOW + "Graou vous offre alors " + ChatColor.AQUA + cosmeticSelected.getRefundPrice() + " poussières d'\u272F" + ChatColor.GOLD + " \u272F");
SamaGamesAPI.get().getPlayerManager().getPlayerData(player.getUniqueId()).increasePowders(cosmeticSelected.getRefundPrice());
this.hub.getScoreboardManager().update(player);
}
else
{
if (cosmeticSelected.getRarity() == CosmeticRarity.EPIC || cosmeticSelected.getRarity() == CosmeticRarity.LEGENDARY)
{
FancyMessage globalMessage = new FancyMessage("\u272F " + player.getName()).color(ChatColor.GOLD)
.then(" a trouvé ").color(ChatColor.YELLOW)
.then(cosmeticSelected.getIcon().getItemMeta().getDisplayName()).tooltip(lore)
.then(" dans un cadeau !").color(ChatColor.YELLOW)
.then(" \u272F").color(ChatColor.GOLD);
this.hub.getServer().getOnlinePlayers().stream().filter(p -> p.getUniqueId() != player.getUniqueId()).forEach(globalMessage::send);
if (cosmeticSelected.getRarity() == CosmeticRarity.LEGENDARY)
{
openingLocation.getWorld().strikeLightningEffect(openingLocation);
this.hub.getServer().getOnlinePlayers().forEach(p -> p.playSound(p.getLocation(), Sound.ENTITY_ENDERDRAGON_GROWL, 1.0F, 1.0F));
}
}
cosmeticSelected.unlock(player);
}
SamaGamesAPI.get().getAchievementManager().getAchievementByID(50).unlock(player.getUniqueId());
this.hub.getInteractionManager().getGraouManager().deletePlayerPearl(player.getUniqueId(), pearl.getUUID());
this.hub.getScoreboardManager().update(player);
return cosmeticSelected;
}
示例10: onClick
import net.samagames.tools.chat.fanciful.FancyMessage; //导入依赖的package包/类
@Override
public void onClick(Player player, ItemStack stack, String action, ClickType clickType)
{
if (action.equals("beta_vip") && SamaGamesAPI.get().getPermissionsManager().hasPermission(player, "hub.beta.vip"))
{
player.teleport(this.hub.getGameManager().getGameByIdentifier("beta_vip").getLobbySpawn());
}
else if (action.equals("switch_hub"))
{
this.hub.getGuiManager().openGui(player, new GuiSwitchHub(this.hub, 1));
}
else if (action.equals("spawn"))
{
player.teleport(this.hub.getPlayerManager().getSpawn());
}
else if (action.equals("parkour"))
{
player.teleport(this.hub.getParkourManager().getParkours().get(0).getFail());
}
else if (action.startsWith("game"))
{
String[] actions = action.split("_");
AbstractGame game = this.hub.getGameManager().getGameByIdentifier(actions[1]);
if (game.getState() == AbstractGame.State.LOCKED || game.getState() == AbstractGame.State.SOON)
{
player.sendMessage(ChatColor.RED + "Ce jeu n'est pas disponible.");
return;
}
if (clickType == ClickType.LEFT)
{
player.teleport(game.getLobbySpawn());
}
else if (clickType == ClickType.RIGHT && game.getWebsiteDescriptionURL() != null)
{
this.hub.getGuiManager().closeGui(player);
new FancyMessage(ChatColor.YELLOW + "Cliquez sur ").then("[Accéder]").color(ChatColor.GOLD).style(ChatColor.BOLD).link(game.getWebsiteDescriptionURL()).then(" pour accéder aux règles du jeu.").color(ChatColor.YELLOW).send(player);
}
}
}