mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 20:29:20 +00:00
![Ali Moghnieh](/assets/img/avatar_default.png)
This commit adds a new boolean-configurable feature called last-message-reply-recipient, defaults to true for new installs and false for old installs, which states whether to use the new messaging functionality or not. This commit deprecates Console#getCommandSender(Server) and provides Console#getInstance()#getCommandSender() for future usability.
39 lines
830 B
Java
39 lines
830 B
Java
package com.earth2me.essentials;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
|
public class CommandSource {
|
|
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);
|
|
}
|
|
}
|
|
}
|