Skip to content

Commit

Permalink
Command rewrite is a ago, starts #110
Browse files Browse the repository at this point in the history
  • Loading branch information
BlaneyXYZ committed Apr 10, 2015
1 parent 87fa8df commit ec63a4f
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 42 deletions.
42 changes: 0 additions & 42 deletions src/com/Jdbye/BukkitIRCd/commands/IRCWhoisCommand.java

This file was deleted.

44 changes: 44 additions & 0 deletions src/com/Jdbye/BukkitIRCd/commands/arguments/IRCWhoisCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.Jdbye.BukkitIRCd.commands.arguments;

import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import com.Jdbye.BukkitIRCd.IRCUser;
import com.Jdbye.BukkitIRCd.IRCUserManagement;

public class IRCWhoisCommand {

private CommandSender sender;
private String[] args;

public IRCWhoisCommand(CommandSender sender) {
this.sender = sender;
}

public boolean execute() {

final boolean oper;

if (sender instanceof Player) {
final Player player = (Player) sender;
oper = player.hasPermission("bukkitircd.oper");
} else {
oper = true;
}

if (args.length > 0) {
final IRCUser ircuser = IRCUserManagement.getIRCUser(args[0]);
if (ircuser != null) {
for (final String whoisline : IRCUserManagement.getIRCWhois(ircuser, oper)) {
sender.sendMessage(whoisline);
}
} else {
sender.sendMessage(ChatColor.RED + "That user is not online.");
}
return true;
} else {
return false;
}
}
}

0 comments on commit ec63a4f

Please sign in to comment.