Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
8ab8388344
@ -17,7 +17,7 @@ public class StatsCommand extends CommandBase<AchievementManager>
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args == null || args.length == 0)
|
||||
if (args.length == 0)
|
||||
{
|
||||
Plugin.openShop(caller);
|
||||
}
|
||||
|
@ -9,9 +9,9 @@ import mineplex.core.reward.RewardType;
|
||||
import mineplex.core.bonuses.BonusManager;
|
||||
|
||||
public class AnimationCommand extends CommandBase<BonusManager>{
|
||||
|
||||
|
||||
private BonusManager _plugin;
|
||||
|
||||
|
||||
public AnimationCommand(BonusManager plugin)
|
||||
{
|
||||
super(plugin, Rank.DEVELOPER, "animation");
|
||||
@ -21,17 +21,14 @@ public class AnimationCommand extends CommandBase<BonusManager>{
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
|
||||
if(args != null)
|
||||
{
|
||||
caller = Bukkit.getPlayer(args[0]);
|
||||
_plugin.addPendingExplosion(caller, _plugin.getRewardManager().nextReward(caller, null, false, RewardType.SpinnerFiller, true));
|
||||
}
|
||||
if(args.length >= 2)
|
||||
caller = Bukkit.getPlayer(args[0]);
|
||||
_plugin.addPendingExplosion(caller, _plugin.getRewardManager().nextReward(caller, null, false, RewardType.SpinnerFiller, true));
|
||||
|
||||
if (args.length >= 2)
|
||||
{
|
||||
_plugin.addPendingExplosion(caller, args[1]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -18,7 +18,7 @@ public class ChatSlowCommand extends CommandBase<Chat>
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args != null && args.length == 1)
|
||||
if (args.length == 1)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -48,7 +48,7 @@ public class CommandCenter implements Listener
|
||||
public void OnPlayerCommandPreprocess(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
String commandName = event.getMessage().substring(1);
|
||||
String[] args = null;
|
||||
String[] args = new String[] {};
|
||||
|
||||
if (commandName.contains(" "))
|
||||
{
|
||||
|
@ -37,7 +37,7 @@ public class MobCommand extends MultiCommandBase<Creature>
|
||||
@Override
|
||||
protected void Help(Player caller, String[] args)
|
||||
{
|
||||
if (args == null)
|
||||
if (args == null || args.length == 0)
|
||||
{
|
||||
HashMap<EntityType, Integer> entMap = new HashMap<EntityType, Integer>();
|
||||
|
||||
|
@ -24,7 +24,7 @@ public class GemCommand extends CommandBase<DonationManager>
|
||||
{
|
||||
if (args.length < 2)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("gem", "Missing Args: " + F.elem("/gem <player> <amount>")));
|
||||
UtilPlayer.message(caller, F.main("Gem", "Missing Args: " + F.elem("/gem <player> <amount>")));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ public class GemCommand extends CommandBase<DonationManager>
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("gem", "Invalid gems Amount"));
|
||||
UtilPlayer.message(caller, F.main("Gem", "Invalid gems Amount"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,16 +71,16 @@ public class GemCommand extends CommandBase<DonationManager>
|
||||
{
|
||||
if (completed)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("gem", "You gave " + F.elem(gems + " gems") + " to " + F.name(targetName) + "."));
|
||||
UtilPlayer.message(caller, F.main("Gem", "You gave " + F.elem(gems + " gems") + " to " + F.name(targetName) + "."));
|
||||
|
||||
if (target != null)
|
||||
{
|
||||
UtilPlayer.message(target, F.main("gem", F.name(caller.getName()) + " gave you " + F.elem(gems + " gems") + "."));
|
||||
UtilPlayer.message(target, F.main("Gem", F.name(caller.getName()) + " gave you " + F.elem(gems + " gems") + "."));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("gem", "There was an error giving " + F.elem(gems + " gems") + " to " + F.name(targetName) + "."));
|
||||
UtilPlayer.message(caller, F.main("Gem", "There was an error giving " + F.elem(gems + " gems") + " to " + F.name(targetName) + "."));
|
||||
}
|
||||
}
|
||||
}, caller.getName(), targetName, uuid, gems);
|
||||
|
@ -23,6 +23,7 @@ public class GoldCommand extends CommandBase<DonationManager>
|
||||
if (args == null || args.length == 0)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Gold", "Your Gold: " + F.elem("" + Plugin.Get(caller).getGold())));
|
||||
return;
|
||||
}
|
||||
else if (args.length < 2)
|
||||
{
|
||||
|
@ -21,7 +21,7 @@ public class AdminCommand extends CommandBase<MessageManager>
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args == null)
|
||||
if (args == null || args.length == 0)
|
||||
{
|
||||
Plugin.Help(caller);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public class AdminMessageCommand extends CommandBase<MessageManager>
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args == null)
|
||||
if (args == null || args.length == 0)
|
||||
{
|
||||
Plugin.Help(caller);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ public class AnnounceCommand extends CommandBase<MessageManager>
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args == null)
|
||||
if (args == null || args.length == 0)
|
||||
{
|
||||
Plugin.Help(caller);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ public class GlobalCommand extends CommandBase<MessageManager>
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args == null)
|
||||
if (args == null || args.length == 0)
|
||||
{
|
||||
Plugin.Help(caller);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public class MessageAdminCommand extends CommandBase<MessageManager>
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args == null)
|
||||
if (args == null || args.length == 0)
|
||||
{
|
||||
Plugin.Help(caller);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public class MessageCommand extends CommandBase<MessageManager>
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args == null)
|
||||
if (args == null || args.length == 0)
|
||||
{
|
||||
Plugin.Help(caller);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public class ResendAdminCommand extends CommandBase<MessageManager>
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args == null)
|
||||
if (args == null || args.length == 0)
|
||||
{
|
||||
Plugin.Help(caller);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public class ResendCommand extends CommandBase<MessageManager>
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args == null)
|
||||
if (args == null || args.length == 0)
|
||||
{
|
||||
Plugin.Help(caller);
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public class AddCommand extends CommandBase<NpcManager>
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args == null)
|
||||
if (args == null || args.length == 0)
|
||||
Plugin.help(caller);
|
||||
else
|
||||
{
|
||||
|
@ -20,7 +20,7 @@ public class ClearCommand extends CommandBase<NpcManager>
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args != null)
|
||||
if (args.length > 0)
|
||||
Plugin.help(caller);
|
||||
else
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ public class DeleteCommand extends CommandBase<NpcManager>
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args != null)
|
||||
if (args.length > 0)
|
||||
Plugin.help(caller);
|
||||
else
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ public class HomeCommand extends CommandBase<NpcManager>
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args != null)
|
||||
if (args.length > 0)
|
||||
Plugin.help(caller);
|
||||
else
|
||||
{
|
||||
|
@ -20,7 +20,7 @@ public class RefreshCommand extends CommandBase<NpcManager>
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args != null)
|
||||
if (args.length > 0)
|
||||
Plugin.help(caller);
|
||||
else
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ public class FieldBlockCommand extends CommandBase<FieldBlock>
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args == null || args[0].equalsIgnoreCase("help"))
|
||||
if (args.length == 0 || args[0].equalsIgnoreCase("help"))
|
||||
{
|
||||
Plugin.help(caller);
|
||||
}
|
||||
|
@ -49,307 +49,307 @@ import com.mysql.jdbc.BalanceStrategy;
|
||||
public class DisguiseCommand extends CommandBase<HubManager> implements Listener
|
||||
{
|
||||
|
||||
private NautHashMap<Player, GameProfile> _disguisedPlayers = new NautHashMap<>();
|
||||
private NautHashMap<Player, String> _disguisedPlayersNames = new NautHashMap<>();
|
||||
private NautHashMap<Player, DisguisePlayer> _disguisedPlayerDisguises = new NautHashMap<>();
|
||||
private NautHashMap<Player, GameProfile> _disguisedPlayers = new NautHashMap<>();
|
||||
private NautHashMap<Player, String> _disguisedPlayersNames = new NautHashMap<>();
|
||||
private NautHashMap<Player, DisguisePlayer> _disguisedPlayerDisguises = new NautHashMap<>();
|
||||
|
||||
public DisguiseCommand(HubManager plugin)
|
||||
{
|
||||
super(plugin, Rank.JNR_DEV, new Rank[]
|
||||
{
|
||||
Rank.YOUTUBE, Rank.TWITCH }, "disguise");
|
||||
public DisguiseCommand(HubManager plugin)
|
||||
{
|
||||
super(plugin, Rank.JNR_DEV, new Rank[]
|
||||
{
|
||||
Rank.YOUTUBE, Rank.TWITCH }, "disguise");
|
||||
plugin.getPluginManager().registerEvents(this, Plugin.getPlugin());
|
||||
new NCPDataManFix();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(final Player caller, final String[] args)
|
||||
{
|
||||
if(args == null)
|
||||
@Override
|
||||
public void Execute(final Player caller, final String[] args)
|
||||
{
|
||||
if(!Plugin.GetDisguise().isDisguised(caller))
|
||||
{
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "please use /disguise <name> first");
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
_disguisedPlayers.remove(caller);
|
||||
_disguisedPlayerDisguises.remove(caller);
|
||||
Plugin.GetDisguise().undisguise(caller);
|
||||
String playerName = _disguisedPlayersNames.get(caller);
|
||||
|
||||
CoreClient client = Plugin.GetClients().Get(caller);
|
||||
client.setDisguisedRank(null);
|
||||
client.setDisguisedAs(null);
|
||||
client.setDisguised(false);
|
||||
|
||||
changeName(caller, playerName);
|
||||
|
||||
for(Player other : UtilServer.getPlayers())
|
||||
if(args == null || args.length == 0)
|
||||
{
|
||||
for(Team team : other.getScoreboard().getTeams())
|
||||
{
|
||||
if(team.hasPlayer(caller))
|
||||
if(!Plugin.GetDisguise().isDisguised(caller))
|
||||
{
|
||||
team.removePlayer(caller);
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "please use /disguise <name> first");
|
||||
return;
|
||||
}
|
||||
}
|
||||
other.getScoreboard().getTeam(Plugin.GetClients().Get(caller).GetRank().Name).addPlayer(caller);
|
||||
}
|
||||
try
|
||||
{
|
||||
_disguisedPlayers.remove(caller);
|
||||
_disguisedPlayerDisguises.remove(caller);
|
||||
Plugin.GetDisguise().undisguise(caller);
|
||||
String playerName = _disguisedPlayersNames.get(caller);
|
||||
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "You are no longer disguised!");
|
||||
return;
|
||||
} catch(Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
if(args != null && args.length > 1)
|
||||
{
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "/disguise <name>");
|
||||
return;
|
||||
}
|
||||
CoreClient client = Plugin.GetClients().Get(caller);
|
||||
client.setDisguisedRank(null);
|
||||
client.setDisguisedAs(null);
|
||||
client.setDisguised(false);
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(Plugin.getPlugin(), new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if(Plugin.GetDisguise().isDisguised(caller))
|
||||
{
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "please use /disguise first");
|
||||
return;
|
||||
changeName(caller, playerName);
|
||||
|
||||
for(Player other : UtilServer.getPlayers())
|
||||
{
|
||||
for(Team team : other.getScoreboard().getTeams())
|
||||
{
|
||||
if(team.hasPlayer(caller))
|
||||
{
|
||||
team.removePlayer(caller);
|
||||
}
|
||||
}
|
||||
other.getScoreboard().getTeam(Plugin.GetClients().Get(caller).GetRank().Name).addPlayer(caller);
|
||||
}
|
||||
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "You are no longer disguised!");
|
||||
return;
|
||||
} catch(Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
for(Player other : UtilServer.getPlayers())
|
||||
if(args != null && args.length > 1)
|
||||
{
|
||||
if(other.getName().equalsIgnoreCase(args[0]))
|
||||
{
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "this name is already in use!");
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "/disguise <name>");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(_disguisedPlayersNames.containsValue(args[0]))
|
||||
{
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "this name is already in use!");
|
||||
return;
|
||||
}
|
||||
if(args[0].length() > 16)
|
||||
{
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "Invalid Disguise Name: " + ChatColor.RESET + args[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(Plugin.getPlugin(), new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if(Plugin.GetDisguise().isDisguised(caller))
|
||||
{
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "please use /disguise first");
|
||||
return;
|
||||
}
|
||||
for(Player other : UtilServer.getPlayers())
|
||||
{
|
||||
if(other.getName().equalsIgnoreCase(args[0]))
|
||||
{
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "this name is already in use!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(_disguisedPlayersNames.containsValue(args[0]))
|
||||
{
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "this name is already in use!");
|
||||
return;
|
||||
}
|
||||
if(args[0].length() > 16)
|
||||
{
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "Invalid Disguise Name: " + ChatColor.RESET + args[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
CoreClient client = Plugin.GetClients().Get(caller);
|
||||
UUID uuid = UUIDFetcher.getUUIDOf(args[0]);
|
||||
GameProfile profile = null;
|
||||
try
|
||||
{
|
||||
profile = new ProfileLoader(uuid.toString(), args[0]).loadProfile();
|
||||
} catch(Exception e)
|
||||
{
|
||||
uuid = UUIDFetcher.getUUIDOf("Alex");
|
||||
profile = new ProfileLoader(uuid.toString(), args[0]).loadProfile();
|
||||
}
|
||||
|
||||
Rank otherRank = Rank.ALL;
|
||||
try
|
||||
{
|
||||
CoreClient other = new CoreClient(args[0]);
|
||||
Plugin.GetClients().LoadClient(other, uuid, caller.getAddress().getAddress().getAddress().toString());
|
||||
otherRank = other.GetRank();
|
||||
} catch(NullPointerException exception)
|
||||
{}
|
||||
if(otherRank.Has(Rank.TWITCH))
|
||||
{
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "You can't disguise as staff!");
|
||||
return;
|
||||
}
|
||||
_disguisedPlayers.put(caller, profile);
|
||||
_disguisedPlayersNames.put(caller, caller.getName());
|
||||
client.setDisguisedRank(otherRank);
|
||||
client.setDisguised(true);
|
||||
|
||||
client.setDisguisedAs(args[0]);
|
||||
|
||||
changeName(caller, args[0]);
|
||||
|
||||
Plugin.GetGadget().RemoveItem(caller);
|
||||
|
||||
UtilPlayer.message(caller, C.cGreen + C.Bold + "Disguise Active: " + ChatColor.RESET + args[0]);
|
||||
} catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "Invalid Disguise Name: " + ChatColor.RESET + args[0]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateDisguises(UpdateEvent event)
|
||||
{
|
||||
if(event.getType() != UpdateType.FASTEST)
|
||||
return;
|
||||
|
||||
for(final Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if(!_disguisedPlayers.containsKey(player))
|
||||
continue;
|
||||
|
||||
for(Player other : UtilServer.getPlayers())
|
||||
{
|
||||
try
|
||||
{
|
||||
for(Team team : other.getScoreboard().getTeams())
|
||||
{
|
||||
if(team.hasPlayer(player))
|
||||
{
|
||||
team.removePlayer(player);
|
||||
}
|
||||
}
|
||||
other.getScoreboard().getTeam(Plugin.GetClients().Get(player).getDisguisedRank().Name).addPlayer(player);
|
||||
|
||||
} catch(NullPointerException exp)
|
||||
{}
|
||||
}
|
||||
|
||||
if(Plugin.GetDisguise().isDisguised(player))
|
||||
continue;
|
||||
|
||||
DisguisePlayer playerDisguise = new DisguisePlayer(player, _disguisedPlayers.get(player));
|
||||
_disguisedPlayerDisguises.put(player, playerDisguise);
|
||||
Plugin.GetDisguise().disguise(playerDisguise);
|
||||
}
|
||||
}
|
||||
|
||||
public void changeName(Player player, String changedName)
|
||||
{
|
||||
try
|
||||
{
|
||||
CoreClient client = Plugin.GetClients().Get(caller);
|
||||
UUID uuid = UUIDFetcher.getUUIDOf(args[0]);
|
||||
GameProfile profile = null;
|
||||
try
|
||||
{
|
||||
profile = new ProfileLoader(uuid.toString(), args[0]).loadProfile();
|
||||
} catch(Exception e)
|
||||
{
|
||||
uuid = UUIDFetcher.getUUIDOf("Alex");
|
||||
profile = new ProfileLoader(uuid.toString(), args[0]).loadProfile();
|
||||
}
|
||||
Field name = GameProfile.class.getDeclaredField("name");
|
||||
Field declaredProfile = EntityHuman.class.getDeclaredField("i");
|
||||
declaredProfile.setAccessible(true);
|
||||
GameProfile gameProfile = (GameProfile) declaredProfile.get(((CraftHumanEntity) ((CraftPlayer) player)).getHandle());
|
||||
|
||||
Rank otherRank = Rank.ALL;
|
||||
try
|
||||
{
|
||||
CoreClient other = new CoreClient(args[0]);
|
||||
Plugin.GetClients().LoadClient(other, uuid, caller.getAddress().getAddress().getAddress().toString());
|
||||
otherRank = other.GetRank();
|
||||
} catch(NullPointerException exception)
|
||||
{}
|
||||
if(otherRank.Has(Rank.TWITCH))
|
||||
{
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "You can't disguise as staff!");
|
||||
return;
|
||||
}
|
||||
_disguisedPlayers.put(caller, profile);
|
||||
_disguisedPlayersNames.put(caller, caller.getName());
|
||||
client.setDisguisedRank(otherRank);
|
||||
client.setDisguised(true);
|
||||
|
||||
client.setDisguisedAs(args[0]);
|
||||
|
||||
changeName(caller, args[0]);
|
||||
|
||||
Plugin.GetGadget().RemoveItem(caller);
|
||||
|
||||
UtilPlayer.message(caller, C.cGreen + C.Bold + "Disguise Active: " + ChatColor.RESET + args[0]);
|
||||
} catch(Exception e)
|
||||
name.setAccessible(true);
|
||||
name.set(gameProfile, changedName);
|
||||
name.setAccessible(false);
|
||||
} catch(Exception ex)
|
||||
{
|
||||
e.printStackTrace();
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "Invalid Disguise Name: " + ChatColor.RESET + args[0]);
|
||||
return;
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateDisguises(UpdateEvent event)
|
||||
{
|
||||
if(event.getType() != UpdateType.FASTEST)
|
||||
return;
|
||||
|
||||
for(final Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if(!_disguisedPlayers.containsKey(player))
|
||||
continue;
|
||||
|
||||
for(Player other : UtilServer.getPlayers())
|
||||
{
|
||||
try
|
||||
{
|
||||
for(Team team : other.getScoreboard().getTeams())
|
||||
{
|
||||
if(team.hasPlayer(player))
|
||||
{
|
||||
team.removePlayer(player);
|
||||
}
|
||||
}
|
||||
other.getScoreboard().getTeam(Plugin.GetClients().Get(player).getDisguisedRank().Name).addPlayer(player);
|
||||
|
||||
} catch(NullPointerException exp)
|
||||
{}
|
||||
}
|
||||
|
||||
if(Plugin.GetDisguise().isDisguised(player))
|
||||
continue;
|
||||
|
||||
DisguisePlayer playerDisguise = new DisguisePlayer(player, _disguisedPlayers.get(player));
|
||||
_disguisedPlayerDisguises.put(player, playerDisguise);
|
||||
Plugin.GetDisguise().disguise(playerDisguise);
|
||||
}
|
||||
}
|
||||
|
||||
public void changeName(Player player, String changedName)
|
||||
{
|
||||
try
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void Quit(PlayerQuitEvent event)
|
||||
{
|
||||
Field name = GameProfile.class.getDeclaredField("name");
|
||||
Field declaredProfile = EntityHuman.class.getDeclaredField("i");
|
||||
declaredProfile.setAccessible(true);
|
||||
GameProfile gameProfile = (GameProfile) declaredProfile.get(((CraftHumanEntity) ((CraftPlayer) player)).getHandle());
|
||||
|
||||
name.setAccessible(true);
|
||||
name.set(gameProfile, changedName);
|
||||
name.setAccessible(false);
|
||||
} catch(Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void Quit(PlayerQuitEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if(_disguisedPlayers.containsKey(player))
|
||||
{
|
||||
try
|
||||
{
|
||||
_disguisedPlayers.remove(player);
|
||||
_disguisedPlayerDisguises.remove(player);
|
||||
Plugin.GetDisguise().undisguise(player);
|
||||
String playerName = _disguisedPlayersNames.get(player);
|
||||
_disguisedPlayersNames.remove(player);
|
||||
|
||||
CoreClient client = Plugin.GetClients().Get(player);
|
||||
client.setDisguisedRank(null);
|
||||
client.setDisguisedAs(null);
|
||||
client.setDisguised(false);
|
||||
|
||||
changeName(player, playerName);
|
||||
} catch(Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void Join(PlayerLoginEvent event)
|
||||
{
|
||||
for(Player player : _disguisedPlayers.keySet())
|
||||
{
|
||||
if(player.getName().equalsIgnoreCase(event.getPlayer().getName()))
|
||||
{
|
||||
event.disallow(Result.KICK_OTHER, "There is already the same account playing. this probably happened because of /disguise");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void gadget(GadgetActivateEvent event)
|
||||
{
|
||||
if(!event.getGadget().GetName().equalsIgnoreCase("Coin Party Bomb") && event.getGadget().getGadgetType() != GadgetType.Morph)
|
||||
return;
|
||||
|
||||
if(_disguisedPlayers.containsKey(event.getPlayer()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void chest(TreasureStartEvent event)
|
||||
{
|
||||
if(_disguisedPlayers.containsKey(event.getPlayer()))
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Disguise", "You cant open Treasure Chests while you are disguised!"));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerSneak(PlayerToggleSneakEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if(_disguisedPlayers.containsKey(player))
|
||||
{
|
||||
DisguisePlayer dp = _disguisedPlayerDisguises.get(player);
|
||||
|
||||
dp.setSneaking(!dp.getSneaking());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onDPlayerChat(AsyncPlayerChatEvent event)
|
||||
{
|
||||
if(_disguisedPlayers.containsKey(event.getPlayer()))
|
||||
{
|
||||
event.setFormat(" *" + event.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void on(PlayerInteractEvent event)
|
||||
{
|
||||
if(event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK)
|
||||
{
|
||||
if(_disguisedPlayers.containsKey(event.getPlayer()))
|
||||
{
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
PacketPlayOutAnimation packet = new PacketPlayOutAnimation();
|
||||
packet.a = player.getEntityId();
|
||||
|
||||
for(Player p : Bukkit.getOnlinePlayers())
|
||||
if(_disguisedPlayers.containsKey(player))
|
||||
{
|
||||
if(p != player)
|
||||
{
|
||||
Plugin.getPacketHandler().getPacketVerifier((Player) p).bypassProcess(packet);
|
||||
}
|
||||
try
|
||||
{
|
||||
_disguisedPlayers.remove(player);
|
||||
_disguisedPlayerDisguises.remove(player);
|
||||
Plugin.GetDisguise().undisguise(player);
|
||||
String playerName = _disguisedPlayersNames.get(player);
|
||||
_disguisedPlayersNames.remove(player);
|
||||
|
||||
CoreClient client = Plugin.GetClients().Get(player);
|
||||
client.setDisguisedRank(null);
|
||||
client.setDisguisedAs(null);
|
||||
client.setDisguised(false);
|
||||
|
||||
changeName(player, playerName);
|
||||
} catch(Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void Join(PlayerLoginEvent event)
|
||||
{
|
||||
for(Player player : _disguisedPlayers.keySet())
|
||||
{
|
||||
if(player.getName().equalsIgnoreCase(event.getPlayer().getName()))
|
||||
{
|
||||
event.disallow(Result.KICK_OTHER, "There is already the same account playing. this probably happened because of /disguise");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void gadget(GadgetActivateEvent event)
|
||||
{
|
||||
if(!event.getGadget().GetName().equalsIgnoreCase("Coin Party Bomb") && event.getGadget().getGadgetType() != GadgetType.Morph)
|
||||
return;
|
||||
|
||||
if(_disguisedPlayers.containsKey(event.getPlayer()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void chest(TreasureStartEvent event)
|
||||
{
|
||||
if(_disguisedPlayers.containsKey(event.getPlayer()))
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Disguise", "You cant open Treasure Chests while you are disguised!"));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerSneak(PlayerToggleSneakEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if(_disguisedPlayers.containsKey(player))
|
||||
{
|
||||
DisguisePlayer dp = _disguisedPlayerDisguises.get(player);
|
||||
|
||||
dp.setSneaking(!dp.getSneaking());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onDPlayerChat(AsyncPlayerChatEvent event)
|
||||
{
|
||||
if(_disguisedPlayers.containsKey(event.getPlayer()))
|
||||
{
|
||||
event.setFormat(" *" + event.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void on(PlayerInteractEvent event)
|
||||
{
|
||||
if(event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK)
|
||||
{
|
||||
if(_disguisedPlayers.containsKey(event.getPlayer()))
|
||||
{
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
PacketPlayOutAnimation packet = new PacketPlayOutAnimation();
|
||||
packet.a = player.getEntityId();
|
||||
|
||||
for(Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if(p != player)
|
||||
{
|
||||
Plugin.getPacketHandler().getPacketVerifier((Player) p).bypassProcess(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Bat;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Firework;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Slime;
|
||||
@ -358,7 +359,7 @@ public class SoccerManager extends MiniPlugin
|
||||
|
||||
if (inPlayerArena(ent))
|
||||
{
|
||||
if (ent instanceof Bat || ent instanceof WitherSkull || ent instanceof TNTPrimed)
|
||||
if (ent instanceof Bat || ent instanceof WitherSkull || ent instanceof TNTPrimed || ent instanceof Firework)
|
||||
{
|
||||
ent.remove();
|
||||
continue;
|
||||
|
@ -45,330 +45,330 @@ import org.bukkit.scoreboard.Team;
|
||||
public class DisguiseCommand extends CommandBase<ArcadeManager> implements Listener
|
||||
{
|
||||
|
||||
private NautHashMap<Player, GameProfile> _disguisedPlayers = new NautHashMap<>();
|
||||
private NautHashMap<Player, String> _disguisedPlayersNames = new NautHashMap<>();
|
||||
private NautHashMap<Player, DisguisePlayer> _disguisedPlayerDisguises = new NautHashMap<>();
|
||||
private NautHashMap<Player, GameProfile> _disguisedPlayers = new NautHashMap<>();
|
||||
private NautHashMap<Player, String> _disguisedPlayersNames = new NautHashMap<>();
|
||||
private NautHashMap<Player, DisguisePlayer> _disguisedPlayerDisguises = new NautHashMap<>();
|
||||
|
||||
public DisguiseCommand(ArcadeManager plugin)
|
||||
{
|
||||
super(plugin, Rank.JNR_DEV, new Rank[]
|
||||
{ Rank.YOUTUBE, Rank.TWITCH }, "disguise");
|
||||
plugin.getPluginManager().registerEvents(this, Plugin.getPlugin());
|
||||
new NCPDataManFix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(final Player caller, final String[] args)
|
||||
{
|
||||
if(args == null)
|
||||
public DisguiseCommand(ArcadeManager plugin)
|
||||
{
|
||||
if(!Plugin.GetDisguise().isDisguised(caller))
|
||||
{
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "please use /disguise <name> first");
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
_disguisedPlayers.remove(caller);
|
||||
_disguisedPlayerDisguises.remove(caller);
|
||||
Plugin.GetDisguise().undisguise(caller);
|
||||
String playerName = _disguisedPlayersNames.get(caller);
|
||||
|
||||
CoreClient client = Plugin.GetClients().Get(caller);
|
||||
client.setDisguisedRank(null);
|
||||
client.setDisguisedAs(null);
|
||||
client.setDisguised(false);
|
||||
|
||||
changeName(caller, playerName, true);
|
||||
|
||||
for(Player other : UtilServer.getPlayers())
|
||||
{
|
||||
for(Team team : other.getScoreboard().getTeams())
|
||||
{
|
||||
team.removePlayer(caller);
|
||||
}
|
||||
other.getScoreboard().getTeam(Plugin.GetClients().Get(caller).GetRank().Name).addPlayer(caller);
|
||||
}
|
||||
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "You are no longer disguised!");
|
||||
return;
|
||||
} catch(Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
if(args != null && args.length > 1)
|
||||
{
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "/disguise <name>");
|
||||
return;
|
||||
super(plugin, Rank.JNR_DEV, new Rank[]
|
||||
{ Rank.YOUTUBE, Rank.TWITCH }, "disguise");
|
||||
plugin.getPluginManager().registerEvents(this, Plugin.getPlugin());
|
||||
new NCPDataManFix();
|
||||
}
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(Plugin.getPlugin(), new Runnable()
|
||||
@Override
|
||||
public void Execute(final Player caller, final String[] args)
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if(Plugin.GetDisguise().isDisguised(caller))
|
||||
if(args == null || args.length == 0)
|
||||
{
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "please use /disguise first");
|
||||
return;
|
||||
}
|
||||
for(Player other : UtilServer.getPlayers())
|
||||
{
|
||||
if(other.getName().equalsIgnoreCase(args[0]))
|
||||
{
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "this name is already in use!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(_disguisedPlayersNames.containsValue(args[0]))
|
||||
{
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "this name is already in use!");
|
||||
return;
|
||||
}
|
||||
if(args[0].length() > 16)
|
||||
{
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "Invalid Disguise Name: " + ChatColor.RESET + args[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
CoreClient client = Plugin.GetClients().Get(caller);
|
||||
UUID uuid = UUIDFetcher.getUUIDOf(args[0]);
|
||||
GameProfile profile = null;
|
||||
try
|
||||
{
|
||||
profile = new ProfileLoader(uuid.toString(), args[0]).loadProfile();
|
||||
} catch(Exception e)
|
||||
{
|
||||
uuid = UUIDFetcher.getUUIDOf("Alex");
|
||||
profile = new ProfileLoader(uuid.toString(), args[0]).loadProfile();
|
||||
}
|
||||
|
||||
Rank otherRank = Rank.ALL;
|
||||
try
|
||||
{
|
||||
CoreClient other = new CoreClient(args[0]);
|
||||
Plugin.GetClients().LoadClient(other, uuid, caller.getAddress().getAddress().getAddress().toString());
|
||||
otherRank = other.GetRank();
|
||||
} catch(NullPointerException exception)
|
||||
{}
|
||||
if(otherRank.Has(Rank.TWITCH))
|
||||
{
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "You can't disguise as staff!");
|
||||
return;
|
||||
}
|
||||
_disguisedPlayers.put(caller, profile);
|
||||
_disguisedPlayersNames.put(caller, caller.getName());
|
||||
client.setDisguisedRank(otherRank);
|
||||
client.setDisguised(true);
|
||||
|
||||
client.setDisguisedAs(args[0]);
|
||||
|
||||
changeName(caller, args[0], true);
|
||||
|
||||
Plugin.getCosmeticManager().getGadgetManager().RemoveItem(caller);
|
||||
|
||||
Bukkit.broadcastMessage(ChatColor.DARK_GRAY + "Quit> " + ChatColor.GRAY + _disguisedPlayersNames.get(caller));
|
||||
UtilPlayer.message(caller, C.cGreen + C.Bold + "Disguise Active: " + ChatColor.RESET + args[0]);
|
||||
} catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "Invalid Disguise Name: " + ChatColor.RESET + args[0]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateDisguises(UpdateEvent event)
|
||||
{
|
||||
if(event.getType() != UpdateType.FASTEST)
|
||||
return;
|
||||
|
||||
for(final Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if(!_disguisedPlayers.containsKey(player))
|
||||
continue;
|
||||
|
||||
for(Player other : UtilServer.getPlayers())
|
||||
{
|
||||
try
|
||||
{
|
||||
if(other.getScoreboard().getTeam(Plugin.GetClients().Get(player).GetRank().Name).getPlayers().contains(player))
|
||||
{
|
||||
other.getScoreboard().getTeam(Plugin.GetClients().Get(player).GetRank().Name).removePlayer(player);
|
||||
other.getScoreboard().getTeam(Plugin.GetClients().Get(player).getDisguisedRank().Name).addPlayer(player);
|
||||
}
|
||||
if(other.getScoreboard().getTeam(
|
||||
Plugin.GetClients().Get(player).GetRank().Name + Plugin.GetGame().GetTeam(player).GetName().toUpperCase()) != null)
|
||||
{
|
||||
if(other.getScoreboard()
|
||||
.getTeam(Plugin.GetClients().Get(player).GetRank().Name + Plugin.GetGame().GetTeam(player).GetName().toUpperCase())
|
||||
.getPlayers().contains(player))
|
||||
if(!Plugin.GetDisguise().isDisguised(caller))
|
||||
{
|
||||
other.getScoreboard()
|
||||
.getTeam(
|
||||
Plugin.GetClients().Get(player).GetRank().Name + Plugin.GetGame().GetTeam(player).GetName().toUpperCase())
|
||||
.removePlayer(player);
|
||||
other.getScoreboard()
|
||||
.getTeam(
|
||||
Plugin.GetClients().Get(player).getDisguisedRank().Name
|
||||
+ Plugin.GetGame().GetTeam(player).GetName().toUpperCase()).addPlayer(player);
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "please use /disguise <name> first");
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch(NullPointerException exp)
|
||||
{}
|
||||
}
|
||||
try
|
||||
{
|
||||
_disguisedPlayers.remove(caller);
|
||||
_disguisedPlayerDisguises.remove(caller);
|
||||
Plugin.GetDisguise().undisguise(caller);
|
||||
String playerName = _disguisedPlayersNames.get(caller);
|
||||
|
||||
if(Plugin.GetDisguise().isDisguised(player))
|
||||
continue;
|
||||
CoreClient client = Plugin.GetClients().Get(caller);
|
||||
client.setDisguisedRank(null);
|
||||
client.setDisguisedAs(null);
|
||||
client.setDisguised(false);
|
||||
|
||||
DisguisePlayer playerDisguise = new DisguisePlayer(player, _disguisedPlayers.get(player));
|
||||
_disguisedPlayerDisguises.put(player, playerDisguise);
|
||||
Plugin.GetDisguise().disguise(playerDisguise);
|
||||
changeName(caller, playerName, true);
|
||||
|
||||
for(Player other : UtilServer.getPlayers())
|
||||
{
|
||||
for(Team team : other.getScoreboard().getTeams())
|
||||
{
|
||||
team.removePlayer(caller);
|
||||
}
|
||||
other.getScoreboard().getTeam(Plugin.GetClients().Get(caller).GetRank().Name).addPlayer(caller);
|
||||
}
|
||||
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "You are no longer disguised!");
|
||||
return;
|
||||
} catch(Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
if(args != null && args.length > 1)
|
||||
{
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "/disguise <name>");
|
||||
return;
|
||||
}
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(Plugin.getPlugin(), new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if(Plugin.GetDisguise().isDisguised(caller))
|
||||
{
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "please use /disguise first");
|
||||
return;
|
||||
}
|
||||
for(Player other : UtilServer.getPlayers())
|
||||
{
|
||||
if(other.getName().equalsIgnoreCase(args[0]))
|
||||
{
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "this name is already in use!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(_disguisedPlayersNames.containsValue(args[0]))
|
||||
{
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "this name is already in use!");
|
||||
return;
|
||||
}
|
||||
if(args[0].length() > 16)
|
||||
{
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "Invalid Disguise Name: " + ChatColor.RESET + args[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
CoreClient client = Plugin.GetClients().Get(caller);
|
||||
UUID uuid = UUIDFetcher.getUUIDOf(args[0]);
|
||||
GameProfile profile = null;
|
||||
try
|
||||
{
|
||||
profile = new ProfileLoader(uuid.toString(), args[0]).loadProfile();
|
||||
} catch(Exception e)
|
||||
{
|
||||
uuid = UUIDFetcher.getUUIDOf("Alex");
|
||||
profile = new ProfileLoader(uuid.toString(), args[0]).loadProfile();
|
||||
}
|
||||
|
||||
Rank otherRank = Rank.ALL;
|
||||
try
|
||||
{
|
||||
CoreClient other = new CoreClient(args[0]);
|
||||
Plugin.GetClients().LoadClient(other, uuid, caller.getAddress().getAddress().getAddress().toString());
|
||||
otherRank = other.GetRank();
|
||||
} catch(NullPointerException exception)
|
||||
{}
|
||||
if(otherRank.Has(Rank.TWITCH))
|
||||
{
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "You can't disguise as staff!");
|
||||
return;
|
||||
}
|
||||
_disguisedPlayers.put(caller, profile);
|
||||
_disguisedPlayersNames.put(caller, caller.getName());
|
||||
client.setDisguisedRank(otherRank);
|
||||
client.setDisguised(true);
|
||||
|
||||
client.setDisguisedAs(args[0]);
|
||||
|
||||
changeName(caller, args[0], true);
|
||||
|
||||
Plugin.getCosmeticManager().getGadgetManager().RemoveItem(caller);
|
||||
|
||||
Bukkit.broadcastMessage(ChatColor.DARK_GRAY + "Quit> " + ChatColor.GRAY + _disguisedPlayersNames.get(caller));
|
||||
UtilPlayer.message(caller, C.cGreen + C.Bold + "Disguise Active: " + ChatColor.RESET + args[0]);
|
||||
} catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
UtilPlayer.message(caller, C.cRed + C.Bold + "Invalid Disguise Name: " + ChatColor.RESET + args[0]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void changeName(final Player player, String changedName, boolean skin)
|
||||
{
|
||||
try
|
||||
@EventHandler
|
||||
public void updateDisguises(UpdateEvent event)
|
||||
{
|
||||
GameProfile gameProfile = ((CraftPlayer) player).getProfile();
|
||||
if(event.getType() != UpdateType.FASTEST)
|
||||
return;
|
||||
|
||||
Field name = GameProfile.class.getDeclaredField("name");
|
||||
name.setAccessible(true);
|
||||
name.set(gameProfile, changedName);
|
||||
name.setAccessible(false);
|
||||
for(final Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if(!_disguisedPlayers.containsKey(player))
|
||||
continue;
|
||||
|
||||
} catch(Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
for(Player other : UtilServer.getPlayers())
|
||||
{
|
||||
try
|
||||
{
|
||||
if(other.getScoreboard().getTeam(Plugin.GetClients().Get(player).GetRank().Name).getPlayers().contains(player))
|
||||
{
|
||||
other.getScoreboard().getTeam(Plugin.GetClients().Get(player).GetRank().Name).removePlayer(player);
|
||||
other.getScoreboard().getTeam(Plugin.GetClients().Get(player).getDisguisedRank().Name).addPlayer(player);
|
||||
}
|
||||
if(other.getScoreboard().getTeam(
|
||||
Plugin.GetClients().Get(player).GetRank().Name + Plugin.GetGame().GetTeam(player).GetName().toUpperCase()) != null)
|
||||
{
|
||||
if(other.getScoreboard()
|
||||
.getTeam(Plugin.GetClients().Get(player).GetRank().Name + Plugin.GetGame().GetTeam(player).GetName().toUpperCase())
|
||||
.getPlayers().contains(player))
|
||||
{
|
||||
other.getScoreboard()
|
||||
.getTeam(
|
||||
Plugin.GetClients().Get(player).GetRank().Name + Plugin.GetGame().GetTeam(player).GetName().toUpperCase())
|
||||
.removePlayer(player);
|
||||
other.getScoreboard()
|
||||
.getTeam(
|
||||
Plugin.GetClients().Get(player).getDisguisedRank().Name
|
||||
+ Plugin.GetGame().GetTeam(player).GetName().toUpperCase()).addPlayer(player);
|
||||
}
|
||||
}
|
||||
} catch(NullPointerException exp)
|
||||
{}
|
||||
}
|
||||
|
||||
if(Plugin.GetDisguise().isDisguised(player))
|
||||
continue;
|
||||
|
||||
DisguisePlayer playerDisguise = new DisguisePlayer(player, _disguisedPlayers.get(player));
|
||||
_disguisedPlayerDisguises.put(player, playerDisguise);
|
||||
Plugin.GetDisguise().disguise(playerDisguise);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void Quit(PlayerQuitEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if(_disguisedPlayers.containsKey(player))
|
||||
public void changeName(final Player player, String changedName, boolean skin)
|
||||
{
|
||||
try
|
||||
{
|
||||
_disguisedPlayers.remove(player);
|
||||
_disguisedPlayerDisguises.remove(player);
|
||||
Plugin.GetDisguise().undisguise(player);
|
||||
String playerName = _disguisedPlayersNames.get(player);
|
||||
_disguisedPlayersNames.remove(player);
|
||||
try
|
||||
{
|
||||
GameProfile gameProfile = ((CraftPlayer) player).getProfile();
|
||||
|
||||
CoreClient client = Plugin.GetClients().Get(player);
|
||||
client.setDisguisedRank(null);
|
||||
client.setDisguisedAs(null);
|
||||
client.setDisguised(false);
|
||||
Field name = GameProfile.class.getDeclaredField("name");
|
||||
name.setAccessible(true);
|
||||
name.set(gameProfile, changedName);
|
||||
name.setAccessible(false);
|
||||
|
||||
changeName(player, playerName, true);
|
||||
} catch(Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
} catch(Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void Join(PlayerLoginEvent event)
|
||||
{
|
||||
for(Player player : _disguisedPlayers.keySet())
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void Quit(PlayerQuitEvent event)
|
||||
{
|
||||
if(player.getName().equalsIgnoreCase(event.getPlayer().getName()))
|
||||
{
|
||||
event.disallow(Result.KICK_OTHER, "There is already the same account playing. this probably happened because of /disguise");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void gadget(GadgetActivateEvent event)
|
||||
{
|
||||
if(!event.getGadget().GetName().equalsIgnoreCase("Coin Party Bomb") && event.getGadget().getGadgetType() != GadgetType.Morph)
|
||||
return;
|
||||
|
||||
if(_disguisedPlayers.containsKey(event.getPlayer()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void chest(TreasureStartEvent event)
|
||||
{
|
||||
if(_disguisedPlayers.containsKey(event.getPlayer()))
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Disguise", "You cant open Treasure Chests while you are disguised!"));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerSneak(PlayerToggleSneakEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if(_disguisedPlayers.containsKey(player))
|
||||
{
|
||||
DisguisePlayer dp = _disguisedPlayerDisguises.get(player);
|
||||
|
||||
dp.setSneaking(!dp.getSneaking());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerLeftClick(PlayerInteractEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if(event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK)
|
||||
{
|
||||
if(_disguisedPlayers.containsKey(player))
|
||||
{
|
||||
EntityHuman human = (((CraftHumanEntity) ((CraftPlayer) player)).getHandle());
|
||||
human.world.broadcastEntityEffect(human, (byte) 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onDPlayerChat(AsyncPlayerChatEvent event)
|
||||
{
|
||||
if(_disguisedPlayers.containsKey(event.getPlayer()))
|
||||
{
|
||||
event.setFormat(" *" + event.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void on(PlayerInteractEvent event)
|
||||
{
|
||||
if(event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK)
|
||||
{
|
||||
if(_disguisedPlayers.containsKey(event.getPlayer()))
|
||||
{
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
PacketPlayOutAnimation packet = new PacketPlayOutAnimation();
|
||||
packet.a = player.getEntityId();
|
||||
|
||||
for(Player p : Bukkit.getOnlinePlayers())
|
||||
if(_disguisedPlayers.containsKey(player))
|
||||
{
|
||||
if(p != player)
|
||||
{
|
||||
Plugin.getPacketHandler().getPacketVerifier((Player) p).bypassProcess(packet);
|
||||
}
|
||||
try
|
||||
{
|
||||
_disguisedPlayers.remove(player);
|
||||
_disguisedPlayerDisguises.remove(player);
|
||||
Plugin.GetDisguise().undisguise(player);
|
||||
String playerName = _disguisedPlayersNames.get(player);
|
||||
_disguisedPlayersNames.remove(player);
|
||||
|
||||
CoreClient client = Plugin.GetClients().Get(player);
|
||||
client.setDisguisedRank(null);
|
||||
client.setDisguisedAs(null);
|
||||
client.setDisguised(false);
|
||||
|
||||
changeName(player, playerName, true);
|
||||
} catch(Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void Join(PlayerLoginEvent event)
|
||||
{
|
||||
for(Player player : _disguisedPlayers.keySet())
|
||||
{
|
||||
if(player.getName().equalsIgnoreCase(event.getPlayer().getName()))
|
||||
{
|
||||
event.disallow(Result.KICK_OTHER, "There is already the same account playing. this probably happened because of /disguise");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void gadget(GadgetActivateEvent event)
|
||||
{
|
||||
if(!event.getGadget().GetName().equalsIgnoreCase("Coin Party Bomb") && event.getGadget().getGadgetType() != GadgetType.Morph)
|
||||
return;
|
||||
|
||||
if(_disguisedPlayers.containsKey(event.getPlayer()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void chest(TreasureStartEvent event)
|
||||
{
|
||||
if(_disguisedPlayers.containsKey(event.getPlayer()))
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Disguise", "You cant open Treasure Chests while you are disguised!"));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerSneak(PlayerToggleSneakEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if(_disguisedPlayers.containsKey(player))
|
||||
{
|
||||
DisguisePlayer dp = _disguisedPlayerDisguises.get(player);
|
||||
|
||||
dp.setSneaking(!dp.getSneaking());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerLeftClick(PlayerInteractEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if(event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK)
|
||||
{
|
||||
if(_disguisedPlayers.containsKey(player))
|
||||
{
|
||||
EntityHuman human = (((CraftHumanEntity) ((CraftPlayer) player)).getHandle());
|
||||
human.world.broadcastEntityEffect(human, (byte) 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onDPlayerChat(AsyncPlayerChatEvent event)
|
||||
{
|
||||
if(_disguisedPlayers.containsKey(event.getPlayer()))
|
||||
{
|
||||
event.setFormat(" *" + event.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void on(PlayerInteractEvent event)
|
||||
{
|
||||
if(event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK)
|
||||
{
|
||||
if(_disguisedPlayers.containsKey(event.getPlayer()))
|
||||
{
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
PacketPlayOutAnimation packet = new PacketPlayOutAnimation();
|
||||
packet.a = player.getEntityId();
|
||||
|
||||
for(Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if(p != player)
|
||||
{
|
||||
Plugin.getPacketHandler().getPacketVerifier((Player) p).bypassProcess(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public class SetCommand extends CommandBase<ArcadeManager>
|
||||
if (Plugin.GetGame() == null)
|
||||
return;
|
||||
|
||||
if (args == null || args.length == 0)
|
||||
if (args.length == 0)
|
||||
{
|
||||
caller.sendMessage(F.help("/game set <GameType> (MapSource) (Map)", "Set the current game or next game", Rank.ADMIN));
|
||||
return;
|
||||
|
@ -28,7 +28,7 @@ public class StartCommand extends CommandBase<ArcadeManager>
|
||||
}
|
||||
|
||||
int seconds;
|
||||
if(args != null && args.length > 0)
|
||||
if(args.length > 0)
|
||||
seconds = Integer.parseInt(args[0]);
|
||||
else
|
||||
seconds = 10;
|
||||
|
@ -81,14 +81,22 @@ public class EventModule extends MiniPlugin
|
||||
{
|
||||
if (!event.getMessage().toLowerCase().startsWith("/sethost "))
|
||||
return;
|
||||
|
||||
boolean allowed = Manager.GetClients().Get(event.getPlayer()).GetRank().Has(event.getPlayer(), Rank.JNR_DEV, true);
|
||||
|
||||
boolean eventTestServer = _plugin.getConfig().getString("serverstatus.name").equalsIgnoreCase("SMTestServer-1");
|
||||
|
||||
if (!allowed)
|
||||
{
|
||||
allowed = _plugin.getConfig().getString("serverstatus.name").equalsIgnoreCase("SMTestServer-1") &&
|
||||
Manager.GetClients().Get(event.getPlayer()).GetRank().Has(event.getPlayer(), Rank.SNR_MODERATOR, true);
|
||||
}
|
||||
|
||||
if (!Manager.GetClients().Get(event.getPlayer()).GetRank().Has(event.getPlayer(), Rank.JNR_DEV, true)
|
||||
&& !event.getPlayer().isOp() &&
|
||||
(!eventTestServer && !Manager.GetClients().Get(event.getPlayer()).GetRank().Has(event.getPlayer(), Rank.SNR_MODERATOR, true)))
|
||||
if (!allowed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Manager.GetServerConfig().HostName = event.getMessage().split(" ")[1];
|
||||
|
||||
event.getPlayer().sendMessage("Set host to: " + event.getMessage().split(" ")[1]);
|
||||
|
@ -837,6 +837,9 @@ public class HideSeek extends TeamGame
|
||||
@EventHandler
|
||||
public void UseBoost(PlayerInteractEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!UtilEvent.isAction(event, ActionType.R))
|
||||
@ -901,6 +904,9 @@ public class HideSeek extends TeamGame
|
||||
@EventHandler
|
||||
public void UseMeow(PlayerInteractEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!UtilEvent.isAction(event, ActionType.R))
|
||||
@ -927,6 +933,9 @@ public class HideSeek extends TeamGame
|
||||
@EventHandler
|
||||
public void UseFirework(PlayerInteractEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!UtilEvent.isAction(event, ActionType.R))
|
||||
|
Loading…
Reference in New Issue
Block a user