diff options
author | Luck <git@lucko.me> | 2019-12-03 14:35:07 +0000 |
---|---|---|
committer | Luck <git@lucko.me> | 2019-12-03 14:35:07 +0000 |
commit | 03b6f817f89275e4d5c3d5b1868c3dcc861bf146 (patch) | |
tree | 669fa3086044d5fe9662d161e67866a50734d430 /spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitCommandSender.java | |
parent | ba1e2a04ddb56f183ac39323ca44733748cb43fd (diff) | |
download | spark-03b6f817f89275e4d5c3d5b1868c3dcc861bf146.tar.gz spark-03b6f817f89275e4d5c3d5b1868c3dcc861bf146.tar.bz2 spark-03b6f817f89275e4d5c3d5b1868c3dcc861bf146.zip |
Some cleanup & refactoring
Diffstat (limited to 'spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitCommandSender.java')
-rw-r--r-- | spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitCommandSender.java | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitCommandSender.java b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitCommandSender.java index d353845..8bfc015 100644 --- a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitCommandSender.java +++ b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitCommandSender.java @@ -20,53 +20,40 @@ package me.lucko.spark.bukkit; -import me.lucko.spark.common.CommandSender; + +import me.lucko.spark.common.command.sender.AbstractCommandSender; import net.kyori.text.Component; import net.kyori.text.adapter.bukkit.TextAdapter; +import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import java.util.UUID; -public class BukkitCommandSender implements CommandSender { - private final org.bukkit.command.CommandSender sender; - - public BukkitCommandSender(org.bukkit.command.CommandSender sender) { - this.sender = sender; +public class BukkitCommandSender extends AbstractCommandSender<CommandSender> { + public BukkitCommandSender(CommandSender sender) { + super(sender); } @Override public String getName() { - return this.sender.getName(); + return this.delegate.getName(); } @Override public UUID getUniqueId() { - if (this.sender instanceof Player) { - return ((Player) this.sender).getUniqueId(); + if (super.delegate instanceof Player) { + return ((Player) super.delegate).getUniqueId(); } return null; } @Override public void sendMessage(Component message) { - TextAdapter.sendComponent(this.sender, message); + TextAdapter.sendComponent(super.delegate, message); } @Override public boolean hasPermission(String permission) { - return this.sender.hasPermission(permission); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - BukkitCommandSender that = (BukkitCommandSender) o; - return this.sender.equals(that.sender); - } - - @Override - public int hashCode() { - return this.sender.hashCode(); + return super.delegate.hasPermission(permission); } } |