-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
show warning when placing block with backup tag
- Loading branch information
1 parent
730fc71
commit 1d50dd2
Showing
4 changed files
with
25 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/main/java/com/github/mori01231/lifecore/command/BlockListener.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.github.mori01231.lifecore.command | ||
|
||
import com.github.mori01231.lifecore.util.ItemUtil | ||
import org.bukkit.ChatColor | ||
import org.bukkit.event.EventHandler | ||
import org.bukkit.event.Listener | ||
import org.bukkit.event.block.BlockPlaceEvent | ||
|
||
object BlockListener : Listener { | ||
@EventHandler | ||
fun onBlockPlace(e: BlockPlaceEvent) { | ||
if (ItemUtil.containsTag(e.itemInHand, "backup") && !e.player.isSneaking) { | ||
e.player.sendMessage("${ChatColor.RED}このブロックを設置すると中身のアイテムが変質し、元の状態に戻らなくなる可能性があります。") | ||
e.player.sendMessage("${ChatColor.RED}この警告を無視して設置したい場合はスニークしながら設置してください。") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters