Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
66887f0a3a | ||
|
|
410cdfe7e3 | ||
|
|
bbffdc7e23 | ||
|
|
0d267e2bec | ||
|
|
578256f89b | ||
|
|
90ecbfce00 | ||
|
|
9945704338 | ||
|
|
5c7a7876d8 | ||
|
|
94df0e67a6 | ||
|
|
92c4e62709 | ||
|
|
e094a1e934 | ||
|
|
26c07a20e7 | ||
|
|
ad68e1efef | ||
|
|
d8c3a3befa |
@@ -150,7 +150,6 @@ public class Display {
|
|||||||
* @param player The player.
|
* @param player The player.
|
||||||
* @param args The args.
|
* @param args The args.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("checkstyle:FinalParameters")
|
|
||||||
@ApiStatus.Internal
|
@ApiStatus.Internal
|
||||||
public static void callDisplayModule(@NotNull final DisplayModule module,
|
public static void callDisplayModule(@NotNull final DisplayModule module,
|
||||||
@NotNull final ItemStack itemStack,
|
@NotNull final ItemStack itemStack,
|
||||||
|
|||||||
@@ -336,10 +336,14 @@ public class StringUtils {
|
|||||||
* @return The JSON String.
|
* @return The JSON String.
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@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(
|
return GsonComponentSerializer.gson().serialize(
|
||||||
Component.empty().decoration(TextDecoration.ITALIC, false).append(
|
Component.empty().decoration(TextDecoration.ITALIC, false).append(
|
||||||
LEGACY_COMPONENT_SERIALIZER.deserialize(legacy)
|
LEGACY_COMPONENT_SERIALIZER.deserialize(processed)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ abstract class EcoSpigotPlugin : EcoPlugin(
|
|||||||
// AntiGrief
|
// AntiGrief
|
||||||
IntegrationLoader("WorldGuard") { AntigriefManager.register(AntigriefWorldGuard()) },
|
IntegrationLoader("WorldGuard") { AntigriefManager.register(AntigriefWorldGuard()) },
|
||||||
IntegrationLoader("GriefPrevention") { AntigriefManager.register(AntigriefGriefPrevention()) },
|
IntegrationLoader("GriefPrevention") { AntigriefManager.register(AntigriefGriefPrevention()) },
|
||||||
|
IntegrationLoader("GriefDefender") { AntigriefManager.register(AntigriefGriefDefender()) },
|
||||||
IntegrationLoader("FactionsUUID") { AntigriefManager.register(AntigriefFactionsUUID()) },
|
IntegrationLoader("FactionsUUID") { AntigriefManager.register(AntigriefFactionsUUID()) },
|
||||||
IntegrationLoader("Towny") { AntigriefManager.register(AntigriefTowny()) },
|
IntegrationLoader("Towny") { AntigriefManager.register(AntigriefTowny()) },
|
||||||
IntegrationLoader("Lands") { AntigriefManager.register(AntigriefLands(this)) },
|
IntegrationLoader("Lands") { AntigriefManager.register(AntigriefLands(this)) },
|
||||||
|
|||||||
@@ -11,7 +11,10 @@ import com.willfp.eco.proxy.ChatComponentProxy
|
|||||||
import org.bukkit.entity.Player
|
import org.bukkit.entity.Player
|
||||||
|
|
||||||
class PacketChat(plugin: EcoPlugin) :
|
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(
|
override fun onSend(
|
||||||
packet: PacketContainer,
|
packet: PacketContainer,
|
||||||
player: Player,
|
player: Player,
|
||||||
|
|||||||
@@ -13,7 +13,10 @@ import org.bukkit.inventory.ItemFlag
|
|||||||
import org.bukkit.inventory.MerchantRecipe
|
import org.bukkit.inventory.MerchantRecipe
|
||||||
|
|
||||||
class PacketOpenWindowMerchant(plugin: EcoPlugin) :
|
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(
|
override fun onSend(
|
||||||
packet: PacketContainer,
|
packet: PacketContainer,
|
||||||
player: Player,
|
player: Player,
|
||||||
|
|||||||
@@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,7 +11,9 @@ import com.willfp.eco.core.integrations.antigrief.AntigriefWrapper
|
|||||||
import org.apache.commons.lang.Validate
|
import org.apache.commons.lang.Validate
|
||||||
import org.bukkit.Location
|
import org.bukkit.Location
|
||||||
import org.bukkit.block.Block
|
import org.bukkit.block.Block
|
||||||
|
import org.bukkit.entity.Animals
|
||||||
import org.bukkit.entity.LivingEntity
|
import org.bukkit.entity.LivingEntity
|
||||||
|
import org.bukkit.entity.Monster
|
||||||
import org.bukkit.entity.Player
|
import org.bukkit.entity.Player
|
||||||
|
|
||||||
class AntigriefWorldGuard : AntigriefWrapper {
|
class AntigriefWorldGuard : AntigriefWrapper {
|
||||||
@@ -79,22 +81,21 @@ class AntigriefWorldGuard : AntigriefWrapper {
|
|||||||
val localPlayer: LocalPlayer = WorldGuardPlugin.inst().wrapPlayer(player)
|
val localPlayer: LocalPlayer = WorldGuardPlugin.inst().wrapPlayer(player)
|
||||||
val container: RegionContainer = WorldGuard.getInstance().platform.regionContainer
|
val container: RegionContainer = WorldGuard.getInstance().platform.regionContainer
|
||||||
val query: RegionQuery = container.createQuery()
|
val query: RegionQuery = container.createQuery()
|
||||||
if (victim is Player) {
|
val flag = when(victim) {
|
||||||
if (!query.testBuild(BukkitAdapter.adapt(victim.getLocation()), localPlayer, Flags.PVP)) {
|
is Player -> Flags.PVP
|
||||||
return WorldGuard.getInstance().platform.sessionManager.hasBypass(
|
is Monster -> Flags.MOB_DAMAGE
|
||||||
localPlayer,
|
is Animals -> Flags.DAMAGE_ANIMALS
|
||||||
BukkitAdapter.adapt(player.world)
|
else -> return true
|
||||||
)
|
}
|
||||||
}
|
|
||||||
} else {
|
return if (!query.testBuild(BukkitAdapter.adapt(victim.location), localPlayer, flag)) {
|
||||||
if (!query.testBuild(BukkitAdapter.adapt(victim.location), localPlayer, Flags.DAMAGE_ANIMALS)) {
|
WorldGuard.getInstance().platform.sessionManager.hasBypass(
|
||||||
return WorldGuard.getInstance().platform.sessionManager.hasBypass(
|
localPlayer,
|
||||||
localPlayer,
|
BukkitAdapter.adapt(player.world)
|
||||||
BukkitAdapter.adapt(player.world)
|
)
|
||||||
)
|
} else {
|
||||||
}
|
true
|
||||||
}
|
}
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getPluginName(): String {
|
override fun getPluginName(): String {
|
||||||
|
|||||||
@@ -14,4 +14,9 @@ use-fast-collated-drops: true
|
|||||||
|
|
||||||
# bStats is important and you should keep it enabled.
|
# bStats is important and you should keep it enabled.
|
||||||
# This option is only here because of compliance with data protection laws.
|
# 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
|
||||||
@@ -25,6 +25,7 @@ softdepend:
|
|||||||
- ItemsAdder
|
- ItemsAdder
|
||||||
- Oraxen
|
- Oraxen
|
||||||
- HeadDatabase
|
- HeadDatabase
|
||||||
|
- GriefDefender
|
||||||
libraries:
|
libraries:
|
||||||
- org.reflections:reflections:0.9.12
|
- org.reflections:reflections:0.9.12
|
||||||
- org.apache.maven:maven-artifact:3.0.3
|
- org.apache.maven:maven-artifact:3.0.3
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
version = 6.8.2
|
version = 6.8.6
|
||||||
plugin-name = eco
|
plugin-name = eco
|
||||||
BIN
lib/griefdefenderapi-2.0.0-SNAPSHOT.jar
Normal file
BIN
lib/griefdefenderapi-2.0.0-SNAPSHOT.jar
Normal file
Binary file not shown.
Reference in New Issue
Block a user