[Fixed] Player's /is settings was not saving.

[Fixed] Ops were not able to fly on ISLAND unless /GMC. Now They can still fly if Fly upgrade is disabled.
This commit is contained in:
TeamHR 2024-03-01 10:50:42 +05:30
parent 9c2da8c669
commit 383a21ef7a
4 changed files with 28 additions and 11 deletions

21
pom.xml
View File

@ -159,7 +159,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<artifactId>spigot-api</artifactId>
<version>1.20.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
@ -198,6 +198,25 @@
<version>7.2.18</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.mojang/authlib -->
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>3.16.29</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/io.netty/netty-all -->
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.107.Final</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-lang/commons-lang -->
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>com.eatthepath</groupId>

View File

@ -112,7 +112,7 @@ public class IslandManager {
* @deprecated use {@link #updateFlight(Player)} instead
*/
@Deprecated
public void giveUgrades(Player player, Island island) {
public void giveUpgrades(Player player, Island island) {
Preconditions.checkArgument(player != null, "Cannot give upgrades to null player");
Preconditions.checkArgument(island != null, "Cannot give upgrades to null island");

View File

@ -113,7 +113,7 @@ public class Island {
this.level = new IslandLevel(getOwnerUUID(), this.plugin);
File configFile = new File(this.plugin.getDataFolder().toString() + "/island-data");
File configFile = new File(this.plugin.getDataFolder() + "/island-data");
Config config = fileManager.getConfig(new File(configFile, this.ownerUUID + ".yml"));
@ -191,7 +191,7 @@ public class Island {
Config settingsDataConfig = null;
File settingDataFile = new File(this.plugin.getDataFolder().toString() + "/setting-data", getOwnerUUID().toString() + ".yml");
File settingDataFile = new File(this.plugin.getDataFolder() + "/setting-data", getOwnerUUID().toString() + ".yml");
if (fileManager.isFileExist(settingDataFile)) {
settingsDataConfig = fileManager.getConfig(settingDataFile);
@ -203,13 +203,13 @@ public class Island {
for (BasicPermission permission : allPermissions) {
if (settingsDataConfig == null || settingsDataConfig.getFileConfiguration()
.getString("Settings." + roleList.getFriendlyName() + "." + permission.getName()) == null) {
.getString("Settings." + roleList.getFriendlyName().toUpperCase() + "." + permission.getName()) == null) {
permissions.add(
new IslandPermission(permission, this.plugin.getSettings()
.getBoolean("Settings." + roleList.getFriendlyName() + "." + permission.getName(), true)));
.getBoolean("Settings." + roleList.getFriendlyName().toUpperCase() + "." + permission.getName(), true)));
} else {
permissions.add(new IslandPermission(permission, settingsDataConfig.getFileConfiguration()
.getBoolean("Settings." + roleList.getFriendlyName() + "." + permission.getName(), true)));
.getBoolean("Settings." + roleList.getFriendlyName().toUpperCase() + "." + permission.getName(), true)));
}
}

View File

@ -1530,9 +1530,7 @@ public class IslandManager {
public void updateFlight(Player player) {
// The player can fly in other worlds if they are in creative or have another
// plugin's fly permission.
if (player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR || player.hasPermission("essentials.fly") || player.hasPermission("cmi.command.fly")) {
return;
}
// Merged this with final if block as OPs were not able to fly.
// Residence support
if (Bukkit.getServer().getPluginManager().getPlugin("Residence") != null) {
@ -1562,7 +1560,7 @@ public class IslandManager {
boolean hasGlobalFlyPermission = player.hasPermission("fabledskyblock.*") || player.hasPermission("fabledskyblock.fly.*");
boolean hasOwnIslandFlyPermission = player.hasPermission("fabledskyblock.fly") && island.getRole(player) != null && island.getRole(player) != IslandRole.VISITOR;
if (hasGlobalFlyPermission || hasOwnIslandFlyPermission) {
if (hasGlobalFlyPermission || hasOwnIslandFlyPermission || player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR || player.hasPermission("essentials.fly") || player.hasPermission("cmi.command.fly")) {
WorldManager worldManager = this.plugin.getWorldManager();
boolean canFlyInWorld = worldManager.isIslandWorld(player.getWorld());
Bukkit.getServer().getScheduler().runTask(this.plugin, () -> player.setAllowFlight(canFlyInWorld));