Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.JakeDGator.RcSlap;
- import java.util.ArrayList;
- import java.util.List;
- 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.java.JavaPlugin;
- //###Developer Notes##
- //RcPing is a custom made plugin to test lag for REALMCRAFT Revised (http://www.mcrealm.net)
- //How versions work: Each change to a plugin that is small, counts as + 0.0.1, which I start out with 1.0.0
- //Example: If I want to fix a error message, that would count as one. Also if I changed a permission node, that would be one.
- //So the version would be 1.0.2, and the scale goes up to 10, so it would not be 1.0.10, but 1.1.0
- public class Main extends JavaPlugin{
- List<String> cooldown = new ArrayList<String>();
- public void onEnable(){
- getLogger().info("RcSlap V.1.0.0 has been Enabled");
- }
- public void onDisable(){
- getLogger().info("RcSlap V.1.0.0 has been Disabled");
- }
- public boolean onCommand(CommandSender sender, Command command, String alias, String[] args) {
- final Player player = (Player) sender;
- if (alias.equalsIgnoreCase("slap")){
- //We need 1 argument for the player
- if (args.length < 1){
- sender.sendMessage(ChatColor.RED + "Error: " + ChatColor.DARK_RED + "Missing args: Player");
- }
- if (!cooldown.contains(player.getName())){
- cooldown.add(player.getName());
- Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
- public void run() {
- cooldown.remove(player.getName());
- }
- }, 200);
- }
- else{
- sender.sendMessage(ChatColor.RED + "You must wait before you can slap again!");
- }
- return false;
- }
- Player target = Bukkit.getPlayer(args[0]);
- if (target == null){
- //Player is not online
- sender.sendMessage(ChatColor.RED + "Error: " + ChatColor.DARK_RED + "Player not found. Must be online");
- return false;
- }
- sender.sendMessage(ChatColor.AQUA + "You have slapped " + ChatColor.DARK_AQUA + target.getName() + ChatColor.AQUA + " and they enjoyed it! Ohhhhh!" );
- target.sendMessage(ChatColor.YELLOW + "You were slapped by " + sender.getName() + ChatColor.YELLOW + " and ENJOYED IT! >:)");
- target.damage(0);
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement