adding interactive Chat elements.
This commit is contained in:
parent
d7d11e57e5
commit
ad280c96c9
@ -116,4 +116,66 @@ public enum Rank
|
||||
{
|
||||
return _donor;
|
||||
}
|
||||
|
||||
public String getRankDescription()
|
||||
{
|
||||
switch(this)
|
||||
{
|
||||
case ULTRA:
|
||||
return "Mineplex’s first premium rank\n"
|
||||
+ "Buy ULTRA at mineplex.com/shop!";
|
||||
case HERO:
|
||||
return "Mineplex’s second premium rank\n"
|
||||
+ "Buy HERO at mineplex.com/shop!";
|
||||
case LEGEND:
|
||||
return "Mineplex’s third premium rank\n"
|
||||
+ "Buy LEGEND at mineplex.com/shop!";
|
||||
case TITAN:
|
||||
return "This is a special rank that can only be found in\n"
|
||||
+ "mythical chests and on special occasions!";
|
||||
case TWITCH:
|
||||
return "Official Twitch Streamer!";
|
||||
case YOUTUBE:
|
||||
return "Official Youtuber!";
|
||||
case MEDIA:
|
||||
return "Official Mineplex Artist or Designer!";
|
||||
case MAPDEV:
|
||||
return "Players with the Builder rank are building\n"
|
||||
+ "all the beautiful maps you can see on Mineplex!";
|
||||
case MAPLEAD:
|
||||
return "Mapleads are the head of Builders.";
|
||||
case HELPER:
|
||||
return "Trainees are staff in training,\n"
|
||||
+ "and are here to help players and moderate!\n"
|
||||
+ "If you have any question, just message them per /a.";
|
||||
case MODERATOR:
|
||||
return "Moderators are here to moderate\n"
|
||||
+ "and help players with any concerns they have. \n"
|
||||
+ "If you have any question, just message them per /a.";
|
||||
case SNR_MODERATOR:
|
||||
return "Senior Moderators are in a special\n"
|
||||
+ "Senior Moderator team where they have to fulfill team tasks.\n"
|
||||
+ "They are similar to Moderators who you can always ask for help!\n"
|
||||
+ "If you have any question, just message them per /a.";
|
||||
case SUPPORT:
|
||||
return "Support Agents take care of all the tickets\n"
|
||||
+ "that get sent to mineplex.com/support";
|
||||
case JNR_DEV:
|
||||
return "Junior Developers are making new Games\n"
|
||||
+ "and new Features for you to enjoy!";
|
||||
case ADMIN:
|
||||
return "Administrators have their own\n"
|
||||
+ " Senior Moderator Team that they lead!";
|
||||
case DEVELOPER:
|
||||
return "Developers are making new Games\n"
|
||||
+ "and new Features for you to enjoy!";
|
||||
case OWNER:
|
||||
return "Owners are the Founder of Mineplex\n"
|
||||
+ "and they all Manage different parts of it!";
|
||||
case LT:
|
||||
return "Leaders are in charge of special teams\n"
|
||||
+ "such as the whole staff team or the support!";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
@ -77,8 +77,16 @@ import mineplex.minecraft.game.core.combat.DeathMessageType;
|
||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
import mineplex.minecraft.game.core.condition.ConditionManager;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import net.md_5.bungee.api.chat.HoverEvent.Action;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.minecraft.server.v1_8_R3.ChatMessage;
|
||||
import net.minecraft.server.v1_8_R3.EntityInsentient;
|
||||
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_8_R3.IChatBaseComponent;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -586,6 +594,18 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
}
|
||||
else
|
||||
{
|
||||
TextComponent rankComponent = new TextComponent(rankStr);
|
||||
TextComponent playerNameText = new TextComponent(ChatColor.YELLOW + playerName);
|
||||
TextComponent component = new TextComponent();
|
||||
|
||||
rankComponent.setHoverEvent(new HoverEvent(Action.SHOW_TEXT, new ComponentBuilder(rank.getColor() + rank.getTag(true, true) + ChatColor.WHITE + ":\n" + rank.getRankDescription()).create()));
|
||||
|
||||
// playerNameText.setClickEvent(new ClickEvent(net.md_5.bungee.api.chat.ClickEvent.Action.RUN_COMMAND, "/stats " + playerName));
|
||||
|
||||
component.setText(levelStr);
|
||||
component.addExtra(rankComponent);
|
||||
component.addExtra(playerNameText);
|
||||
component.addExtra(" " + ChatColor.WHITE + event.getMessage());
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
if (_tutorialManager.InTutorial(other))
|
||||
@ -594,9 +614,13 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
continue;
|
||||
}
|
||||
|
||||
event.setMessage(event.getMessage());
|
||||
event.setFormat(levelStr + rankStr + C.cYellow + playerName + " " + C.cWhite + "%2$s");
|
||||
// event.setMessage(event.getMessage());
|
||||
// event.setFormat(levelStr + rankStr + C.cYellow + playerName + " " + C.cWhite + "%2$s");
|
||||
if(!event.isCancelled())
|
||||
other.spigot().sendMessage(component);
|
||||
|
||||
}
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,10 +6,15 @@ import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.party.Party;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.md_5.bungee.api.chat.HoverEvent.Action;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -64,7 +69,7 @@ public class GameChatManager implements Listener
|
||||
|
||||
if(!cc.GetRank().has(Rank.JNR_DEV))
|
||||
{
|
||||
disguiseTag = ChatColor.BLACK + " ";
|
||||
disguiseTag = ChatColor.BLACK + " ";
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,7 +128,7 @@ public class GameChatManager implements Listener
|
||||
|
||||
//Base Format
|
||||
event.setFormat(disguiseTag + dead + levelStr + rankStr + Manager.GetColor(sender) + senderName + " " + ChatColor.WHITE + "%2$s");
|
||||
|
||||
TextComponent message = getChatMessage(disguiseTag, dead, levelStr, rank, rankStr, sender, event.getMessage(), senderName, null, true);
|
||||
//Public/Private (Not If Player Dead)
|
||||
if (Manager.GetGame() != null && Manager.GetGame().GetState() == GameState.Live)
|
||||
{
|
||||
@ -139,18 +144,27 @@ public class GameChatManager implements Listener
|
||||
{
|
||||
event.setMessage(event.getMessage().substring(1, event.getMessage().length()));
|
||||
event.setFormat(disguiseTag + C.cWhite + C.Bold + "Team" + " " + dead + levelStr + rankStr + team.GetColor() + senderName + " " + C.cWhite + "%2$s");
|
||||
message = getChatMessage(disguiseTag, dead, levelStr, rank, rankStr, sender, event.getMessage(), senderName, team, false);
|
||||
}
|
||||
//All Chat
|
||||
else
|
||||
{
|
||||
globalMessage = true;
|
||||
event.setFormat(disguiseTag + dead + levelStr + rankStr + team.GetColor() + senderName + " " + C.cWhite + "%2$s");
|
||||
message = getChatMessage(disguiseTag, dead, levelStr, rank, rankStr, sender, event.getMessage(), senderName, team, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (globalMessage)
|
||||
{
|
||||
if(!event.isCancelled())
|
||||
{
|
||||
for(Player player : UtilServer.getPlayers())
|
||||
player.spigot().sendMessage(message);
|
||||
}
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
|
||||
}
|
||||
//Team Message Remove Recipient
|
||||
Iterator<Player> recipientIterator = event.getRecipients().iterator();
|
||||
|
||||
@ -159,19 +173,62 @@ public class GameChatManager implements Listener
|
||||
Player receiver = recipientIterator.next();
|
||||
|
||||
if (!Manager.GetServerConfig().Tournament && Manager.GetClients().Get(receiver).GetRank().has(Rank.MODERATOR))
|
||||
{
|
||||
if(!event.isCancelled())
|
||||
receiver.spigot().sendMessage(message);
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
GameTeam recTeam = Manager.GetGame().GetTeam(receiver);
|
||||
GameTeam sendTeam = Manager.GetGame().GetTeam(sender);
|
||||
|
||||
if (recTeam == null || sendTeam == null)
|
||||
{
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!recTeam.equals(sendTeam))
|
||||
{
|
||||
recipientIterator.remove();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!event.isCancelled())
|
||||
receiver.spigot().sendMessage(message);
|
||||
}
|
||||
}
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if(!event.isCancelled())
|
||||
{
|
||||
for(Player player : UtilServer.getPlayers())
|
||||
player.spigot().sendMessage(message);
|
||||
}
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
public TextComponent getChatMessage(String disguiseTag, String dead, String levelStr, Rank rank, String rankStr, Player player, String message, String sendername, GameTeam team, boolean global)
|
||||
{
|
||||
TextComponent rankComponent = new TextComponent(rankStr);
|
||||
TextComponent component = new TextComponent();
|
||||
|
||||
rankComponent.setHoverEvent(new HoverEvent(Action.SHOW_TEXT, new ComponentBuilder(rank.getColor() + rank.getTag(true, true) + ChatColor.WHITE + ":\n" + rank.getRankDescription()).create()));
|
||||
|
||||
component.setText(disguiseTag);
|
||||
if(!global)
|
||||
component.addExtra(C.cWhite + C.Bold + "Team ");
|
||||
|
||||
component.addExtra(dead);
|
||||
component.addExtra(levelStr);
|
||||
component.addExtra(rankComponent);
|
||||
if(team == null)
|
||||
component.addExtra(Manager.GetColor(player) + sendername);
|
||||
else
|
||||
component.addExtra(team.GetColor() + sendername);
|
||||
|
||||
component.addExtra(" " + ChatColor.WHITE + message);
|
||||
|
||||
return component;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user