1
0
Fork 0

Fix inventory clear after death

This commit is contained in:
Moritz Ruth 2020-06-14 23:06:52 +02:00
parent fe36541c05
commit f66b460529
No known key found for this signature in database
GPG key ID: AFD57E23E753841B
3 changed files with 13 additions and 6 deletions

View file

@ -78,7 +78,7 @@ object SecondChance: TTTItem, Buyable {
fun onTTTPlayerTrueDeath(event: TTTPlayerTrueDeathEvent) {
val state = isc.get(event.tttPlayer)
if (state != null) {
if (Random.nextBoolean()) {
if (true || Random.nextBoolean()) {
event.winnerRoleGroup = null
event.tttPlayer.player.openInventory(chooseSpawnInventory)
state.timeoutAction = TimeoutAction(event.tttPlayer, event.tttCorpse.location)

View file

@ -9,8 +9,8 @@ import org.bukkit.ChatColor
object Rifle: Gun(
stateClass = State::class,
displayName = "${ChatColor.YELLOW}${ChatColor.BOLD}Rifle",
damage = heartsToHealth(0.5),
cooldown = 0.1,
damage = heartsToHealth(0.8),
cooldown = 0.15,
magazineSize = 40,
reloadTime = 2.0,
itemMaterial = Resourcepack.Items.rifle,

View file

@ -11,7 +11,6 @@ import de.moritzruth.spigot_ttt.game.corpses.TTTCorpse
import de.moritzruth.spigot_ttt.game.items.ItemManager
import de.moritzruth.spigot_ttt.game.items.Selectable
import de.moritzruth.spigot_ttt.game.items.TTTItem
import de.moritzruth.spigot_ttt.game.items.impl.CloakingDevice
import de.moritzruth.spigot_ttt.game.items.shop.Shop
import de.moritzruth.spigot_ttt.utils.*
import org.bukkit.*
@ -79,6 +78,7 @@ class TTTPlayer(player: Player, role: Role, val tttClass: TTTClass?) {
alive = false
player.gameMode = GameMode.SPECTATOR
Shop.clear(this)
var reallyScream = scream
@ -107,12 +107,19 @@ class TTTPlayer(player: Player, role: Role, val tttClass: TTTClass?) {
val onlyRemainingRoleGroup = PlayerManager.getOnlyRemainingRoleGroup()
val firstEvent = TTTPlayerDeathEvent(
tttPlayer = this,
location = player.location,
killer = killer,
scream = reallyScream
).call()
val event = TTTPlayerTrueDeathEvent(
tttPlayer = this,
location = player.location,
tttCorpse = tttCorpse,
killer = killer,
scream = reallyScream,
scream = firstEvent.scream,
winnerRoleGroup = onlyRemainingRoleGroup
).call()
@ -234,7 +241,7 @@ class TTTPlayer(player: Player, role: Role, val tttClass: TTTClass?) {
}
fun removeItem(item: TTTItem) {
player.inventory.removeTTTItem(CloakingDevice)
player.inventory.removeTTTItem(item)
item.onRemove(this)
updateItemInHand()
}