Use Lombok Delegate
This commit is contained in:
parent
490233e832
commit
0a0c2dbe1b
@ -3,6 +3,7 @@ package eu.mikroskeem.utils.bukkit;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import lombok.Getter;
|
||||
import lombok.experimental.Delegate;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
@ -13,7 +14,7 @@ import org.bukkit.plugin.Plugin;
|
||||
* You can use this like you would write normal plugin messages.
|
||||
*/
|
||||
public class PluginMessage implements AutoCloseable,ByteArrayDataOutput {
|
||||
@Getter
|
||||
@Getter @Delegate
|
||||
private ByteArrayDataOutput pluginMessage = ByteStreams.newDataOutput();
|
||||
private String channel;
|
||||
private Player player;
|
||||
@ -33,52 +34,6 @@ public class PluginMessage implements AutoCloseable,ByteArrayDataOutput {
|
||||
plugin.getServer().getMessenger().registerOutgoingPluginChannel(plugin, channel);
|
||||
}
|
||||
}
|
||||
@Override public void write(int b) {
|
||||
pluginMessage.write(b);
|
||||
}
|
||||
@Override public void write(byte[] b) {
|
||||
pluginMessage.write(b);
|
||||
}
|
||||
@Override public void write(byte[] b, int off, int len) {
|
||||
pluginMessage.write(b, off, len);
|
||||
}
|
||||
@Override public void writeBoolean(boolean v) {
|
||||
pluginMessage.writeBoolean(v);
|
||||
}
|
||||
@Override public void writeByte(int v) {
|
||||
pluginMessage.writeByte(v);
|
||||
}
|
||||
@Override public void writeShort(int v) {
|
||||
pluginMessage.writeShort(v);
|
||||
}
|
||||
@Override public void writeChar(int v) {
|
||||
pluginMessage.writeChar(v);
|
||||
}
|
||||
@Override public void writeInt(int v) {
|
||||
pluginMessage.writeInt(v);
|
||||
}
|
||||
@Override public void writeLong(long v) {
|
||||
pluginMessage.writeLong(v);
|
||||
}
|
||||
@Override public void writeFloat(float v) {
|
||||
pluginMessage.writeFloat(v);
|
||||
}
|
||||
@Override public void writeDouble(double v) {
|
||||
pluginMessage.writeDouble(v);
|
||||
}
|
||||
@Override public void writeChars(String s) {
|
||||
pluginMessage.writeChars(s);
|
||||
}
|
||||
@Override public void writeUTF(String s) {
|
||||
pluginMessage.writeUTF(s);
|
||||
}
|
||||
@Override @SuppressWarnings("deprecation")
|
||||
public void writeBytes(String s) {
|
||||
pluginMessage.writeBytes(s);
|
||||
}
|
||||
@Override public byte[] toByteArray() {
|
||||
return pluginMessage.toByteArray();
|
||||
}
|
||||
@Override public void close() {
|
||||
player.sendPluginMessage(plugin, channel, pluginMessage.toByteArray());
|
||||
if(!wasChannelRegistered){
|
||||
|
Loading…
Reference in New Issue
Block a user