2013-10-16 19:59:39 +00:00
|
|
|
package com.earth2me.essentials;
|
|
|
|
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
|
|
|
|
2015-10-27 17:34:59 +00:00
|
|
|
public class CommandSource {
|
2015-04-15 04:06:16 +00:00
|
|
|
protected CommandSender sender;
|
|
|
|
|
|
|
|
public CommandSource(final CommandSender base) {
|
|
|
|
this.sender = base;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final CommandSender getSender() {
|
|
|
|
return sender;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Player getPlayer() {
|
|
|
|
if (sender instanceof Player) {
|
|
|
|
return (Player) sender;
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final boolean isPlayer() {
|
|
|
|
return (sender instanceof Player);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final CommandSender setSender(final CommandSender base) {
|
|
|
|
return this.sender = base;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void sendMessage(String message) {
|
|
|
|
if (!message.isEmpty()) {
|
|
|
|
sender.sendMessage(message);
|
|
|
|
}
|
|
|
|
}
|
2013-10-16 19:59:39 +00:00
|
|
|
}
|