1
0
Fork 0

Give corpses a player head when they are identified

This commit is contained in:
Moritz Ruth 2020-06-21 15:14:05 +02:00
parent 3ee015412d
commit 0899e7a496
No known key found for this signature in database
GPG key ID: AFD57E23E753841B

View file

@ -8,14 +8,17 @@ import de.moritzruth.spigot_ttt.game.players.Role
import de.moritzruth.spigot_ttt.game.players.TTTPlayer import de.moritzruth.spigot_ttt.game.players.TTTPlayer
import de.moritzruth.spigot_ttt.plugin import de.moritzruth.spigot_ttt.plugin
import de.moritzruth.spigot_ttt.utils.applyMeta import de.moritzruth.spigot_ttt.utils.applyMeta
import de.moritzruth.spigot_ttt.utils.applyTypedMeta
import de.moritzruth.spigot_ttt.utils.secondsToTicks import de.moritzruth.spigot_ttt.utils.secondsToTicks
import de.moritzruth.spigot_ttt.utils.sendActionBarMessage import de.moritzruth.spigot_ttt.utils.sendActionBarMessage
import org.bukkit.ChatColor import org.bukkit.ChatColor
import org.bukkit.Location import org.bukkit.Location
import org.bukkit.Material
import org.bukkit.entity.EntityType import org.bukkit.entity.EntityType
import org.bukkit.entity.Zombie import org.bukkit.entity.Zombie
import org.bukkit.event.inventory.InventoryType import org.bukkit.event.inventory.InventoryType
import org.bukkit.inventory.ItemStack import org.bukkit.inventory.ItemStack
import org.bukkit.inventory.meta.SkullMeta
import org.bukkit.scheduler.BukkitTask import org.bukkit.scheduler.BukkitTask
import org.bukkit.util.Vector import org.bukkit.util.Vector
import java.time.Instant import java.time.Instant
@ -61,6 +64,12 @@ class TTTCorpse private constructor(
isCollidable = false isCollidable = false
} }
entity.equipment!!.helmet = ItemStack(Material.PLAYER_HEAD).applyTypedMeta<SkullMeta> {
// Question mark head
@Suppress("DEPRECATION")
owner = "MHF_question"
}
updateTimeTask = plugin.server.scheduler.runTaskTimer(plugin, fun() { updateTimeTask = plugin.server.scheduler.runTaskTimer(plugin, fun() {
fullMinutesSinceDeath += 1 fullMinutesSinceDeath += 1
setTimeItem() setTimeItem()
@ -120,10 +129,14 @@ class TTTCorpse private constructor(
setItems() setItems()
} }
entity.equipment!!.helmet = ItemStack(Material.PLAYER_HEAD).applyTypedMeta<SkullMeta> {
owningPlayer = tttPlayer.player
}
if (credits != 0 && by.role.canOwnCredits) { if (credits != 0 && by.role.canOwnCredits) {
val c = credits val c = credits
credits = 0 credits = 0
by.credits += c by.credits += credits
by.player.sendActionBarMessage( by.player.sendActionBarMessage(
if (c > 1) "${ChatColor.GREEN}Du hast $c Credits aufgesammelt" if (c > 1) "${ChatColor.GREEN}Du hast $c Credits aufgesammelt"