Fix incognito.

This commit is contained in:
TadahTech 2016-05-17 17:34:49 -05:00 committed by cnr
parent 38a0b593ee
commit 3479d6e318
4 changed files with 47 additions and 78 deletions

View File

@ -1,16 +1,5 @@
package mineplex.core.incognito; package mineplex.core.incognito;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniDbClientPlugin; import mineplex.core.MiniDbClientPlugin;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
@ -26,6 +15,16 @@ import mineplex.core.packethandler.PacketHandler;
import mineplex.core.preferences.PreferencesManager; import mineplex.core.preferences.PreferencesManager;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
import java.sql.ResultSet;
import java.sql.SQLException;
public class IncognitoManager extends MiniDbClientPlugin<IncognitoClient> public class IncognitoManager extends MiniDbClientPlugin<IncognitoClient>
{ {

View File

@ -1,47 +1,34 @@
package mineplex.core.incognito.commands; package mineplex.core.incognito.commands;
import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase; import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.incognito.IncognitoManager; import mineplex.core.incognito.IncognitoManager;
import org.bukkit.entity.Player;
public class IncognitoToggleCommand extends CommandBase<IncognitoManager> public class IncognitoToggleCommand extends CommandBase<IncognitoManager>
{ {
public IncognitoToggleCommand(IncognitoManager plugin) public IncognitoToggleCommand(IncognitoManager plugin)
{ {
super(plugin, Rank.ALL, "incognito", "vanish"); super(plugin, Rank.HELPER, "incognito", "vanish");
} }
@Override @Override
public void Execute(Player caller, String[] args) public void Execute(Player caller, String[] args)
{ {
if (!Rank.HELPER.has(caller, Plugin.getClientManager().Get(caller).GetRank(), !Plugin.Get(caller).Status)) if (Plugin.getPreferences().Get(caller).Invisibility && !Plugin.Get(caller).Status)
{ {
if (Plugin.Get(caller).Status) UtilPlayer.message(caller, F.main("Incognito", "You are not allowed to toggle incognito on while Hub Invisibility is enabled."));
{ return;
UtilPlayer.message(caller, F.main("Incognito", "You are no longer incognito.")); }
Plugin.toggle(caller);
} if (Plugin.toggle(caller))
{
return; UtilPlayer.message(caller, F.main("Incognito", "You are now incognito. Your status will only change when you run " + F.elem("/" + AliasUsed) + " again."));
} } else
{
if (Plugin.getPreferences().Get(caller).Invisibility && /* Hub Invis & Incognito stuck prevention */ !Plugin.Get(caller).Status) UtilPlayer.message(caller, F.main("Incognito", "You are no longer incognito. Your status will only change when you run " + F.elem("/" + AliasUsed) + " again."));
{ }
UtilPlayer.message(caller, F.main("Incognito", "You are not allowed to toggle incognito on while Hub Invisibility is enabled.")); }
return;
}
if (Plugin.toggle(caller))
{
UtilPlayer.message(caller, F.main("Incognito", "You are now incognito. Your status will only change when you run " + F.elem("/" + AliasUsed) + " again."));
}
else
{
UtilPlayer.message(caller, F.main("Incognito", "You are no longer incognito. Your status will only change when you run " + F.elem("/" + AliasUsed) + " again."));
}
}
} }

View File

@ -1,38 +1,17 @@
package mineplex.core.message; package mineplex.core.message;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
import mineplex.core.MiniClientPlugin; import mineplex.core.MiniClientPlugin;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.chat.Chat; import mineplex.core.chat.Chat;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.*;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTime.TimeUnit; import mineplex.core.common.util.UtilTime.TimeUnit;
import mineplex.core.friend.FriendManager; import mineplex.core.friend.FriendManager;
import mineplex.core.friend.data.FriendData; import mineplex.core.friend.data.FriendData;
import mineplex.core.friend.data.FriendStatus; import mineplex.core.friend.data.FriendStatus;
import mineplex.core.ignore.IgnoreManager; import mineplex.core.ignore.IgnoreManager;
import mineplex.core.incognito.IncognitoManager; import mineplex.core.incognito.IncognitoManager;
import mineplex.core.message.commands.AdminCommand; import mineplex.core.message.commands.*;
import mineplex.core.message.commands.AnnounceCommand;
import mineplex.core.message.commands.MessageAdminCommand;
import mineplex.core.message.commands.MessageCommand;
import mineplex.core.message.commands.ResendAdminCommand;
import mineplex.core.message.commands.ResendCommand;
import mineplex.core.message.redis.AnnouncementHandler; import mineplex.core.message.redis.AnnouncementHandler;
import mineplex.core.message.redis.MessageHandler; import mineplex.core.message.redis.MessageHandler;
import mineplex.core.message.redis.RedisMessage; import mineplex.core.message.redis.RedisMessage;
@ -44,6 +23,16 @@ import mineplex.core.punish.Punishment;
import mineplex.core.punish.PunishmentSentence; import mineplex.core.punish.PunishmentSentence;
import mineplex.serverdata.commands.AnnouncementCommand; import mineplex.serverdata.commands.AnnouncementCommand;
import mineplex.serverdata.commands.ServerCommandManager; import mineplex.serverdata.commands.ServerCommandManager;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.UUID;
public class MessageManager extends MiniClientPlugin<ClientMessage> public class MessageManager extends MiniClientPlugin<ClientMessage>
{ {
@ -531,7 +520,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
// If this is a message inside the server // If this is a message inside the server
if (to != null) if (to != null)
{ {
if (_incognitoManager.Get(to).Status) if (_incognitoManager.Get(to).Status && !_clientManager.Get(sender.getName()).GetRank().has(Rank.HELPER))
{ {
UtilPlayer.message(sender, F.main("Online Player Search", F.elem("0") + " matches for [" + F.elem(target) + "].")); UtilPlayer.message(sender, F.main("Online Player Search", F.elem("0") + " matches for [" + F.elem(target) + "]."));
return; return;

View File

@ -1,17 +1,15 @@
package mineplex.core.message.commands; package mineplex.core.message.commands;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase; import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.incognito.IncognitoManager;
import mineplex.core.message.MessageManager; import mineplex.core.message.MessageManager;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
public class AdminCommand extends CommandBase<MessageManager> public class AdminCommand extends CommandBase<MessageManager>
{ {
@ -51,10 +49,6 @@ public class AdminCommand extends CommandBase<MessageManager>
{ {
if (Plugin.GetClientManager().Get(to).GetRank().has(Rank.HELPER)) if (Plugin.GetClientManager().Get(to).GetRank().has(Rank.HELPER))
{ {
if (Plugin.getIncognitoManager().Get(to).Status)
{
continue;
}
if (!to.equals(caller)) if (!to.equals(caller))
UtilPlayer.message(to, F.rank(Plugin.GetClientManager().Get(caller).GetRank()) + " " + caller.getName() + " " + C.cPurple + message); UtilPlayer.message(to, F.rank(Plugin.GetClientManager().Get(caller).GetRank()) + " " + caller.getName() + " " + C.cPurple + message);