Fix inventory clear after death
This commit is contained in:
parent
fe36541c05
commit
f66b460529
3 changed files with 13 additions and 6 deletions
|
@ -78,7 +78,7 @@ object SecondChance: TTTItem, Buyable {
|
||||||
fun onTTTPlayerTrueDeath(event: TTTPlayerTrueDeathEvent) {
|
fun onTTTPlayerTrueDeath(event: TTTPlayerTrueDeathEvent) {
|
||||||
val state = isc.get(event.tttPlayer)
|
val state = isc.get(event.tttPlayer)
|
||||||
if (state != null) {
|
if (state != null) {
|
||||||
if (Random.nextBoolean()) {
|
if (true || Random.nextBoolean()) {
|
||||||
event.winnerRoleGroup = null
|
event.winnerRoleGroup = null
|
||||||
event.tttPlayer.player.openInventory(chooseSpawnInventory)
|
event.tttPlayer.player.openInventory(chooseSpawnInventory)
|
||||||
state.timeoutAction = TimeoutAction(event.tttPlayer, event.tttCorpse.location)
|
state.timeoutAction = TimeoutAction(event.tttPlayer, event.tttCorpse.location)
|
||||||
|
|
|
@ -9,8 +9,8 @@ import org.bukkit.ChatColor
|
||||||
object Rifle: Gun(
|
object Rifle: Gun(
|
||||||
stateClass = State::class,
|
stateClass = State::class,
|
||||||
displayName = "${ChatColor.YELLOW}${ChatColor.BOLD}Rifle",
|
displayName = "${ChatColor.YELLOW}${ChatColor.BOLD}Rifle",
|
||||||
damage = heartsToHealth(0.5),
|
damage = heartsToHealth(0.8),
|
||||||
cooldown = 0.1,
|
cooldown = 0.15,
|
||||||
magazineSize = 40,
|
magazineSize = 40,
|
||||||
reloadTime = 2.0,
|
reloadTime = 2.0,
|
||||||
itemMaterial = Resourcepack.Items.rifle,
|
itemMaterial = Resourcepack.Items.rifle,
|
||||||
|
|
|
@ -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.ItemManager
|
||||||
import de.moritzruth.spigot_ttt.game.items.Selectable
|
import de.moritzruth.spigot_ttt.game.items.Selectable
|
||||||
import de.moritzruth.spigot_ttt.game.items.TTTItem
|
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.game.items.shop.Shop
|
||||||
import de.moritzruth.spigot_ttt.utils.*
|
import de.moritzruth.spigot_ttt.utils.*
|
||||||
import org.bukkit.*
|
import org.bukkit.*
|
||||||
|
@ -79,6 +78,7 @@ class TTTPlayer(player: Player, role: Role, val tttClass: TTTClass?) {
|
||||||
|
|
||||||
alive = false
|
alive = false
|
||||||
player.gameMode = GameMode.SPECTATOR
|
player.gameMode = GameMode.SPECTATOR
|
||||||
|
Shop.clear(this)
|
||||||
|
|
||||||
var reallyScream = scream
|
var reallyScream = scream
|
||||||
|
|
||||||
|
@ -107,12 +107,19 @@ class TTTPlayer(player: Player, role: Role, val tttClass: TTTClass?) {
|
||||||
|
|
||||||
val onlyRemainingRoleGroup = PlayerManager.getOnlyRemainingRoleGroup()
|
val onlyRemainingRoleGroup = PlayerManager.getOnlyRemainingRoleGroup()
|
||||||
|
|
||||||
|
val firstEvent = TTTPlayerDeathEvent(
|
||||||
|
tttPlayer = this,
|
||||||
|
location = player.location,
|
||||||
|
killer = killer,
|
||||||
|
scream = reallyScream
|
||||||
|
).call()
|
||||||
|
|
||||||
val event = TTTPlayerTrueDeathEvent(
|
val event = TTTPlayerTrueDeathEvent(
|
||||||
tttPlayer = this,
|
tttPlayer = this,
|
||||||
location = player.location,
|
location = player.location,
|
||||||
tttCorpse = tttCorpse,
|
tttCorpse = tttCorpse,
|
||||||
killer = killer,
|
killer = killer,
|
||||||
scream = reallyScream,
|
scream = firstEvent.scream,
|
||||||
winnerRoleGroup = onlyRemainingRoleGroup
|
winnerRoleGroup = onlyRemainingRoleGroup
|
||||||
).call()
|
).call()
|
||||||
|
|
||||||
|
@ -234,7 +241,7 @@ class TTTPlayer(player: Player, role: Role, val tttClass: TTTClass?) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun removeItem(item: TTTItem) {
|
fun removeItem(item: TTTItem) {
|
||||||
player.inventory.removeTTTItem(CloakingDevice)
|
player.inventory.removeTTTItem(item)
|
||||||
item.onRemove(this)
|
item.onRemove(this)
|
||||||
updateItemInHand()
|
updateItemInHand()
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue