From 956098a52e9ca62f0f229e4c5541f599909fde45 Mon Sep 17 00:00:00 2001 From: EpyonProjects Date: Mon, 6 May 2024 15:53:55 -0400 Subject: [PATCH] Add container break grief alert - Fix some alert texts - Update to 2.8.1 --- build.gradle.kts | 2 +- .../gamemode4core/commands/WarpCommand.kt | 4 ++-- .../kruthers/gamemode4core/events/GriefEvents.kt | 15 ++++++++++++++- src/main/resources/config.yml | 4 ++-- src/main/resources/plugin.yml | 10 +++++----- 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 29ea154..2006226 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,7 +5,7 @@ plugins { } group = "com.kruthers" -version = "2.8.0" +version = "2.8.1" description = "The core plugin used to manage the gamemode 4 public server" repositories { diff --git a/src/main/kotlin/com/kruthers/gamemode4core/commands/WarpCommand.kt b/src/main/kotlin/com/kruthers/gamemode4core/commands/WarpCommand.kt index df591d9..dcb2947 100644 --- a/src/main/kotlin/com/kruthers/gamemode4core/commands/WarpCommand.kt +++ b/src/main/kotlin/com/kruthers/gamemode4core/commands/WarpCommand.kt @@ -27,13 +27,13 @@ class WarpCommand(val plugin: Gamemode4Core) { val warpsSize = warps.size var i = 0 warps.forEach { (warp, _) -> - val text = MiniMessage.miniMessage().deserialize("Teleport to $warp" + + val text = MiniMessage.miniMessage().deserialize(" Teleport to $warp" + "'>$warp") warpsText = warpsText.append(text) i++ if (i < warpsSize) { - warpsText.append(Component.text(", ", NamedTextColor.GREEN)) + warpsText.append(Component.text(",", NamedTextColor.GREEN)) } } diff --git a/src/main/kotlin/com/kruthers/gamemode4core/events/GriefEvents.kt b/src/main/kotlin/com/kruthers/gamemode4core/events/GriefEvents.kt index a85351b..651ca20 100644 --- a/src/main/kotlin/com/kruthers/gamemode4core/events/GriefEvents.kt +++ b/src/main/kotlin/com/kruthers/gamemode4core/events/GriefEvents.kt @@ -20,6 +20,7 @@ import org.bukkit.entity.EntityType import org.bukkit.entity.Player import org.bukkit.event.EventHandler import org.bukkit.event.Listener +import org.bukkit.event.block.BlockBreakEvent import org.bukkit.event.block.BlockPlaceEvent import org.bukkit.event.entity.EntityPlaceEvent import org.bukkit.event.player.PlayerBucketEmptyEvent @@ -29,6 +30,9 @@ class GriefEvents(val plugin: Gamemode4Core): Listener { private val warningTime: Long = 60*60*20 private val blockedBlocks: MutableList = mutableListOf(Material.TNT,Material.FIRE,Material.LAVA, Material.WITHER_SKELETON_SKULL,Material.WITHER_SKELETON_WALL_SKULL) + private val blockBrokenBlocks: MutableList = mutableListOf(Material.CHEST,Material.TRAPPED_CHEST, + Material.BARREL,Material.HOPPER,Material.DISPENSER,Material.DROPPER, + Material.CHEST_MINECART,Material.HOPPER_MINECART) private val kickMessages: MutableList = mutableListOf( "Internal exception: java.io.IOException: Received string length longer than the maximum allowed (257>256)", @@ -62,7 +66,7 @@ class GriefEvents(val plugin: Gamemode4Core): Listener { "gm4core.griefwarning" ) //send discord message - val logChannel: TextChannel? = DiscordSRV.getPlugin().getDestinationTextChannelForGameChannelName("grief-log") + val logChannel: TextChannel? = DiscordSRV.getPlugin().getDestinationTextChannelForGameChannelName("grief-alerts") if (logChannel != null) { val embed = EmbedBuilder() embed.setTitle("Possible grief attempt detected") @@ -86,6 +90,15 @@ class GriefEvents(val plugin: Gamemode4Core): Listener { } } + @EventHandler + fun onBlockBreakEvent(event: BlockBreakEvent) { + // Block container breaking for first 20 minutes + if (checkPlayTime(event.player, warningTime / 3) && blockBrokenBlocks.contains(event.block.type)) { + event.isCancelled = true + sendWarning(event.player, "tried to break ${event.block.type.name}",event.block.location) + } + } + @EventHandler fun onEntityPlaceEvent(event: EntityPlaceEvent) { if (event.player == null) return diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 368e143..4695c3c 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -51,8 +51,8 @@ messages: ------- ------ ------- end_brodcast: | ------- Warning ------- - veryone has been release, you are free to move arround again - Please be carefull and report any issues + Everyone has been released, you are free to move around again + Please be careful and report any issues ------- ------ ------- staff_start: ' Has frozen everyone in place, run /unfreeze to release them' staff_end: ' Has unfrozen everyone' diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 63e344f..b935410 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -14,13 +14,13 @@ softdepend: permissions: gm4core.default: default: true - description: Base permission ued for core command + description: Base permission used for core command gm4core.reload: default: false description: Used to reload the plugin gm4core.mode.watch: default: op - description: Allows you to go into streamer mode and disable notifcations + description: Allows you to go into streamer mode and disable notifications children: - gm4core.mode.mod gm4core.mode.mod: @@ -31,7 +31,7 @@ permissions: description: tpa to locations or people gm4core.tpa.back: default: op - description: go back to privous locations + description: go back to previous locations children: - gm4core.tpa gm4core.freeze: @@ -42,7 +42,7 @@ permissions: description: Bypass getting frozen gm4core.freeze.notify: default: op - description: Get notified seperatly when a freeze is started and of who started it + description: Get notified separately when a freeze is started and of who started it gm4core.warp: default: op gm4core.warp.manage: @@ -51,7 +51,7 @@ permissions: - gm4core.warp gm4core.griefwarning: default: op - description: Warns when a attempted grief has occured + description: Warns when a attempted grief has occurred gm4core.warnings: default: true description: Lists all your warnings