mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-22 10:36:09 +01:00
Save on Bungee server switch, fixes #1906
This commit is contained in:
parent
83c720c021
commit
34eb2e458a
@ -21,10 +21,23 @@ public class BungeePlayerListener implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerLogin(ServerSwitchEvent evt) {
|
||||
public void onPlayerLoginOrSwitch(ServerSwitchEvent evt) {
|
||||
if (evt.getFrom() != null) {
|
||||
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
final DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream);
|
||||
try {
|
||||
System.out.println("Saved player data");
|
||||
dataOutputStream.writeUTF("SaveData:" + evt.getPlayer().getUniqueId());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
dispatchMessage(byteArrayOutputStream.toByteArray());
|
||||
}
|
||||
|
||||
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
final DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream);
|
||||
try {
|
||||
System.out.println("Loaded player data");
|
||||
dataOutputStream.writeUTF("LoadData:" + evt.getPlayer().getUniqueId());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@ -37,6 +50,7 @@ public class BungeePlayerListener implements Listener {
|
||||
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
final DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream);
|
||||
try {
|
||||
System.out.println("Saved player data");
|
||||
dataOutputStream.writeUTF("SaveData:" + evt.getPlayer().getUniqueId());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
Loading…
Reference in New Issue
Block a user