Waiting for a testing session.
This commit is contained in:
parent
eed55b48ac
commit
63cea58f05
@ -4,37 +4,38 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
|
||||
public enum Rank
|
||||
{
|
||||
//Staff
|
||||
LT("Leader", ChatColor.GOLD, "Leaders manage the operation of their respective team or projects. They usually operate on affairs within the staff, development, or management team."),
|
||||
OWNER("Owner", ChatColor.GOLD, "Owners are the founders of Mineplex. Each owner manages a different aspect of the server and ensures its efficient operation."),
|
||||
DEVELOPER("Dev", ChatColor.GOLD, "Developers work behind the scenes to create new games and features, and fix bugs to give the best experience."),
|
||||
ADMIN("Admin", ChatColor.GOLD, "An Administrator’s role is to manage their respective Senior Moderator team and all moderators within it."),
|
||||
JNR_DEV("Jr.Dev", ChatColor.GOLD, "Junior Developers work behind the scenes to create new games and features, and fix bugs to give the best experience."),
|
||||
SUPPORT("Support", ChatColor.BLUE, "Support agents handle tickets and provide customer service."),
|
||||
CMOD("C.Mod", ChatColor.GOLD, "Clans Moderators are members of the Clans Management Senior Mod team. Their duties include moderation and support within the Clans servers. For assistance, contact them using /a <message>."),
|
||||
SNR_MODERATOR("Sr.Mod", ChatColor.GOLD, "Senior Moderators are members of a special Senior Moderator team where they have to fulfill specific tasks. Just like Moderators, you can always ask them for help. For assistance, contact them using /a <message>."),
|
||||
MODERATOR("Mod", ChatColor.GOLD, "Moderators enforce rules and provide help to anyone with questions or concerns. For assistance, contact them using /a <message>."),
|
||||
HELPER("Trainee", ChatColor.DARK_AQUA, "Trainees are moderators-in-training. Their duties include enforcing the rules and providing help to anyone with questions or concerns. For assistance, contact them using /a <message>."),
|
||||
MAPLEAD("MapLead", ChatColor.BLUE, "Map Leaders are leaders of the Mineplex Build Team. They oversee the creation of new maps and manage Builders."),
|
||||
MAPDEV("Builder", ChatColor.BLUE, "Builders are members of the Mineplex Build Team. They create many of the maps used across Mineplex."),
|
||||
MEDIA("Media", ChatColor.BLUE, "The Media rank is given to talented artists who are endorsed to create content for Mineplex."),
|
||||
LT("Leader", ChatColor.GOLD, "Leaders manage the operation of their respective team \nor projects. They usually operate on affairs within \nthe staff, development, or management team."),
|
||||
OWNER("Owner", ChatColor.GOLD, "Owners are the founders of Mineplex. \nEach owner manages a different aspect of the \nserver and ensures its efficient operation."),
|
||||
DEVELOPER("Dev", ChatColor.GOLD, "Developers work behind the scenes to \ncreate new games and features, and fix bugs to \ngive the best experience."),
|
||||
ADMIN("Admin", ChatColor.GOLD, "An Administrator’s role is to manage \ntheir respective Senior Moderator team \nand all moderators within it."),
|
||||
JNR_DEV("Jr.Dev", ChatColor.GOLD, "Junior Developers work behind the scenes to \ncreate new games and features, and fix bugs to \ngive the best experience."),
|
||||
SUPPORT("Support", ChatColor.BLUE, "Support agents handle tickets and \nprovide customer service."),
|
||||
CMOD("C.Mod", ChatColor.GOLD, "Clans Moderators are members of the Clans Management Senior Mod team. \nTheir duties include moderation and support within the Clans servers. \n\nFor assistance, contact them using " + F.elem("/a <message>") + "."),
|
||||
SNR_MODERATOR("Sr.Mod", ChatColor.GOLD, "Senior Moderators are members of a special \nSenior Moderator team where they have to fulfill specific tasks. \nJust like Moderators, you can always ask them for help. \n\nFor assistance, contact them using " + F.elem("/a <message>") + "."),
|
||||
MODERATOR("Mod", ChatColor.GOLD, "Moderators enforce rules and provide help to \nanyone with questions or concerns. \n\nFor assistance, contact them using " + F.elem("/a <message>") + "."),
|
||||
HELPER("Trainee", ChatColor.DARK_AQUA, "Trainees are moderators-in-training. \nTheir duties include enforcing the rules and \nproviding help to anyone with questions or concerns. \n\nFor assistance, contact them using " + F.elem("/a <message>") + "."),
|
||||
MAPLEAD("MapLead", ChatColor.BLUE, "Map Leaders are leaders of the Mineplex Build Team. \nThey oversee the creation of new maps and manage Builders."),
|
||||
MAPDEV("Builder", ChatColor.BLUE, "Builders are members of the Mineplex Build Team. \nThey create many of the maps used across Mineplex."),
|
||||
MEDIA("Media", ChatColor.BLUE, "The Media rank is given to talented artists who are\n endorsed to create content for Mineplex."),
|
||||
|
||||
EVENT("Event", ChatColor.WHITE, "A member of the official Mineplex Events team!"),
|
||||
|
||||
//Media
|
||||
YOUTUBE("YouTube", ChatColor.RED, "A YouTuber who creates content for or related to Mineplex."),
|
||||
YOUTUBE_SMALL("YT", ChatColor.DARK_PURPLE, "A YouTuber who creates content for or related to Mineplex. They have fewer subscribers than full YouTubers."),
|
||||
TWITCH("Twitch", ChatColor.DARK_PURPLE, "A Twitch streamer who often features Mineplex in their streams."),
|
||||
YOUTUBE("YouTube", ChatColor.RED, "A YouTuber who creates content for \nor related to Mineplex."),
|
||||
YOUTUBE_SMALL("YT", ChatColor.DARK_PURPLE, "A YouTuber who creates content for \nor related to Mineplex. \n\nThey have fewer subscribers than full YouTubers."),
|
||||
TWITCH("Twitch", ChatColor.DARK_PURPLE, "A Twitch streamer who often features \nMineplex in their streams."),
|
||||
|
||||
//Player
|
||||
TITAN("Titan", ChatColor.RED, true, "Ancient myths spoke of a gigantic being with immense power... Purchase Titan at www.mineplex.com/shop"),
|
||||
LEGEND("Legend", ChatColor.GREEN, true, "Mineplex's third premium rank. Purchase Legend at www.mineplex.com/shop"),
|
||||
HERO("Hero", ChatColor.LIGHT_PURPLE, true, "There are many stories of a valiant Hero who was brave enough to tame the most fearsome dragon in the land."),
|
||||
ULTRA("Ultra", ChatColor.AQUA, true, "Mineplex's first premium rank. Purchase Ultra at www.mineplex.com/shop"),
|
||||
TITAN("Titan", ChatColor.RED, true, "Ancient myths spoke of a gigantic being \nwith immense power... \n\nPurchase Titan at www.mineplex.com/shop"),
|
||||
LEGEND("Legend", ChatColor.GREEN, true, "Mineplex's third premium rank. \n\nPurchase Legend at www.mineplex.com/shop"),
|
||||
HERO("Hero", ChatColor.LIGHT_PURPLE, true, "There are many stories of a \nvaliant Hero who was brave enough to \ntame the most fearsome dragon in the land. \n\nPurchase Hero at www.mineplex.com/shop"),
|
||||
ULTRA("Ultra", ChatColor.AQUA, true, "Mineplex's first premium rank. \n\nPurchase Ultra at www.mineplex.com/shop"),
|
||||
ALL("", ChatColor.WHITE, null);
|
||||
|
||||
private ChatColor _color;
|
||||
|
@ -18,6 +18,7 @@ import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.bonuses.BonusManager;
|
||||
import mineplex.core.botspam.BotSpamManager;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.jsonchat.JsonMessage;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
@ -94,6 +95,8 @@ 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 org.jooq.tools.json.JSONObject;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.ChatMessage;
|
||||
import net.minecraft.server.v1_8_R3.EntityInsentient;
|
||||
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||
@ -633,18 +636,21 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
}
|
||||
else
|
||||
{
|
||||
TextComponent rankComponent = new TextComponent(rankStr);
|
||||
TextComponent playerNameText = new TextComponent(ChatColor.YELLOW + playerName);
|
||||
TextComponent component = new TextComponent();
|
||||
// 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.getDescription()).create()));
|
||||
//
|
||||
// component.setText(levelStr);
|
||||
// component.addExtra(rankComponent);
|
||||
// component.addExtra(playerNameText);
|
||||
// component.addExtra(" " + ChatColor.WHITE + event.getMessage());
|
||||
|
||||
JsonMessage jsonMessage = new JsonMessage(levelStr)
|
||||
.extra(JSONObject.escape(rankStr)).hover("show_text", rank.getColor() + rank.getTag(true, true) + ChatColor.WHITE + "\n" + rank.getDescription())
|
||||
.add(JSONObject.escape(C.cYellow + playerName + " " + ChatColor.WHITE + event.getMessage()));
|
||||
|
||||
rankComponent.setHoverEvent(new HoverEvent(Action.SHOW_TEXT, new ComponentBuilder(rank.getColor() + rank.getTag(true, true) + ChatColor.WHITE + ":\n" + rank.getDescription()).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))
|
||||
@ -656,7 +662,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
// event.setMessage(event.getMessage());
|
||||
// event.setFormat(levelStr + rankStr + C.cYellow + playerName + " " + C.cWhite + "%2$s");
|
||||
if(!event.isCancelled())
|
||||
other.spigot().sendMessage(component);
|
||||
jsonMessage.sendToPlayer(other);
|
||||
|
||||
}
|
||||
event.setCancelled(true);
|
||||
|
@ -61,6 +61,7 @@ import nautilus.game.arcade.game.games.turfforts.kits.KitShredder;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.managers.chat.ChatStatData;
|
||||
import nautilus.game.arcade.stats.BehindEnemyLinesStatTracker;
|
||||
import nautilus.game.arcade.stats.BlockBreakStatTracker;
|
||||
import nautilus.game.arcade.stats.BlockPlaceStatTracker;
|
||||
import nautilus.game.arcade.stats.BlockShreadStatTracker;
|
||||
import nautilus.game.arcade.stats.TheComebackStatTracker;
|
||||
@ -114,6 +115,8 @@ public class TurfForts extends TeamGame
|
||||
private long _fightTime = 90000;
|
||||
private boolean _fight = false;
|
||||
private int _lines = 0;
|
||||
|
||||
private BlockBreakStatTracker _breakStatTracker;
|
||||
|
||||
private HashMap<Player, Long> _enemyTurf = new HashMap<Player, Long>();
|
||||
|
||||
@ -148,11 +151,14 @@ public class TurfForts extends TeamGame
|
||||
this.DamageSelf = false;
|
||||
this.DeathSpectateSecs = 4;
|
||||
|
||||
_breakStatTracker = new BlockBreakStatTracker(this, false);
|
||||
|
||||
registerStatTrackers(
|
||||
new BlockShreadStatTracker(this),
|
||||
new BehindEnemyLinesStatTracker(this),
|
||||
new TheComebackStatTracker(this),
|
||||
new BlockPlaceStatTracker(this, new Material[]{})
|
||||
new BlockPlaceStatTracker(this, new Material[]{}),
|
||||
_breakStatTracker
|
||||
);
|
||||
|
||||
registerChatStats(
|
||||
@ -160,7 +166,8 @@ public class TurfForts extends TeamGame
|
||||
Deaths,
|
||||
KDRatio,
|
||||
BlankLine,
|
||||
new ChatStatData("BlocksPlaced", "Blocks Placed", true)
|
||||
new ChatStatData("BlocksPlaced", "Blocks Placed", true),
|
||||
new ChatStatData("BlocksBroken", "Blocks Broken", true)
|
||||
);
|
||||
}
|
||||
|
||||
@ -437,10 +444,12 @@ public class TurfForts extends TeamGame
|
||||
if (block.getData() == 14 /* && team.GetColor() != ChatColor.RED */)
|
||||
{
|
||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, Material.REDSTONE_BLOCK.getId());
|
||||
_breakStatTracker.addStat(shooter);
|
||||
}
|
||||
else if (block.getData() == 3 /* && team.GetColor() != ChatColor.AQUA */)
|
||||
{
|
||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, Material.LAPIS_BLOCK.getId());
|
||||
_breakStatTracker.addStat(shooter);
|
||||
}
|
||||
|
||||
Bukkit.getPluginManager().callEvent(new ShredBlockEvent(block, arrow));
|
||||
|
@ -1,234 +0,0 @@
|
||||
package nautilus.game.arcade.managers;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
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;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
|
||||
public class GameChatManager implements Listener
|
||||
{
|
||||
ArcadeManager Manager;
|
||||
|
||||
public GameChatManager(ArcadeManager manager)
|
||||
{
|
||||
Manager = manager;
|
||||
|
||||
Manager.getPluginManager().registerEvents(this, Manager.getPlugin());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void MeCancel(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (event.getMessage().startsWith("/me "))
|
||||
{
|
||||
event.getPlayer().sendMessage(F.main("Mirror", "You can't see /me messages, are you a vampire?"));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void HandleChat(AsyncPlayerChatEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
Player sender = event.getPlayer();
|
||||
String senderName = sender.getName();
|
||||
|
||||
//Dead Prefix
|
||||
String dead = "";
|
||||
if (Manager.GetGame() != null)
|
||||
if (Manager.GetGame().GetTeam(sender) != null)
|
||||
if (!Manager.GetGame().IsAlive(sender))
|
||||
dead = C.cGray + "Dead ";
|
||||
|
||||
Rank rank = Manager.GetClients().Get(sender).GetRank();
|
||||
String disguiseTag = "";
|
||||
if(Manager.GetClients().Get(sender).isDisguised())
|
||||
{
|
||||
CoreClient cc = Manager.GetClients().Get(sender);
|
||||
rank = cc.getDisguisedRank();
|
||||
|
||||
if(!cc.GetRank().has(Rank.JNR_DEV))
|
||||
{
|
||||
disguiseTag = ChatColor.BLACK + " ";
|
||||
}
|
||||
}
|
||||
|
||||
boolean ownsUltra = false;
|
||||
|
||||
if (Manager.GetGame() != null)
|
||||
ownsUltra= Manager.GetDonation().Get(sender.getName()).OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA");
|
||||
|
||||
//Level
|
||||
String levelStr = "";
|
||||
if (!Manager.GetGameHostManager().isPrivateServer())
|
||||
levelStr = Manager.GetAchievement().getMineplexLevel(sender, rank);
|
||||
|
||||
String rankStr = "";
|
||||
//Rank Prefix & MPS Host Prefix
|
||||
if (Manager.GetGameHostManager().isHost(event.getPlayer()))
|
||||
{
|
||||
if (Manager.GetGameHostManager().isEventServer())
|
||||
rankStr = C.cDGreen + C.Bold + "Event Host ";
|
||||
else
|
||||
rankStr = C.cDGreen + C.Bold + "MPS Host ";
|
||||
}
|
||||
else if (Manager.GetGameHostManager().isAdmin(event.getPlayer(), false))
|
||||
{
|
||||
if (Manager.GetGameHostManager().isEventServer())
|
||||
rankStr = C.cDGreen + C.Bold + "Event Co-Host ";
|
||||
else
|
||||
rankStr = C.cDGreen + C.Bold + "MPS Co-Host ";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rank != Rank.ALL)
|
||||
rankStr = rank.getTag(true, true) + " ";
|
||||
|
||||
if (ownsUltra && !rank.has(Rank.ULTRA))
|
||||
rankStr = Rank.ULTRA.getTag(true, true) + " ";
|
||||
}
|
||||
|
||||
if (event.getMessage().charAt(0) == '@')
|
||||
{
|
||||
//Party Chat
|
||||
Party party = Manager.getPartyManager().GetParty(sender);
|
||||
|
||||
if (party != null)
|
||||
{
|
||||
event.getRecipients().clear();
|
||||
|
||||
event.setMessage(event.getMessage().substring(1, event.getMessage().length()));
|
||||
event.setFormat(levelStr + C.cDPurple + C.Bold + "Party " + C.cWhite + C.Bold + senderName + " " + C.cPurple + "%2$s");
|
||||
|
||||
event.getRecipients().addAll(party.GetPlayersOnline());
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//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)
|
||||
{
|
||||
boolean globalMessage = false;
|
||||
|
||||
//Team
|
||||
GameTeam team = Manager.GetGame().GetTeam(sender);
|
||||
|
||||
if (team != null)
|
||||
{
|
||||
//Team Chat
|
||||
if (event.getMessage().charAt(0) == '@')
|
||||
{
|
||||
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();
|
||||
|
||||
while (recipientIterator.hasNext())
|
||||
{
|
||||
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.getDescription()).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;
|
||||
}
|
||||
}
|
@ -10,6 +10,7 @@ import java.util.Map;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
@ -63,7 +64,6 @@ public class GameChatManager implements Listener
|
||||
Player sender = event.getPlayer();
|
||||
String senderName = sender.getName();
|
||||
|
||||
PacketPlayOutChat packet = null;
|
||||
String format = "";
|
||||
String name = "";
|
||||
String message = "";
|
||||
@ -133,23 +133,18 @@ public class GameChatManager implements Listener
|
||||
{
|
||||
event.getRecipients().clear();
|
||||
|
||||
event.setMessage(event.getMessage().substring(1, event.getMessage().length()));
|
||||
event.setFormat(levelStr + C.cDPurple + C.Bold + "Party " + C.cWhite + C.Bold + senderName + " " + C.cPurple + "%2$s");
|
||||
rankStr = C.cDPurpleB + "Party " + C.Reset;
|
||||
|
||||
format = event.getFormat().split(sender.getName())[0];
|
||||
name = C.cWhite + C.Bold + sender.getName() + C.Reset;
|
||||
event.setMessage(event.getMessage().substring(1, event.getMessage().length()));
|
||||
event.setFormat(levelStr + rankStr + C.cWhiteB + senderName + " " + C.cPurple + "%2$s");
|
||||
|
||||
format = event.getFormat().split(rankStr)[0];
|
||||
name = C.cWhiteB + sender.getName() + C.Reset;
|
||||
message = event.getFormat().split(sender.getName())[1].replace("%2$s", "") + _manager.GetChat().getFilteredMessage(sender, event.getMessage());
|
||||
|
||||
if(!_manager.GetGame().IsLive())
|
||||
if(safeSend(sender, format, rankStr, rank, name, message, party.GetPlayersOnline()))
|
||||
{
|
||||
event.getRecipients().addAll(party.GetPlayersOnline());
|
||||
}
|
||||
else
|
||||
{
|
||||
if(safeSend(sender, format, name, message, party.GetPlayersOnline()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
return;
|
||||
@ -159,6 +154,26 @@ public class GameChatManager implements Listener
|
||||
//Base Format
|
||||
event.setFormat(disguiseTag + dead + levelStr + rankStr + _manager.GetColor(sender) + senderName + " " + ChatColor.WHITE + "%2$s");
|
||||
|
||||
if (_manager.GetGame().GetState() != GameState.Live)
|
||||
{
|
||||
event.setFormat(levelStr + rankStr + C.cGray + senderName + " " + C.cWhite + "%2$s");
|
||||
|
||||
if(rankStr.equals(""))
|
||||
format = levelStr;
|
||||
else
|
||||
format = event.getFormat().split(rankStr)[0];
|
||||
|
||||
name = C.cGray + sender.getName() + C.Reset;
|
||||
message = event.getFormat().split(sender.getName())[1].replace("%2$s", "") + _manager.GetChat().getFilteredMessage(sender, event.getMessage());
|
||||
|
||||
if(safeSend(sender, format, rankStr, rank, name, message, event.getRecipients()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//Public/Private (Not If Player Dead)
|
||||
if (_manager.GetGame() != null && _manager.GetGame().GetState() == GameState.Live)
|
||||
{
|
||||
@ -173,9 +188,13 @@ public class GameChatManager implements Listener
|
||||
if (event.getMessage().charAt(0) == '@')
|
||||
{
|
||||
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");
|
||||
event.setFormat(disguiseTag + C.cWhiteB + "Team " + dead + levelStr + rankStr + team.GetColor() + senderName + " " + C.cWhite + "%2$s");
|
||||
|
||||
if(rankStr.equals(""))
|
||||
format = disguiseTag + C.cWhiteB + "Team " + dead + levelStr;
|
||||
else
|
||||
format = event.getFormat().split(rankStr)[0];
|
||||
|
||||
format = event.getFormat().split(sender.getName())[0];
|
||||
name = _manager.GetColor(sender) + sender.getName();
|
||||
}
|
||||
//All Chat
|
||||
@ -184,7 +203,11 @@ public class GameChatManager implements Listener
|
||||
globalMessage = true;
|
||||
event.setFormat(disguiseTag + dead + levelStr + rankStr + team.GetColor() + senderName + " " + C.cWhite + "%2$s");
|
||||
|
||||
format = event.getFormat().split(sender.getName())[0];
|
||||
if(rankStr.equals(""))
|
||||
format = disguiseTag + dead + levelStr;
|
||||
else
|
||||
format = event.getFormat().split(rankStr)[0];
|
||||
|
||||
name = _manager.GetColor(sender) + sender.getName();
|
||||
}
|
||||
|
||||
@ -195,7 +218,7 @@ public class GameChatManager implements Listener
|
||||
{
|
||||
if(_manager.GetGame().IsLive())
|
||||
{
|
||||
if(safeSend(sender, format, name, message, _manager.GetGame().GetPlayers(false)))
|
||||
if(safeSend(sender, format, rankStr, rank, name, message, _manager.GetGame().GetPlayers(false)))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
@ -225,16 +248,16 @@ public class GameChatManager implements Listener
|
||||
recipientIterator.remove();
|
||||
}
|
||||
|
||||
if(safeSend(sender, format, name, message, event.getRecipients()))
|
||||
if(safeSend(sender, format, rankStr, rank, name, message, event.getRecipients()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean safeSend(Player sender, String format, String name, String message, Collection<Player> sendto)
|
||||
public boolean safeSend(Player sender, String prefix, String rankStr, Rank rank, String name, String message, Collection<Player> sendto)
|
||||
{
|
||||
final JsonMessage json = buildJSON(sender, format, name, _chatStats, message);
|
||||
final JsonMessage json = buildJSON(sender, prefix, rankStr, rank, name, _chatStats, message);
|
||||
try
|
||||
{
|
||||
json.send(JsonMessage.MessageType.CHAT_BOX, sendto.toArray(new Player[sendto.size()]));
|
||||
@ -258,8 +281,17 @@ public class GameChatManager implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
private JsonMessage buildJSON(Player player, String format, String name, LinkedList<ChatStatData> hoverText, String message)
|
||||
private JsonMessage buildJSON(Player player, String prefix, String rankStr, Rank rank, String name, LinkedList<ChatStatData> hoverText, String message)
|
||||
{
|
||||
if(_manager.GetGame().GetState() != GameState.Live && _manager.GetGame().GetState() != GameState.End)
|
||||
{
|
||||
return new JsonMessage("")
|
||||
.extra(JSONObject.escape(prefix))
|
||||
.add(JSONObject.escape(rankStr)).hover("show_text", rank.getColor() + rank.getTag(true, true) + ChatColor.WHITE + "\n" + rank.getDescription())
|
||||
.add(JSONObject.escape(name))
|
||||
.add(JSONObject.escape(message));
|
||||
}
|
||||
|
||||
LinkedList<Map.Entry<String, String>> temp = new LinkedList<Map.Entry<String, String>>();
|
||||
|
||||
ChatColor teamColor = _manager.GetGame().GetTeam(player).GetColor();
|
||||
@ -307,7 +339,7 @@ public class GameChatManager implements Listener
|
||||
else
|
||||
deaths = 0;
|
||||
|
||||
temp.add(new AbstractMap.SimpleEntry<String, String>(display + ": ", getRatio(kills, deaths, "##.##")));
|
||||
temp.add(new AbstractMap.SimpleEntry<String, String>(display + ": ", "" + getRatio(kills, deaths, "##.##")));
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -327,14 +359,14 @@ public class GameChatManager implements Listener
|
||||
stats += C.cWhite + JSONObject.escape(temp.get(i).getKey()) + C.cGray + JSONObject.escape(temp.get(i).getValue()) + (i >= temp.size()-1 ? "" : "\\n");
|
||||
}
|
||||
|
||||
JsonMessage jsonMessage = new JsonMessage("")
|
||||
.extra(JSONObject.escape(format))
|
||||
return new JsonMessage("")
|
||||
.extra(JSONObject.escape(prefix))
|
||||
.add(JSONObject.escape(rankStr)).hover("show_text", rank.getColor() + rank.getTag(true, true) + ChatColor.WHITE + "\n" + rank.getDescription())
|
||||
.add(JSONObject.escape(name)).hover("show_text", stats)
|
||||
.add(JSONObject.escape(message));
|
||||
return jsonMessage;
|
||||
}
|
||||
|
||||
public String getRatio(int var1, int var2, String format)
|
||||
public double getRatio(int var1, int var2, String format)
|
||||
{
|
||||
double ratio = 0.0;
|
||||
|
||||
@ -343,7 +375,7 @@ public class GameChatManager implements Listener
|
||||
else if(var1 <= 0 && var2 <= 0) ratio = 0d;
|
||||
else ratio = ((double) var1 / var2);
|
||||
|
||||
return new DecimalFormat(format).format(ratio);
|
||||
return Double.parseDouble(new DecimalFormat(format).format(ratio));
|
||||
}
|
||||
}
|
||||
/** DONE */
|
||||
|
@ -63,4 +63,9 @@ public class BlockBreakStatTracker extends StatTracker<Game>
|
||||
|
||||
addStat(player, "BlocksBroken", 1, false, false);
|
||||
}
|
||||
|
||||
public void addStat(Player player)
|
||||
{
|
||||
addStat(player, "BlocksBroken", 1, false, false);
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,9 @@ public class BlockPlaceStatTracker extends StatTracker<Game>
|
||||
if(player == null)
|
||||
return;
|
||||
|
||||
if(_ignore.length == 0)
|
||||
addStat(event.getPlayer(), "BlocksPlaced", 1, false, false);
|
||||
|
||||
for(Material material : _ignore)
|
||||
{
|
||||
if(event.getBlock().getType() == material)
|
||||
|
Loading…
Reference in New Issue
Block a user