first commit
This commit is contained in:
49
src/dev/pinfosec/pincount/commands/PAmount.java
Normal file
49
src/dev/pinfosec/pincount/commands/PAmount.java
Normal file
@@ -0,0 +1,49 @@
|
||||
package dev.pinfosec.pincount.commands;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import dev.pinfosec.pincount.Main;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
|
||||
public class PAmount implements CommandExecutor {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private Main plugin;
|
||||
|
||||
public PAmount(Main plugin) {
|
||||
this.plugin = plugin;
|
||||
plugin.getCommand("pa").setExecutor(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label,
|
||||
String[] args) {
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("Only players can run this command");
|
||||
return true;
|
||||
}
|
||||
if (args.length < 1 || args.length > 1) {
|
||||
sender.sendMessage("Usage: /pa {amount}");
|
||||
return true;
|
||||
}
|
||||
|
||||
int sum = Integer.valueOf(args[0]);
|
||||
int gbcount = (sum / 81);
|
||||
sum = (sum - (gbcount * 81));
|
||||
int gicount = (sum / 9);
|
||||
sum = (sum - (gicount * 9));
|
||||
int gncount = sum;
|
||||
|
||||
sender.sendMessage(ChatColor.DARK_GRAY + "==" + ChatColor.RESET + ChatColor.DARK_AQUA + "Gold Amount" + ChatColor.RESET + ChatColor.DARK_GRAY + "==");
|
||||
sender.sendMessage(ChatColor.GOLD + "GN: " + ChatColor.RESET + ChatColor.DARK_GRAY + String.valueOf(gncount));
|
||||
sender.sendMessage(ChatColor.GOLD + "GI: " + ChatColor.RESET + ChatColor.DARK_GRAY + String.valueOf(gicount));
|
||||
sender.sendMessage(ChatColor.GOLD + "GB: " + ChatColor.RESET + ChatColor.DARK_GRAY + String.valueOf(gbcount));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user