mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-30 04:27:50 +01:00
Use ByteStreams from Guava
This commit is contained in:
parent
3253b43a63
commit
dff4e6d135
@ -24,6 +24,9 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class ProcessSyncronousPlayerLogin implements Runnable {
|
||||
@ -118,8 +121,7 @@ public class ProcessSyncronousPlayerLogin implements Runnable {
|
||||
}
|
||||
|
||||
protected void sendBungeeMessage() {
|
||||
ByteArrayOutputStream b = new ByteArrayOutputStream();
|
||||
DataOutputStream out = new DataOutputStream(b);
|
||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
try {
|
||||
String str = "AuthMe;login;" + name;
|
||||
out.writeUTF("Forward");
|
||||
@ -127,7 +129,7 @@ public class ProcessSyncronousPlayerLogin implements Runnable {
|
||||
out.writeUTF("AuthMe");
|
||||
out.writeShort(str.length());
|
||||
out.writeUTF(str);
|
||||
player.sendPluginMessage(plugin, "BungeeCord", b.toByteArray());
|
||||
player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
|
||||
} catch (Exception e)
|
||||
{}
|
||||
}
|
||||
|
@ -20,6 +20,9 @@ import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class ProcessSyncronousPlayerLogout implements Runnable {
|
||||
@ -43,8 +46,7 @@ public class ProcessSyncronousPlayerLogout implements Runnable {
|
||||
}
|
||||
|
||||
protected void sendBungeeMessage() {
|
||||
ByteArrayOutputStream b = new ByteArrayOutputStream();
|
||||
DataOutputStream out = new DataOutputStream(b);
|
||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
try {
|
||||
String str = "AuthMe;logout;" + name;
|
||||
out.writeUTF("Forward");
|
||||
@ -52,7 +54,7 @@ public class ProcessSyncronousPlayerLogout implements Runnable {
|
||||
out.writeUTF("AuthMe");
|
||||
out.writeShort(str.length());
|
||||
out.writeUTF(str);
|
||||
player.sendPluginMessage(plugin, "BungeeCord", b.toByteArray());
|
||||
player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
|
||||
} catch (Exception e)
|
||||
{}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user