This commit is contained in:
AlexTheCoder 2016-02-16 21:27:50 -05:00
parent 16c03ebb48
commit efb63ee824
5 changed files with 21 additions and 198 deletions

View File

@ -86,7 +86,6 @@ import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.event.EventModule;
import nautilus.game.arcade.game.games.uhc.UHC;
import nautilus.game.arcade.managers.GameAchievementManager;
import nautilus.game.arcade.managers.GameChatSettingsManager;
import nautilus.game.arcade.managers.GameCreationManager;
import nautilus.game.arcade.managers.GameFlagManager;
import nautilus.game.arcade.managers.GameGemManager;
@ -140,7 +139,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
private BlockRestore _blockRestore;
private Blood _blood;
private Chat _chat;
private GameChatSettingsManager _gamechat;
private CoreClientManager _clientManager;
private DisguiseManager _disguiseManager;
private DonationManager _donationManager;
@ -280,7 +278,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
_arcadeShop = new ArcadeShop(this, clientManager, donationManager);
// Managers
_gamechat = new GameChatSettingsManager(this);
_gameChatManager = new GameChatManager(this);
_gameCreationManager = new GameCreationManager(this);
_gameGemManager = new GameGemManager(this);
@ -397,11 +394,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
return _chat;
}
public GameChatSettingsManager GetGameChatSettings()
{
return _gamechat;
}
public BlockRestore GetBlockRestore()
{
return _blockRestore;

View File

@ -561,7 +561,7 @@ public class MinecraftLeague extends TeamGame
Manager.GetCreature().SetDisableCustomDrops(true);
_cmd = new MinecraftLeagueCommand(Manager, this);
Manager.addCommand(_cmd);
Manager.GetGameChatSettings().TeamSpy = false;
Manager.getGameChatManager().TeamSpy = false;
}
if (event.GetState() == GameState.End)
@ -571,7 +571,7 @@ public class MinecraftLeague extends TeamGame
Manager.GetCreature().SetForce(false);
Manager.GetCreature().SetDisableCustomDrops(false);
Manager.removeCommand(_cmd);
Manager.GetGameChatSettings().TeamSpy = true;
Manager.getGameChatManager().TeamSpy = true;
HandlerList.unregisterAll(MapManager);
HandlerList.unregisterAll(_freeze);
}

View File

@ -121,6 +121,7 @@ public class WitherMinionManager implements Listener
((CraftSkeleton)e).getEquipment().setLeggings(new ItemStack(Material.IRON_LEGGINGS));
((Skeleton)e).addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 9999999, 3));
if (!respawn)
UtilTextMiddle.display("", C.cGray + "A Wither Skeleton has spawned!");
_selected = -1;
_spawned = true;
@ -140,11 +141,14 @@ public class WitherMinionManager implements Listener
{
_spawned = false;
_entity.remove();
_lastDied = System.currentTimeMillis();
_entity = null;
}
if (_cb != null)
{
_cb.setType(_changed);
_cb = null;
_changed = Material.AIR;
_lastDied = System.currentTimeMillis();
_entity = null;
}
}

View File

@ -1,183 +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.party.Party;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameTeam;
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 GameChatSettingsManager implements Listener
{
ArcadeManager Manager;
public boolean TeamSpy;
public GameChatSettingsManager(ArcadeManager manager)
{
Manager = manager;
Manager.getPluginManager().registerEvents(this, Manager.getPlugin());
TeamSpy = true;
}
@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");
//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");
}
//All Chat
else
{
globalMessage = true;
event.setFormat(disguiseTag + dead + levelStr + rankStr + team.GetColor() + senderName + " " + C.cWhite + "%2$s");
}
}
if (globalMessage)
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 (TeamSpy)
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();
}
}
}
}

View File

@ -34,6 +34,8 @@ public class GameChatManager implements Listener
private LinkedList<ChatStatData> _chatStats;
public boolean TeamSpy;
public GameChatManager(ArcadeManager manager)
{
_manager = manager;
@ -41,6 +43,8 @@ public class GameChatManager implements Listener
_manager.getPluginManager().registerEvents(this, _manager.getPlugin());
_chatStats = new LinkedList<ChatStatData>();
TeamSpy = true;
}
@EventHandler
@ -157,6 +161,9 @@ public class GameChatManager implements Listener
format = event.getFormat().split(rankStr)[0];
name = _manager.GetColor(sender) + sender.getName() + C.Reset;
if (event.getMessage().charAt(0) == '@')
message = event.getFormat().split(sender.getName())[1].replace("%2$s", "") + _manager.GetChat().getFilteredMessage(sender, event.getMessage().substring(1, event.getMessage().length()));
else
message = event.getFormat().split(sender.getName())[1].replace("%2$s", "") + _manager.GetChat().getFilteredMessage(sender, event.getMessage());
if (_manager.GetGame().GetState() != GameState.Live)
@ -230,7 +237,10 @@ public class GameChatManager implements Listener
Player receiver = recipientIterator.next();
if (!_manager.GetServerConfig().Tournament && _manager.GetClients().Get(receiver).GetRank().has(Rank.MODERATOR))
{
if (TeamSpy)
continue;
}
GameTeam recTeam = _manager.GetGame().GetTeam(receiver);
GameTeam sendTeam = _manager.GetGame().GetTeam(sender);