-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Command rewrite is a ago, starts #110
- Loading branch information
Showing
2 changed files
with
44 additions
and
42 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
src/com/Jdbye/BukkitIRCd/commands/arguments/IRCWhoisCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} |