TotalFreedomMod/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mp44.java

54 lines
1.7 KiB
Java
Raw Normal View History

package me.totalfreedom.totalfreedommod.command;
2011-10-19 00:37:00 +00:00
import java.util.Objects;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.Rank;
2011-10-21 17:02:07 +00:00
import org.bukkit.ChatColor;
import org.bukkit.Material;
2011-10-19 00:37:00 +00:00
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
2011-10-21 17:02:07 +00:00
import org.bukkit.inventory.ItemStack;
2011-10-19 00:37:00 +00:00
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Modern weaponry, FTW. Use 'draw' to start firing, 'sling' to stop firing.", usage = "/<command> <draw | sling>")
public class Command_mp44 extends FreedomCommand
2011-10-19 00:37:00 +00:00
{
2011-10-19 00:37:00 +00:00
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
2011-10-19 00:37:00 +00:00
{
if (!ConfigEntry.MP44_ENABLED.getBoolean())
2011-10-24 02:43:52 +00:00
{
msg("The mp44 is currently disabled.", ChatColor.GREEN);
return true;
2011-10-24 02:43:52 +00:00
}
if (args.length == 0)
2011-10-24 02:43:52 +00:00
{
return false;
2011-10-24 02:43:52 +00:00
}
FPlayer playerdata = plugin.pl.getPlayer(playerSender);
if (args[0].equalsIgnoreCase("draw"))
2011-10-19 00:37:00 +00:00
{
playerdata.armMP44();
msg("mp44 is ARMED! Left click with gunpowder to start firing, left click again to quit.", ChatColor.GREEN);
msg("Type /mp44 sling to disable. -by Madgeek1450", ChatColor.GREEN);
Objects.requireNonNull(playerSender.getEquipment()).setItemInMainHand(new ItemStack(Material.GUNPOWDER, 1));
2011-10-19 00:37:00 +00:00
}
else
{
playerdata.disarmMP44();
sender.sendMessage(ChatColor.GREEN + "mp44 Disarmed.");
2011-10-19 00:37:00 +00:00
}
return true;
}
}