mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-29 05:35:13 +01:00
Merge branch 'development'
This commit is contained in:
commit
45e79dcfd4
2
pom.xml
2
pom.xml
@ -5,7 +5,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>skyblock</artifactId>
|
<artifactId>skyblock</artifactId>
|
||||||
<version>2.3.17</version>
|
<version>2.3.18</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
@ -102,19 +102,19 @@ public class PermissionManager {
|
|||||||
new MainSpawnPermission(),
|
new MainSpawnPermission(),
|
||||||
new VisitorSpawnPermission());
|
new VisitorSpawnPermission());
|
||||||
|
|
||||||
if(plugin.getConfiguration().getBoolean("Island.Settings.KeepItemsOnDeath.Enable")){
|
if (plugin.getConfiguration().getBoolean("Island.Settings.KeepItemsOnDeath.Enable")) {
|
||||||
registerPermission(new KeepItemsOnDeathPermission());
|
registerPermission(new KeepItemsOnDeathPermission());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(plugin.getConfiguration().getBoolean("Island.Settings.PvP.Enable")){
|
if (plugin.getConfiguration().getBoolean("Island.Settings.PvP.Enable")) {
|
||||||
registerPermission(new PvpPermission(plugin));
|
registerPermission(new PvpPermission(plugin));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(plugin.getConfiguration().getBoolean("Island.Settings.Damage.Enable")){
|
if (plugin.getConfiguration().getBoolean("Island.Settings.Damage.Enable")) {
|
||||||
registerPermission(new DamagePermission(plugin));
|
registerPermission(new DamagePermission(plugin));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(plugin.getConfiguration().getBoolean("Island.Settings.Hunger.Enable")){
|
if (plugin.getConfiguration().getBoolean("Island.Settings.Hunger.Enable")) {
|
||||||
registerPermission(new HungerPermission(plugin));
|
registerPermission(new HungerPermission(plugin));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,29 +123,29 @@ public class PermissionManager {
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void updateSettingsConfig(BasicPermission permission){
|
private synchronized void updateSettingsConfig(BasicPermission permission) {
|
||||||
FileManager.Config settingsConfig = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "settings.yml"));
|
FileManager.Config settingsConfig = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "settings.yml"));
|
||||||
FileConfiguration settingsConfigLoad = settingsConfig.getFileConfiguration();
|
FileConfiguration settingsConfigLoad = settingsConfig.getFileConfiguration();
|
||||||
|
|
||||||
switch (permission.getType()){
|
switch (permission.getType()) {
|
||||||
case GENERIC:
|
case GENERIC:
|
||||||
if(settingsConfigLoad.getString("Settings.Visitor." + permission.getName()) == null){
|
if (settingsConfigLoad.getString("Settings.Visitor." + permission.getName()) == null) {
|
||||||
settingsConfigLoad.set("Settings.Visitor." + permission.getName(), true);
|
settingsConfigLoad.set("Settings.Visitor." + permission.getName(), true);
|
||||||
}
|
}
|
||||||
if(settingsConfigLoad.getString("Settings.Member." + permission.getName()) == null){
|
if (settingsConfigLoad.getString("Settings.Member." + permission.getName()) == null) {
|
||||||
settingsConfigLoad.set("Settings.Member." + permission.getName(), true);
|
settingsConfigLoad.set("Settings.Member." + permission.getName(), true);
|
||||||
}
|
}
|
||||||
if(settingsConfigLoad.getString("Settings.Coop." + permission.getName()) == null){
|
if (settingsConfigLoad.getString("Settings.Coop." + permission.getName()) == null) {
|
||||||
settingsConfigLoad.set("Settings.Coop." + permission.getName(), true);
|
settingsConfigLoad.set("Settings.Coop." + permission.getName(), true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OPERATOR:
|
case OPERATOR:
|
||||||
if(settingsConfigLoad.getString("Settings.Operator." + permission.getName()) == null){
|
if (settingsConfigLoad.getString("Settings.Operator." + permission.getName()) == null) {
|
||||||
settingsConfigLoad.set("Settings.Operator." + permission.getName(), true);
|
settingsConfigLoad.set("Settings.Operator." + permission.getName(), true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ISLAND:
|
case ISLAND:
|
||||||
if(settingsConfigLoad.getString("Settings.Owner." + permission.getName()) == null){
|
if (settingsConfigLoad.getString("Settings.Owner." + permission.getName()) == null) {
|
||||||
settingsConfigLoad.set("Settings.Owner." + permission.getName(), true);
|
settingsConfigLoad.set("Settings.Owner." + permission.getName(), true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -214,7 +214,7 @@ public class PermissionManager {
|
|||||||
return !cancellable.isCancelled();
|
return !cancellable.isCancelled();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasPermission(Player player, Island island, BasicPermission permission, boolean reversePermission){
|
public boolean hasPermission(Player player, Island island, BasicPermission permission, boolean reversePermission) {
|
||||||
if (player == null)
|
if (player == null)
|
||||||
return island.hasPermission(IslandRole.Owner, permission);
|
return island.hasPermission(IslandRole.Owner, permission);
|
||||||
|
|
||||||
@ -223,18 +223,18 @@ public class PermissionManager {
|
|||||||
|
|
||||||
FileConfiguration configLoad = SkyBlock.getInstance().getConfiguration();
|
FileConfiguration configLoad = SkyBlock.getInstance().getConfiguration();
|
||||||
|
|
||||||
switch(island.getRole(player)){
|
switch (island.getRole(player)) {
|
||||||
case Owner:
|
case Owner:
|
||||||
if(!configLoad.getBoolean("Island.Settings.OwnersAndOperatorsAsMembers", false)){
|
if (!configLoad.getBoolean("Island.Settings.OwnersAndOperatorsAsMembers", false)) {
|
||||||
if(permission.getType().equals(PermissionType.ISLAND)) {
|
if (permission.getType().equals(PermissionType.ISLAND)) {
|
||||||
return island.hasPermission(IslandRole.Owner, permission);
|
return island.hasPermission(IslandRole.Owner, permission);
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case Operator:
|
case Operator:
|
||||||
if(!configLoad.getBoolean("Island.Settings.OwnersAndOperatorsAsMembers", false)){
|
if (!configLoad.getBoolean("Island.Settings.OwnersAndOperatorsAsMembers", false)) {
|
||||||
if(permission.getType().equals(PermissionType.OPERATOR)) {
|
if (permission.getType().equals(PermissionType.OPERATOR)) {
|
||||||
return island.hasPermission(IslandRole.Operator, permission);
|
return island.hasPermission(IslandRole.Operator, permission);
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
@ -251,18 +251,21 @@ public class PermissionManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasPermission(Player player, Island island, BasicPermission permission) {
|
public boolean hasPermission(Player player, Island island, BasicPermission permission) {
|
||||||
|
if (island == null)
|
||||||
|
return true; // Return true as there is no island, we don't have to modify the normal world behavior.
|
||||||
return this.hasPermission(player, island, permission, false);
|
return this.hasPermission(player, island, permission, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasPermission(Location location, String permission, IslandRole islandRole) {
|
public boolean hasPermission(Location location, String permission, IslandRole islandRole) {
|
||||||
Island island = plugin.getIslandManager().getIslandAtLocation(location);
|
Island island = plugin.getIslandManager().getIslandAtLocation(location);
|
||||||
if(island != null) {
|
if (island == null)
|
||||||
return island.hasPermission(islandRole, getPermission(permission));
|
return true; // Return true as there is no island, we don't have to modify the normal world behavior.
|
||||||
}
|
return island.hasPermission(islandRole, getPermission(permission));
|
||||||
return true; // Return true as there is no island, we don't have to modify the normal world behavior
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasPermission(Island island, String permission, IslandRole islandRole) {
|
public boolean hasPermission(Island island, String permission, IslandRole islandRole) {
|
||||||
|
if (island == null)
|
||||||
|
return true; // Return true as there is no island, we don't have to modify the normal world behavior.
|
||||||
return island.hasPermission(islandRole, getPermission(permission));
|
return island.hasPermission(islandRole, getPermission(permission));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user