aboutsummaryrefslogtreecommitdiff
path: root/spark-sponge/src/main/java/me/lucko/spark/sponge/SpongeCommandSender.java
diff options
context:
space:
mode:
authorLuck <git@lucko.me>2019-12-03 14:35:07 +0000
committerLuck <git@lucko.me>2019-12-03 14:35:07 +0000
commit03b6f817f89275e4d5c3d5b1868c3dcc861bf146 (patch)
tree669fa3086044d5fe9662d161e67866a50734d430 /spark-sponge/src/main/java/me/lucko/spark/sponge/SpongeCommandSender.java
parentba1e2a04ddb56f183ac39323ca44733748cb43fd (diff)
downloadspark-03b6f817f89275e4d5c3d5b1868c3dcc861bf146.tar.gz
spark-03b6f817f89275e4d5c3d5b1868c3dcc861bf146.tar.bz2
spark-03b6f817f89275e4d5c3d5b1868c3dcc861bf146.zip
Some cleanup & refactoring
Diffstat (limited to 'spark-sponge/src/main/java/me/lucko/spark/sponge/SpongeCommandSender.java')
-rw-r--r--spark-sponge/src/main/java/me/lucko/spark/sponge/SpongeCommandSender.java31
1 files changed, 8 insertions, 23 deletions
diff --git a/spark-sponge/src/main/java/me/lucko/spark/sponge/SpongeCommandSender.java b/spark-sponge/src/main/java/me/lucko/spark/sponge/SpongeCommandSender.java
index 6f2c3a2..ca0d5d2 100644
--- a/spark-sponge/src/main/java/me/lucko/spark/sponge/SpongeCommandSender.java
+++ b/spark-sponge/src/main/java/me/lucko/spark/sponge/SpongeCommandSender.java
@@ -20,7 +20,7 @@
package me.lucko.spark.sponge;
-import me.lucko.spark.common.CommandSender;
+import me.lucko.spark.common.command.sender.AbstractCommandSender;
import net.kyori.text.Component;
import net.kyori.text.adapter.spongeapi.TextAdapter;
import org.spongepowered.api.command.CommandSource;
@@ -28,46 +28,31 @@ import org.spongepowered.api.entity.living.player.Player;
import java.util.UUID;
-public class SpongeCommandSender implements CommandSender {
- private final CommandSource source;
-
+public class SpongeCommandSender extends AbstractCommandSender<CommandSource> {
public SpongeCommandSender(CommandSource source) {
- this.source = source;
+ super(source);
}
@Override
public String getName() {
- return this.source.getName();
+ return super.delegate.getName();
}
@Override
public UUID getUniqueId() {
- if (this.source instanceof Player) {
- return ((Player) this.source).getUniqueId();
+ if (super.delegate instanceof Player) {
+ return ((Player) super.delegate).getUniqueId();
}
return null;
}
@Override
public void sendMessage(Component message) {
- TextAdapter.sendComponent(this.source, message);
+ TextAdapter.sendComponent(super.delegate, message);
}
@Override
public boolean hasPermission(String permission) {
- return this.source.hasPermission(permission);
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- SpongeCommandSender that = (SpongeCommandSender) o;
- return this.source.equals(that.source);
- }
-
- @Override
- public int hashCode() {
- return this.source.hashCode();
+ return super.delegate.hasPermission(permission);
}
}