9
0
mirror of https://github.com/WiIIiam278/HuskSync.git synced 2025-12-26 01:59:20 +00:00

Add configuration option to synchronise flight

This commit is contained in:
William
2021-12-03 16:39:25 +00:00
parent c710268182
commit 32a5004fc7
5 changed files with 10 additions and 2 deletions

View File

@@ -23,6 +23,7 @@ public class ConfigLoader {
Settings.syncGameMode = config.getBoolean("synchronisation_settings.game_mode", true);
Settings.syncAdvancements = config.getBoolean("synchronisation_settings.advancements", true);
Settings.syncLocation = config.getBoolean("synchronisation_settings.location", false);
Settings.syncFlight = config.getBoolean("synchronisation_settings.flight", false);
}
}

View File

@@ -191,9 +191,14 @@ public class PlayerSetter {
player.setGameMode(GameMode.valueOf(data.getGameMode()));
}
if (Settings.syncLocation) {
player.setFlying(player.getAllowFlight() && data.isFlying());
setPlayerLocation(player, DataSerializer.deserializePlayerLocationData(data.getSerializedLocation()));
}
if (Settings.syncFlight) {
if (data.isFlying()) {
player.setAllowFlight(true);
}
player.setFlying(player.getAllowFlight() && data.isFlying());
}
// Handle the SyncCompleteEvent
Bukkit.getPluginManager().callEvent(new SyncCompleteEvent(player, data));