TotalFreedomMod/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mp44.java
Paldiu 5c0f77c7c5 Removal of Lombok
Lombok implementation removal.

I have also gone through and replaced things with inline methods and variables, lambdas, and simplified loops down, removed unnecessary guard clauses, and overall cleaned up every single class. This took a long time, please do remember to follow proper naming conventions, don't include unnecessary guard clauses, follow exception rules and comment rules, and please PLEASE remember to use the DIAMOND OPERATOR rather than just inferring RAW TYPES!!!

Thank you!!
2020-12-25 14:46:43 -05:00

54 lines
1.7 KiB
Java

package me.totalfreedom.totalfreedommod.command;
import java.util.Objects;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@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
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!ConfigEntry.MP44_ENABLED.getBoolean())
{
msg("The mp44 is currently disabled.", ChatColor.GREEN);
return true;
}
if (args.length == 0)
{
return false;
}
FPlayer playerdata = plugin.pl.getPlayer(playerSender);
if (args[0].equalsIgnoreCase("draw"))
{
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));
}
else
{
playerdata.disarmMP44();
sender.sendMessage(ChatColor.GREEN + "mp44 Disarmed.");
}
return true;
}
}