Merge remote-tracking branch '0ft3n/master' into develop
This commit is contained in:
@@ -16,4 +16,36 @@ public class ConfigYml extends YamlBaseConfig {
|
|||||||
public ConfigYml(@NotNull final EcoPlugin plugin) {
|
public ConfigYml(@NotNull final EcoPlugin plugin) {
|
||||||
super("config", true, plugin);
|
super("config", true, plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Config.yml.
|
||||||
|
*
|
||||||
|
* @param plugin The plugin.
|
||||||
|
* @param removeUnused Remove unused.
|
||||||
|
*/
|
||||||
|
public ConfigYml(@NotNull final EcoPlugin plugin, boolean removeUnused) {
|
||||||
|
super("config", removeUnused, plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Config.yml.
|
||||||
|
*
|
||||||
|
* @param plugin The plugin.
|
||||||
|
* @param name The config name.
|
||||||
|
*/
|
||||||
|
public ConfigYml(@NotNull final EcoPlugin plugin, String name) {
|
||||||
|
super(name, true, plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Config.yml.
|
||||||
|
*
|
||||||
|
* @param plugin The plugin.
|
||||||
|
* @param name The config name.
|
||||||
|
* @param removeUnused Remove unused.
|
||||||
|
*/
|
||||||
|
public ConfigYml(@NotNull final EcoPlugin plugin, String name, boolean removeUnused) {
|
||||||
|
super(name, removeUnused, plugin);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,14 +2,15 @@ package com.willfp.eco.internal.spigot.integrations.antigrief
|
|||||||
|
|
||||||
import com.bgsoftware.superiorskyblock.api.SuperiorSkyblockAPI
|
import com.bgsoftware.superiorskyblock.api.SuperiorSkyblockAPI
|
||||||
import com.bgsoftware.superiorskyblock.api.enums.HitActionResult
|
import com.bgsoftware.superiorskyblock.api.enums.HitActionResult
|
||||||
|
import com.bgsoftware.superiorskyblock.api.island.Island
|
||||||
import com.bgsoftware.superiorskyblock.api.island.IslandPrivilege
|
import com.bgsoftware.superiorskyblock.api.island.IslandPrivilege
|
||||||
|
import com.bgsoftware.superiorskyblock.api.key.Key
|
||||||
|
import com.bgsoftware.superiorskyblock.api.wrappers.SuperiorPlayer
|
||||||
import com.willfp.eco.core.integrations.antigrief.AntigriefWrapper
|
import com.willfp.eco.core.integrations.antigrief.AntigriefWrapper
|
||||||
import org.bukkit.Location
|
import org.bukkit.Location
|
||||||
|
import org.bukkit.Material
|
||||||
import org.bukkit.block.Block
|
import org.bukkit.block.Block
|
||||||
import org.bukkit.entity.Animals
|
import org.bukkit.entity.*
|
||||||
import org.bukkit.entity.LivingEntity
|
|
||||||
import org.bukkit.entity.Monster
|
|
||||||
import org.bukkit.entity.Player
|
|
||||||
|
|
||||||
class AntigriefSuperiorSkyblock2 : AntigriefWrapper {
|
class AntigriefSuperiorSkyblock2 : AntigriefWrapper {
|
||||||
override fun getPluginName(): String {
|
override fun getPluginName(): String {
|
||||||
@@ -17,11 +18,42 @@ class AntigriefSuperiorSkyblock2 : AntigriefWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun canBreakBlock(player: Player, block: Block): Boolean {
|
override fun canBreakBlock(player: Player, block: Block): Boolean {
|
||||||
if (SuperiorSkyblockAPI.getPlayer(player).hasBypassModeEnabled()) {
|
val island: Island? =
|
||||||
|
SuperiorSkyblockAPI.getIslandAt(block.location)
|
||||||
|
|
||||||
|
val superiorPlayer: SuperiorPlayer =
|
||||||
|
SuperiorSkyblockAPI.getPlayer(player)
|
||||||
|
|
||||||
|
if (island == null) {
|
||||||
|
if (!superiorPlayer.hasBypassModeEnabled() && SuperiorSkyblockAPI.getSuperiorSkyblock().grid
|
||||||
|
.isIslandsWorld(player.world)
|
||||||
|
) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return SuperiorSkyblockAPI.getPlayer(player).hasPermission(IslandPrivilege.getByName("Break"))
|
|
||||||
|| SuperiorSkyblockAPI.getPlayer(player).hasPermission(IslandPrivilege.getByName("BREAK"))
|
val blockType = block.type
|
||||||
|
|
||||||
|
val islandPermission: IslandPrivilege =
|
||||||
|
if (blockType == Material.SPAWNER) IslandPrivilege.getByName("SPAWNER_BREAK") else IslandPrivilege.getByName("BREAK")
|
||||||
|
|
||||||
|
if (!island.hasPermission(superiorPlayer, islandPermission)) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SuperiorSkyblockAPI.getSuperiorSkyblock().settings.valuableBlocks
|
||||||
|
.contains(Key.of(block)) &&
|
||||||
|
!island.hasPermission(superiorPlayer, IslandPrivilege.getByName("VALUABLE_BREAK"))
|
||||||
|
) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!island.isInsideRange(block.location)) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun canCreateExplosion(player: Player, location: Location): Boolean {
|
override fun canCreateExplosion(player: Player, location: Location): Boolean {
|
||||||
@@ -32,11 +64,29 @@ class AntigriefSuperiorSkyblock2 : AntigriefWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun canPlaceBlock(player: Player, block: Block): Boolean {
|
override fun canPlaceBlock(player: Player, block: Block): Boolean {
|
||||||
if (SuperiorSkyblockAPI.getPlayer(player).hasBypassModeEnabled()) {
|
val island: Island? =
|
||||||
|
SuperiorSkyblockAPI.getIslandAt(block.location)
|
||||||
|
|
||||||
|
val superiorPlayer: SuperiorPlayer =
|
||||||
|
SuperiorSkyblockAPI.getPlayer(player)
|
||||||
|
|
||||||
|
if (island == null) {
|
||||||
|
if (!superiorPlayer.hasBypassModeEnabled() && SuperiorSkyblockAPI.getSuperiorSkyblock().grid.isIslandsWorld(superiorPlayer.world)
|
||||||
|
) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return SuperiorSkyblockAPI.getPlayer(player).hasPermission(IslandPrivilege.getByName("Place"))
|
|
||||||
|| SuperiorSkyblockAPI.getPlayer(player).hasPermission(IslandPrivilege.getByName("PLACE"))
|
if (!island.hasPermission(superiorPlayer, IslandPrivilege.getByName("BUILD"))) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!island.isInsideRange(block.location)) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun canInjure(player: Player, victim: LivingEntity): Boolean {
|
override fun canInjure(player: Player, victim: LivingEntity): Boolean {
|
||||||
@@ -45,13 +95,14 @@ class AntigriefSuperiorSkyblock2 : AntigriefWrapper {
|
|||||||
}
|
}
|
||||||
return when (victim) {
|
return when (victim) {
|
||||||
is Player -> SuperiorSkyblockAPI.getPlayer(player).canHit(SuperiorSkyblockAPI.getPlayer(victim)).equals(HitActionResult.SUCCESS)
|
is Player -> SuperiorSkyblockAPI.getPlayer(player).canHit(SuperiorSkyblockAPI.getPlayer(victim)).equals(HitActionResult.SUCCESS)
|
||||||
is Animals -> {
|
else -> {
|
||||||
return SuperiorSkyblockAPI.getPlayer(player).hasPermission(IslandPrivilege.getByName("ANIMAL_DAMAGE"))
|
val island: Island? = SuperiorSkyblockAPI.getSuperiorSkyblock().grid.getIslandAt(victim.location)
|
||||||
|
val islandPermission = if (victim is Monster) IslandPrivilege.getByName("MONSTER_DAMAGE") else IslandPrivilege.getByName("ANIMAL_DAMAGE")
|
||||||
|
if (island != null ) {
|
||||||
|
return island.hasPermission(player, islandPermission)
|
||||||
|
}
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
is Monster -> {
|
|
||||||
return SuperiorSkyblockAPI.getPlayer(player).hasPermission(IslandPrivilege.getByName("MONSTER_DAMAGE"))
|
|
||||||
}
|
|
||||||
else -> true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user