mirror of
https://github.com/PikaMug/Quests.git
synced 2025-02-18 05:21:20 +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
|
@EventHandler
|
||||||
public void onPlayerLogin(ServerSwitchEvent evt) {
|
public void onPlayerLoginOrSwitch(ServerSwitchEvent evt) {
|
||||||
|
if (evt.getFrom() != null) {
|
||||||
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||||
final DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream);
|
final DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream);
|
||||||
try {
|
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());
|
dataOutputStream.writeUTF("LoadData:" + evt.getPlayer().getUniqueId());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -37,6 +50,7 @@ public class BungeePlayerListener implements Listener {
|
|||||||
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||||
final DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream);
|
final DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream);
|
||||||
try {
|
try {
|
||||||
|
System.out.println("Saved player data");
|
||||||
dataOutputStream.writeUTF("SaveData:" + evt.getPlayer().getUniqueId());
|
dataOutputStream.writeUTF("SaveData:" + evt.getPlayer().getUniqueId());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
Loading…
Reference in New Issue
Block a user