From 884df4869582b7bf9d703ac9632bdd49c2059cf5 Mon Sep 17 00:00:00 2001 From: Mini-Chiss Date: Tue, 10 Feb 2015 19:08:54 +1300 Subject: [PATCH] disguise command (not yet working fully) --- .../nautilus/game/arcade/ArcadeManager.java | 2 + .../game/arcade/command/DisguiseCommand.java | 56 +++++++++++++++++++ .../game/arcade/managers/GameLootManager.java | 2 +- 3 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/DisguiseCommand.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index be778390d..ee2794c13 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -84,6 +84,7 @@ import mineplex.minecraft.game.core.fire.Fire; import nautilus.game.arcade.addons.CompassAddon; import nautilus.game.arcade.addons.SoupAddon; import nautilus.game.arcade.addons.TeamArmorAddon; +import nautilus.game.arcade.command.DisguiseCommand; import nautilus.game.arcade.command.GameCommand; import nautilus.game.arcade.command.WriteCommand; import nautilus.game.arcade.command.YoutubeCommand; @@ -306,6 +307,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation addCommand(new GameCommand(this)); addCommand(new WriteCommand(this)); addCommand(new YoutubeCommand(this)); + addCommand(new DisguiseCommand(this)); } public GameServerConfig GetServerConfig() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/DisguiseCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/DisguiseCommand.java new file mode 100644 index 000000000..ebcc7f31c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/DisguiseCommand.java @@ -0,0 +1,56 @@ +package nautilus.game.arcade.command; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +import nautilus.game.arcade.ArcadeManager; +import net.minecraft.util.com.mojang.authlib.GameProfile; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.ProfileLoader; +import mineplex.core.common.util.UUIDFetcher; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.disguise.disguises.DisguisePlayer; + +public class DisguiseCommand extends CommandBase +{ + public DisguiseCommand(ArcadeManager plugin) + { + super(plugin, Rank.OWNER, new Rank[] {Rank.OWNER}, "disguise"); + } + + @Override + public void Execute(final Player caller, final String[] args) + { + if (args.length == 0) + { + UtilPlayer.message(caller, C.cRed + C.Bold + "/disguise "); + return; + } + + Bukkit.getServer().getScheduler().runTaskAsynchronously(Plugin.GetPlugin(), new Runnable() + { + @Override + public void run() + { + try + { + GameProfile profile = new ProfileLoader(UUIDFetcher.getUUIDOf(args[0]).toString(), args[0]).loadProfile(); + + + DisguisePlayer playerDisguise = new DisguisePlayer(caller, profile); + Plugin.GetDisguise().disguise(playerDisguise); + + UtilPlayer.message(caller, C.cGreen + C.Bold + "Disguise Active: " + ChatColor.RESET + args[0]); + } + catch (Exception e) + { + UtilPlayer.message(caller, C.cRed + C.Bold + "Invalid Disguise Name: " + ChatColor.RESET + args[0]); + return; + } + }} + ); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java index 38c161767..c9d54e003 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java @@ -162,7 +162,7 @@ public class GameLootManager implements Listener return false; } - Reward reward = _rewardManager.nextReward(player, null, false, RewardType.GameLoot); + Reward reward = _rewardManager.nextReward(player, null, false, RewardType.GameLoot, true); RewardData rewardData = reward.giveReward("GameLoot", player);