Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.Vextricity.sReport;
- import java.util.HashMap;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import org.bukkit.plugin.Plugin;
- import org.bukkit.plugin.java.JavaPlugin;
- public class newMain extends JavaPlugin
- {
- public HashMap<String, Long> cooldowns = new HashMap<String, Long>();
- public void onEnable()
- {
- Bukkit.getServer().getLogger().info("sReport has been enabled!");
- Bukkit.getServer().getLogger().info("sReport made by Vextricity!");
- }
- public void onDisable()
- {
- Bukkit.getServer().getLogger().info("sReport has been disabled!");
- }
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
- {
- if (!(sender instanceof Player))
- {
- Bukkit.getServer().getLogger().info("You must be a player to run this command!");
- }
- else
- {
- Player player = (Player) sender;
- if (cmd.getName().equalsIgnoreCase("report"))
- {
- if (player.hasPermission("sreport.report"))
- {
- if (args.length == 1)
- {
- if (args[0].equalsIgnoreCase("reload"))
- {
- if (player.hasPermission("sreport.reload"))
- {
- Plugin plugin = this.getServer().getPluginManager().getPlugin("sReport");
- getConfig();
- saveConfig();
- this.getServer().getPluginManager().disablePlugin(plugin);
- this.getServer().getPluginManager().enablePlugin(plugin);
- player.sendMessage(ChatColor.DARK_RED + "[sReport] " + ChatColor.RED + "This plugin has been reloaded!");
- }
- else
- {
- player.sendMessage(ChatColor.DARK_RED + "[sReport] " + ChatColor.RED + "You do not have permission to do this!");
- }
- }
- else
- {
- player.sendMessage(ChatColor.DARK_RED + "[sReport] " + ChatColor.RED + "Invalid Argument! Do /report <playername> <reason>");
- }
- }
- else if (args.length == 0)
- {
- player.sendMessage(ChatColor.DARK_RED + "[sReport] " + ChatColor.RED + "Invalid Argument! Do /report <playername> <reason>");
- }
- else if (args.length > 6)
- {
- player.sendMessage(ChatColor.DARK_RED + "[sReport] " + ChatColor.RED + "This plugin doesn't currently support arguments that long!");
- }
- else
- {
- if (args.length == 2)
- {
- int cooldownTime = getConfig().getInt("cooldownInSeconds");
- if (cooldowns.containsKey(sender.getName()))
- {
- long secondsLeft = ((cooldowns.get(sender.getName())/1000)+cooldownTime) - (System.currentTimeMillis()/1000);
- if (secondsLeft > 0)
- {
- sender.sendMessage(ChatColor.DARK_RED + "[sReport] " + ChatColor.RED + "You can't use this command for another " + ChatColor.DARK_RED + secondsLeft + ChatColor.RED + " seconds!");
- return true;
- }
- }
- cooldowns.put(sender.getName(), System.currentTimeMillis());
- if (args[0].equals(args[0]))
- {
- if (args[1].equals(args[1]))
- {
- player.sendMessage(ChatColor.DARK_RED + "[sReport] " + ChatColor.RED + "You have reported " + args[0] + " for " + args[1] + "! This player will be dealt with.");
- for (Player p : Bukkit.getServer().getOnlinePlayers())
- {
- if (p.hasPermission("sreport.recieve"))
- {
- p.sendMessage(ChatColor.DARK_RED + "[sReport] " + ChatColor.RED + args[0] + " has been reported for " + args[1] + "!");
- }
- }
- }
- }
- }
- else if (args.length == 3)
- {
- int cooldownTime = getConfig().getInt("cooldownInSeconds");
- if (cooldowns.containsKey(sender.getName()))
- {
- long secondsLeft = ((cooldowns.get(sender.getName())/1000)+cooldownTime) - (System.currentTimeMillis()/1000);
- if (secondsLeft > 0)
- {
- sender.sendMessage(ChatColor.DARK_RED + "[sReport] " + ChatColor.RED + "You can't use this command for another " + ChatColor.DARK_RED + secondsLeft + ChatColor.RED + " seconds!");
- return true;
- }
- }
- cooldowns.put(sender.getName(), System.currentTimeMillis());
- if (args[0].equals(args[0]))
- {
- if (args[1].equals(args[1]))
- {
- if (args[2].equals(args[2]))
- {
- player.sendMessage(ChatColor.DARK_RED + "[sReport] " + ChatColor.RED + "You have reported " + args[0] + " for " + args[1] + " " + args[2] + "! This player will be dealt with.");
- for (Player p : Bukkit.getServer().getOnlinePlayers())
- {
- if (p.hasPermission("sreport.recieve"))
- {
- p.sendMessage(ChatColor.DARK_RED + "[sReport] " + ChatColor.RED + args[0] + " has been reported for " + args[1] + " " + args[2] + "!");
- }
- }
- }
- }
- }
- }
- else if (args.length == 4)
- {
- int cooldownTime = getConfig().getInt("cooldownInSeconds");
- if (cooldowns.containsKey(sender.getName()))
- {
- long secondsLeft = ((cooldowns.get(sender.getName())/1000)+cooldownTime) - (System.currentTimeMillis()/1000);
- if (secondsLeft > 0)
- {
- sender.sendMessage(ChatColor.DARK_RED + "[sReport] " + ChatColor.RED + "You can't use this command for another " + ChatColor.DARK_RED + secondsLeft + ChatColor.RED + " seconds!");
- return true;
- }
- }
- cooldowns.put(sender.getName(), System.currentTimeMillis());
- if (args[0].equals(args[0]))
- {
- if (args[1].equals(args[1]))
- {
- if (args[2].equals(args[2]))
- {
- if (args[3].equals(args[3]))
- {
- player.sendMessage(ChatColor.DARK_RED + "[sReport] " + ChatColor.RED + args[0] + " has been reported for " + args[1] + " " + args[2] + " " + args[3] + "! This player will be dealt with.");
- for (Player p : Bukkit.getServer().getOnlinePlayers())
- {
- if (p.hasPermission("sreport.recieve"))
- {
- p.sendMessage(ChatColor.DARK_RED + "[sReport] " + ChatColor.RED + args[0] + " has been reported for " + args[1] + " " + args[2] + " " + args[3] + "!");
- }
- }
- }
- }
- }
- }
- }
- else if (args.length == 5)
- {
- int cooldownTime = getConfig().getInt("cooldownInSeconds");
- if (cooldowns.containsKey(sender.getName()))
- {
- long secondsLeft = ((cooldowns.get(sender.getName())/1000)+cooldownTime) - (System.currentTimeMillis()/1000);
- if (secondsLeft > 0)
- {
- sender.sendMessage(ChatColor.DARK_RED + "[sReport] " + ChatColor.RED + "You can't use this command for another " + ChatColor.DARK_RED + secondsLeft + ChatColor.RED + " seconds!");
- return true;
- }
- }
- cooldowns.put(sender.getName(), System.currentTimeMillis());
- if (args[1].equals(args[1]))
- {
- if (args[2].equals(args[2]))
- {
- if (args[3].equals(args[3]))
- {
- if (args[4].equals(args[4]))
- {
- player.sendMessage(ChatColor.DARK_RED + "[sReport] " + ChatColor.RED + args[0] + " has been reported for " + args[1] + " " + args[2] + " " + args[3] + " " + args[4] + "! This player will be dealt with.");
- for (Player p : Bukkit.getServer().getOnlinePlayers())
- {
- if (p.hasPermission("sreport.recieve"))
- {
- p.sendMessage(ChatColor.DARK_RED + "[sReport] " + ChatColor.RED + args[0] + " has been reported for " + args[1] + " " + args[2] + " " + args[3] + " " + args[4] + "!");
- }
- }
- }
- }
- }
- }
- }
- else if (args.length == 6)
- {
- int cooldownTime = getConfig().getInt("cooldownInSeconds");
- if (cooldowns.containsKey(sender.getName()))
- {
- long secondsLeft = ((cooldowns.get(sender.getName())/1000)+cooldownTime) - (System.currentTimeMillis()/1000);
- if (secondsLeft > 0)
- {
- sender.sendMessage(ChatColor.DARK_RED + "[sReport] " + ChatColor.RED + "You can't use this command for another " + ChatColor.DARK_RED + secondsLeft + ChatColor.RED + " seconds!");
- return true;
- }
- }
- cooldowns.put(sender.getName(), System.currentTimeMillis());
- if (args[1].equals(args[1]))
- {
- if (args[2].equals(args[2]))
- {
- if (args[3].equals(args[3]))
- {
- if (args[4].equals(args[4]))
- {
- if (args[5].equals(args[5]))
- {
- player.sendMessage(ChatColor.DARK_RED + "[sReport] " + ChatColor.RED + args[0] + " has been reported for " + args[1] + " " + args[2] + " " + args[3] + " " + args[4] + " " + args[5] + "! This player will be dealt with.");
- for (Player p : Bukkit.getServer().getOnlinePlayers())
- {
- if (p.hasPermission("sreport.recieve"))
- {
- p.sendMessage(ChatColor.DARK_RED + "[sReport] " + ChatColor.RED + args[0] + " has been reported for " + args[1] + " " + args[2] + " " + args[3] + " " + args[4] + " " + args[5] + "!");
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- else
- {
- player.sendMessage(ChatColor.RED + "You do not have permission to do this!");
- }
- }
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement