Fixing some bugs and disallow MPS while disguised.

This commit is contained in:
Sarah 2015-08-07 07:39:40 +02:00
parent f37e25e9d7
commit 181b778a9c
6 changed files with 30 additions and 12 deletions

View File

@ -1143,22 +1143,20 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
EntityPlayer disguisedPlayer = (EntityPlayer) disguise.GetEntity();
try
{
if (Bukkit.getPlayerExact(disguisedPlayer.getName()) == null || !disguisedPlayer.isAlive() || !disguisedPlayer.valid)
if (Bukkit.getPlayerExact(disguisedPlayer.getName()) == null || !disguisedPlayer.isAlive() || !disguisedPlayer.valid)
disguiseIterator.remove();
}
catch(NullPointerException e)
{
try{
for (Iterator<Player> playerIterator = _disguisePlayerMap.get(disguise).iterator(); playerIterator.hasNext();)
{
Player player = playerIterator.next();
if (!player.isOnline() || !player.isValid())
playerIterator.remove();
}
}
catch (Exception exception) {}
}
}
}

View File

@ -4,6 +4,8 @@ import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
public class HostEventServerCommand extends CommandBase<PersonalServerManager>
@ -19,6 +21,11 @@ public class HostEventServerCommand extends CommandBase<PersonalServerManager>
if (!Recharge.Instance.use(caller, "Host Event", 30000, false, false))
return;
if(Plugin.getClients().Get(caller).isDisguised())
{
UtilPlayer.message(caller, F.main("Disguise", "You cant host Servers while you are disguised!"));
return;
}
Plugin.hostServer(caller, caller.getName(), true);
}
}

View File

@ -4,6 +4,8 @@ import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
public class HostServerCommand extends CommandBase<PersonalServerManager>
@ -19,6 +21,11 @@ public class HostServerCommand extends CommandBase<PersonalServerManager>
if (!Recharge.Instance.use(caller, "Host Server", 30000, false, false))
return;
if(Plugin.getClients().Get(caller).isDisguised())
{
UtilPlayer.message(caller, F.main("Disguise", "You cant host Servers while you are disguised!"));
return;
}
Plugin.hostServer(caller, caller.getName(), false);
}
}

View File

@ -177,4 +177,9 @@ public class PersonalServerManager extends MiniPlugin
}
});
}
public CoreClientManager getClients()
{
return _clientManager;
}
}

View File

@ -56,9 +56,10 @@ public class DisguiseCommand extends CommandBase<HubManager> implements Listener
public DisguiseCommand(HubManager plugin)
{
super(plugin, Rank.JNR_DEV, new Rank[]
{ Rank.YOUTUBE, Rank.TWITCH }, "disguise");
plugin.getPluginManager().registerEvents(this, Plugin.getPlugin());
new NCPDataManFix();
{
Rank.YOUTUBE, Rank.TWITCH }, "disguise");
plugin.getPluginManager().registerEvents(this, Plugin.getPlugin());
new NCPDataManFix();
}
@Override
@ -254,9 +255,9 @@ public class DisguiseCommand extends CommandBase<HubManager> implements Listener
{
_disguisedPlayers.remove(player);
_disguisedPlayerDisguises.remove(player);
_disguisedPlayersNames.remove(player);
Plugin.GetDisguise().undisguise(player);
String playerName = _disguisedPlayersNames.get(player);
_disguisedPlayersNames.remove(player);
CoreClient client = Plugin.GetClients().Get(player);
client.setDisguisedRank(null);

View File

@ -260,9 +260,9 @@ public class DisguiseCommand extends CommandBase<ArcadeManager> implements Liste
{
_disguisedPlayers.remove(player);
_disguisedPlayerDisguises.remove(player);
_disguisedPlayersNames.remove(player);
Plugin.GetDisguise().undisguise(player);
String playerName = _disguisedPlayersNames.get(player);
_disguisedPlayersNames.remove(player);
CoreClient client = Plugin.GetClients().Get(player);
client.setDisguisedRank(null);