Add configuration option to synchronise flight

feat/data-edit-commands
William 3 years ago
parent c710268182
commit 32a5004fc7

@ -11,7 +11,7 @@ plugins {
allprojects { allprojects {
group 'me.William278' group 'me.William278'
version '1.1.2' version '1.1.3'
compileJava { options.encoding = 'UTF-8' } compileJava { options.encoding = 'UTF-8' }
tasks.withType(JavaCompile) { options.encoding = 'UTF-8' } tasks.withType(JavaCompile) { options.encoding = 'UTF-8' }

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

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

@ -13,5 +13,6 @@ synchronisation_settings:
game_mode: true game_mode: true
advancements: true advancements: true
location: false location: false
flight: false
cluster_id: 'main' cluster_id: 'main'
check_for_updates: true check_for_updates: true

@ -65,6 +65,7 @@ public class Settings {
public static boolean syncGameMode; public static boolean syncGameMode;
public static boolean syncAdvancements; public static boolean syncAdvancements;
public static boolean syncLocation; public static boolean syncLocation;
public static boolean syncFlight;
// This Cluster ID // This Cluster ID
public static String cluster; public static String cluster;

Loading…
Cancel
Save