Added option to have same Members, operators and owner settings

This commit is contained in:
Fabrizio La Rosa 2020-06-17 20:50:07 +02:00
parent 6f2adfad70
commit 808c3c06da
3 changed files with 15 additions and 2 deletions

View File

@ -1,6 +1,7 @@
package com.songoda.skyblock.permission; package com.songoda.skyblock.permission;
import com.songoda.skyblock.SkyBlock; import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.island.Island; import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandRole; import com.songoda.skyblock.island.IslandRole;
import com.songoda.skyblock.permission.event.Stoppable; import com.songoda.skyblock.permission.event.Stoppable;
@ -8,6 +9,7 @@ import com.songoda.skyblock.permission.permissions.basic.*;
import com.songoda.skyblock.permission.permissions.listening.*; import com.songoda.skyblock.permission.permissions.listening.*;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
@ -180,9 +182,18 @@ public class PermissionManager {
if (player.hasPermission("fabledskyblock.bypass." + permission.getName().toLowerCase())) if (player.hasPermission("fabledskyblock.bypass." + permission.getName().toLowerCase()))
return !reversePermission; return !reversePermission;
FileManager.Config config = SkyBlock.getInstance().getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
switch(island.getRole(player)){ switch(island.getRole(player)){
case Owner: case Owner:
if(configLoad.getBoolean("Island.Settings.OwnersAndOperatorsAsMembers", false)){
return island.hasPermission(IslandRole.Owner, permission);
}
case Operator: case Operator:
if(configLoad.getBoolean("Island.Settings.OwnersAndOperatorsAsMembers", false)){
return island.hasPermission(IslandRole.Operator, permission);
}
case Member: case Member:
return island.hasPermission(IslandRole.Member, permission); return island.hasPermission(IslandRole.Member, permission);
case Coop: case Coop:

View File

@ -90,7 +90,7 @@ Island:
Height: 60 Height: 60
Member: Member:
# Max amount of players allowed to be in a team. # Max amount of players allowed to be in a team.
Capacity: 12 Capacity: 12 # TODO Remove
Chat: Chat:
# If island chat should be output to console # If island chat should be output to console
OutputToConsole: true OutputToConsole: true
@ -299,6 +299,8 @@ Island:
Enable: true Enable: true
Hunger: Hunger:
Enable: false Enable: false
# If owners and operators should have same permission of members
OwnersAndOperatorsAsMembers: false
Portal: Portal:
# When disabled, when a player enters a portal, they will teleport to the nether or # When disabled, when a player enters a portal, they will teleport to the nether or
# end world rather than the island world. # end world rather than the island world.