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

View File

@ -67,7 +67,7 @@ public class DamagePermission extends ListeningPermission {
FileManager.Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
if (configLoad.getBoolean("Island.Settings.Damage.Enable", false)
|| !configLoad.getBoolean("Island.Damage.Enable", false)) {
event.setCancelled(true);

View File

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