Compare commits

..

16 Commits
6.8.1 ... 6.8.6

Author SHA1 Message Date
Auxilor
66887f0a3a Updated to 6.8.6 2021-09-30 12:22:16 +01:00
Auxilor
410cdfe7e3 Improved WorldGuard code 2021-09-30 12:22:03 +01:00
Auxilor
bbffdc7e23 Improved WorldGuard code 2021-09-30 12:21:55 +01:00
Will FP
0d267e2bec Merge pull request #16
Fixed WorldGuard AntiGrief manager using damage-animals flag only
2021-09-30 12:15:38 +01:00
Auxilor
578256f89b Updated to 6.8.5 2021-09-29 10:32:24 +01:00
Auxilor
90ecbfce00 Added use-lower-protocollib-priority 2021-09-29 10:32:12 +01:00
_OfTeN_
9945704338 Fixed WorldGuard AntiGrief manager using damage-animals flag only 2021-09-29 00:42:53 +03:00
Auxilor
5c7a7876d8 Improved GriefDefender support 2021-09-27 14:11:42 +01:00
Will FP
94df0e67a6 Merge pull request #15
GriefDefender support
2021-09-27 14:07:56 +01:00
_OfTeN_
92c4e62709 Hopefully added GriefDefender support 2021-09-26 15:00:05 +03:00
Auxilor
e094a1e934 Merge remote-tracking branch 'origin/master' 2021-09-24 09:50:12 +01:00
Auxilor
26c07a20e7 Updated to 6.8.3 2021-09-24 09:50:05 +01:00
Auxilor
ad68e1efef Fixed legacyToJson nullability bug 2021-09-24 09:49:54 +01:00
Auxilor
d8c3a3befa Removed redundant suppression 2021-09-21 19:18:01 +01:00
Auxilor
aa52dcdf94 Updated to 6.8.2 2021-09-20 17:01:39 +01:00
Auxilor
9d3ba7ea88 Improved towny integration 2021-09-20 17:01:16 +01:00
13 changed files with 123 additions and 41 deletions

View File

@@ -150,7 +150,6 @@ public class Display {
* @param player The player.
* @param args The args.
*/
@SuppressWarnings("checkstyle:FinalParameters")
@ApiStatus.Internal
public static void callDisplayModule(@NotNull final DisplayModule module,
@NotNull final ItemStack itemStack,

View File

@@ -336,10 +336,14 @@ public class StringUtils {
* @return The JSON String.
*/
@NotNull
public String legacyToJson(@NotNull final String legacy) {
public String legacyToJson(@Nullable final String legacy) {
String processed = legacy;
if (legacy == null) {
processed = "";
}
return GsonComponentSerializer.gson().serialize(
Component.empty().decoration(TextDecoration.ITALIC, false).append(
LEGACY_COMPONENT_SERIALIZER.deserialize(legacy)
LEGACY_COMPONENT_SERIALIZER.deserialize(processed)
)
);
}

View File

@@ -13,7 +13,7 @@ dependencies {
compileOnly 'com.github.TechFortress:GriefPrevention:16.14.0'
compileOnly 'com.massivecraft:Factions:1.6.9.5-U0.5.10'
compileOnly 'com.github.cryptomorin:kingdoms:1.10.14'
compileOnly 'com.github.TownyAdvanced:Towny:0.96.2.0'
compileOnly 'com.github.TownyAdvanced:Towny:0.97.1.0'
compileOnly 'com.github.angeschossen:LandsAPI:4.7.3'
compileOnly 'fr.neatmonster:nocheatplus:3.16.1-SNAPSHOT'
compileOnly 'com.github.jiangdashao:matrix-api-repo:317d4635fd'

View File

@@ -102,6 +102,7 @@ abstract class EcoSpigotPlugin : EcoPlugin(
// AntiGrief
IntegrationLoader("WorldGuard") { AntigriefManager.register(AntigriefWorldGuard()) },
IntegrationLoader("GriefPrevention") { AntigriefManager.register(AntigriefGriefPrevention()) },
IntegrationLoader("GriefDefender") { AntigriefManager.register(AntigriefGriefDefender()) },
IntegrationLoader("FactionsUUID") { AntigriefManager.register(AntigriefFactionsUUID()) },
IntegrationLoader("Towny") { AntigriefManager.register(AntigriefTowny()) },
IntegrationLoader("Lands") { AntigriefManager.register(AntigriefLands(this)) },

View File

@@ -11,7 +11,10 @@ import com.willfp.eco.proxy.ChatComponentProxy
import org.bukkit.entity.Player
class PacketChat(plugin: EcoPlugin) :
AbstractPacketAdapter(plugin, PacketType.Play.Server.CHAT, ListenerPriority.MONITOR, true) {
AbstractPacketAdapter(plugin,
PacketType.Play.Server.CHAT,
if (plugin.configYml.getBool("use-lower-protocollib-priority")) ListenerPriority.NORMAL else ListenerPriority.MONITOR,
true) {
override fun onSend(
packet: PacketContainer,
player: Player,

View File

@@ -13,7 +13,10 @@ import org.bukkit.inventory.ItemFlag
import org.bukkit.inventory.MerchantRecipe
class PacketOpenWindowMerchant(plugin: EcoPlugin) :
AbstractPacketAdapter(plugin, PacketType.Play.Server.OPEN_WINDOW_MERCHANT, ListenerPriority.MONITOR, true) {
AbstractPacketAdapter(plugin,
PacketType.Play.Server.OPEN_WINDOW_MERCHANT,
if (plugin.configYml.getBool("use-lower-protocollib-priority")) ListenerPriority.NORMAL else ListenerPriority.MONITOR,
true) {
override fun onSend(
packet: PacketContainer,
player: Player,

View File

@@ -0,0 +1,81 @@
package com.willfp.eco.spigot.integrations.antigrief
import com.flowpowered.math.vector.Vector3i
import com.griefdefender.api.GriefDefender
import com.griefdefender.api.data.PlayerData
import com.griefdefender.api.permission.flag.Flags
import com.willfp.eco.core.integrations.antigrief.AntigriefWrapper
import org.bukkit.Location
import org.bukkit.block.Block
import org.bukkit.entity.LivingEntity
import org.bukkit.entity.Player
import java.util.*
class AntigriefGriefDefender : AntigriefWrapper {
override fun canBreakBlock(player: Player, block: Block): Boolean {
val data = GriefDefender.getCore().getPlayerData(player.world.uid, player.uniqueId) ?: return true
val claim = GriefDefender.getCore().getClaimAt(Vector3i(block.location.x, block.location.y, block.location.z))
?: return true
return if (data.canIgnoreClaim(claim)) {
true
} else {
claim.getActiveFlagPermissionValue(Flags.BLOCK_BREAK, data.user, Collections.emptySet(), true).asBoolean()
}
}
override fun canCreateExplosion(player: Player, location: Location): Boolean {
val data = GriefDefender.getCore().getPlayerData(player.world.uid, player.uniqueId) ?: return true
val claim = GriefDefender.getCore().getClaimAt(Vector3i(location.x, location.y, location.z)) ?: return true
return if (data.canIgnoreClaim(claim)) {
true
} else {
claim.getActiveFlagPermissionValue(Flags.EXPLOSION_BLOCK, data.user, Collections.emptySet(), true)
.asBoolean()
}
}
override fun canPlaceBlock(player: Player, block: Block): Boolean {
val data: PlayerData = GriefDefender.getCore().getPlayerData(player.world.uid, player.uniqueId) ?: return true
val claim =
GriefDefender.getCore().getClaimAt(Vector3i(block.location.x, block.location.y, block.location.z))
?: return true
return if (data.canIgnoreClaim(claim)) {
true
} else {
claim.getActiveFlagPermissionValue(Flags.BLOCK_PLACE, data.user, Collections.emptySet(), true)
.asBoolean()
}
}
override fun canInjure(player: Player, victim: LivingEntity): Boolean {
val data = GriefDefender.getCore().getPlayerData(player.world.uid, player.uniqueId) ?: return true
if (data.canIgnoreClaim(data.currentClaim)) {
return true
}
return if (victim is Player) {
val vicData = GriefDefender.getCore().getPlayerData(victim.world.uid, victim.uniqueId)
if (vicData != null) {
data.canPvp(data.currentClaim) && data.canPvp(vicData.currentClaim)
} else data.canPvp(data.currentClaim)
} else {
val claim =
GriefDefender.getCore().getClaimAt(Vector3i(victim.location.x, victim.location.y, victim.location.z))
claim?.getActiveFlagPermissionValue(Flags.ENTITY_DAMAGE, data.user, Collections.emptySet(), true)
?.asBoolean() ?: true
}
}
override fun getPluginName(): String {
return "GriefDefender"
}
}

View File

@@ -2,9 +2,7 @@ package com.willfp.eco.spigot.integrations.antigrief
import com.palmergames.bukkit.towny.TownyAPI
import com.palmergames.bukkit.towny.TownyUniverse
import com.palmergames.bukkit.towny.`object`.Town
import com.palmergames.bukkit.towny.`object`.TownyPermission
import com.palmergames.bukkit.towny.`object`.WorldCoord
import com.palmergames.bukkit.towny.utils.PlayerCacheUtil
import com.willfp.eco.core.integrations.antigrief.AntigriefWrapper
import org.bukkit.Location
@@ -67,22 +65,8 @@ class AntigriefTowny : AntigriefWrapper {
true
}
}
if (victim is Player) {
try {
val town: Town = WorldCoord.parseWorldCoord(victim.getLocation()).townBlock.town
return town.isPVP
} catch (ignored: Exception) {
// If exception, no town was found, thus return true.
}
} else {
try {
val town: Town = WorldCoord.parseWorldCoord(victim.location).townBlock.town
return town.hasMobs()
} catch (ignored: Exception) {
// If exception, no town was found, thus return true.
}
}
return true
val townBlock = TownyAPI.getInstance().getTownBlock(victim.location) ?: return true
return townBlock.permissions.pvp
}
override fun getPluginName(): String {

View File

@@ -11,7 +11,9 @@ import com.willfp.eco.core.integrations.antigrief.AntigriefWrapper
import org.apache.commons.lang.Validate
import org.bukkit.Location
import org.bukkit.block.Block
import org.bukkit.entity.Animals
import org.bukkit.entity.LivingEntity
import org.bukkit.entity.Monster
import org.bukkit.entity.Player
class AntigriefWorldGuard : AntigriefWrapper {
@@ -79,22 +81,21 @@ class AntigriefWorldGuard : AntigriefWrapper {
val localPlayer: LocalPlayer = WorldGuardPlugin.inst().wrapPlayer(player)
val container: RegionContainer = WorldGuard.getInstance().platform.regionContainer
val query: RegionQuery = container.createQuery()
if (victim is Player) {
if (!query.testBuild(BukkitAdapter.adapt(victim.getLocation()), localPlayer, Flags.PVP)) {
return WorldGuard.getInstance().platform.sessionManager.hasBypass(
localPlayer,
BukkitAdapter.adapt(player.world)
)
}
} else {
if (!query.testBuild(BukkitAdapter.adapt(victim.location), localPlayer, Flags.DAMAGE_ANIMALS)) {
return WorldGuard.getInstance().platform.sessionManager.hasBypass(
localPlayer,
BukkitAdapter.adapt(player.world)
)
}
val flag = when(victim) {
is Player -> Flags.PVP
is Monster -> Flags.MOB_DAMAGE
is Animals -> Flags.DAMAGE_ANIMALS
else -> return true
}
return if (!query.testBuild(BukkitAdapter.adapt(victim.location), localPlayer, flag)) {
WorldGuard.getInstance().platform.sessionManager.hasBypass(
localPlayer,
BukkitAdapter.adapt(player.world)
)
} else {
true
}
return true
}
override fun getPluginName(): String {

View File

@@ -14,4 +14,9 @@ use-fast-collated-drops: true
# bStats is important and you should keep it enabled.
# This option is only here because of compliance with data protection laws.
enable-bstats: true
enable-bstats: true
# Some plugins use their own item display systems (eg Triton)
# And must be ran after eco. Don't enable this unless you run a conflicting plugin
# and have been told to enable it.
use-lower-protocollib-priority: false

View File

@@ -25,6 +25,7 @@ softdepend:
- ItemsAdder
- Oraxen
- HeadDatabase
- GriefDefender
libraries:
- org.reflections:reflections:0.9.12
- org.apache.maven:maven-artifact:3.0.3

View File

@@ -1,2 +1,2 @@
version = 6.8.1
version = 6.8.6
plugin-name = eco

Binary file not shown.