Skip to content

Commit

Permalink
Revive fix
Browse files Browse the repository at this point in the history
  • Loading branch information
KartoffelChipss committed Mar 16, 2024
1 parent a154cbc commit e9cc588
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 33 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ LifeStealZ offers a great amount of admin tools and is highly customizable. You
* ✅ Custom crafting recipes
* ✅ Revive item
* ✅ Maximal and starter hearts
* ✅ Optional heart loss by natural death
* ✅ Disable totems
* ✅ Disable crystal pvp
* ✅ Ingame recipe viewer
* ✅ PlaceholderAPI placeholders
* ✅ Custom WorldGuard flags
* ✅ Admin commands
* ✅ HEX colors and gradients support

<br>

Expand Down Expand Up @@ -65,6 +65,12 @@ Here is an example of the configuration file:
# | |____| | || __/ ____) | || __/ (_| | | / /__
# |______|_|_| \___| |_____/ \__\___|\__,_|_| /_____|

# !!! COLOR CODES !!!
# This plugin supports old color codes like: &c, &l, &o, etc
# It also supports minimessage, which is a more advanced way to format messages:
# https://docs.advntr.dev/minimessage/format.html
# With these, you can also add HEX colors, gradients, hover and click events, etc

#A list of worlds, where the plugin should take effect
worlds:
- "world"
Expand All @@ -78,6 +84,8 @@ maxHearts: 20
# This option will enforce the heart limit on admin commands like /lifestealz hearts <add, set> <player> <amount>
enforceMaxHeartsOnAdminCommands: false

#If hearts should be dropped instead of directly added to the killer
dropHearts: false
#If a heart should be dropped, when the killer already has the max amount of hearts
dropHeartsIfMax: true
#If a player should lose a heart, when dying to hostile mobs or falldamage, lava, etc
Expand Down Expand Up @@ -178,7 +186,7 @@ messages:
setHeartsConfirm: "&7Successfully set &c%player%&7's hearts to &c%amount%"
getHearts: "&c%player% &7currently has &c%amount% &7hearts!"
reloadMsg: "&7Successfully reloaded the plugin!"
versionMsg: "&7You are using version %version%"
versionMsg: "&7You are using version <red>%version%"
noWithdraw: "&cYou would be eliminated, if you withdraw a heart!"
withdrawConfirmmsg: "&8&oUse /withdrawheart confirm if you really want to withdraw a heart"
maxHeartLimitReached: "&cYou already reached the limit of %limit% hearts!"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.strassburger.lifestealz.listener
import net.kyori.adventure.text.Component
import org.bukkit.Bukkit
import org.bukkit.Material
import org.bukkit.Sound
import org.bukkit.command.CommandSender
import org.bukkit.entity.Player
import org.bukkit.event.EventHandler
Expand Down Expand Up @@ -48,8 +49,6 @@ class InventoryClickListener : Listener {
}

Material.PLAYER_HEAD -> {
val playerdata = ManagePlayerdata().getPlayerData(name = player.name, uuid = player.uniqueId.toString())

if (!player.hasPermission("lifestealz.revive")) {
throwPermissionError(player)
return
Expand Down Expand Up @@ -93,6 +92,8 @@ class InventoryClickListener : Listener {

event.inventory.close()

player.playSound(player.location, Sound.ENTITY_PLAYER_LEVELUP, 500.0f, 1.0f)

player.sendMessage(getAndFormatMsg(true, "messages.reviveSuccess", "&7You successfully revived &c%player%&7!", Replaceable("%player%", targetPlayer.name!!)))

val mainHandItem = player.inventory.itemInMainHand
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class PlayerInteractionListener : Listener {
}

if (isReviveCrystal(item)) {
val dir = File("./plugins/lifestealz/userData")
val dir: File = Lifestealz.instance.dataFolder
if (!dir.exists()) {
dir.mkdirs()
}
Expand All @@ -73,21 +73,21 @@ class PlayerInteractionListener : Listener {

addNavbar(inventory)

//player.sendMessage(uuidList.toString())
// player.sendMessage(uuidList.toString())

for (uuidString in uuidList) {
//player.sendMessage(Component.text(uuidString))
// player.sendMessage(Component.text(uuidString))
val uuid: UUID = convertStringToUUID(uuidString) ?: continue

val offlinePlayer = Bukkit.getOfflinePlayer(uuid)

//player.sendMessage(Component.text(offlinePlayer.name?: "no name"))
// player.sendMessage(Component.text(offlinePlayer.name?: "no name"))

if (offlinePlayer.name == null) continue

val offlinePlayerData = ManagePlayerdata().getPlayerData(name = offlinePlayer.name!!, uuid = offlinePlayer.uniqueId.toString())

//player.sendMessage(Component.text("Maxhp: " + offlinePlayerData.maxhp.toString()))
// player.sendMessage(Component.text("Maxhp: " + offlinePlayerData.maxhp.toString()))

if (offlinePlayerData.maxhp > 0.0) continue

Expand Down Expand Up @@ -168,7 +168,7 @@ class PlayerInteractionListener : Listener {
skullMeta.displayName(Component.text("§d" + offlinePlayer.name))
val lines: MutableList<Component> = mutableListOf(
Lifestealz.getAndFormatMsg(false, "messages.revivePlayerDesc", "&7Click to revive this player"),
Lifestealz.formatMsg("§8" + offlinePlayer.uniqueId.toString())
Lifestealz.formatMsg("<dark_gray>" + offlinePlayer.uniqueId.toString())
)
skullMeta.lore(lines)
skullMeta.owningPlayer = offlinePlayer
Expand Down
23 changes: 0 additions & 23 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,29 +110,6 @@ items:
- "NETHERITE_BLOCK"
- "AMETHYST_SHARD"

customHeartItems:
3hearts:
name: "<dark_red>3 <red>Hearts"
lore:
- "&7Rightclick to use"
material: "NETHER_STAR"
enchanted: true
customModelData: 105
craftable: true
recipe:
rowOne:
- "DIAMOND_BLOCK"
- "DIAMOND_BLOCK"
- "DIAMOND_BLOCK"
rowTwo:
- "NETHERITE_INGOT"
- "NETHER_STAR"
- "NETHERITE_INGOT"
rowThree:
- "DIAMOND_BLOCK"
- "DIAMOND_BLOCK"
- "DIAMOND_BLOCK"

#You can modify all messages here
messages:
prefix: "&8[&cLifeStealZ&8]"
Expand Down

0 comments on commit e9cc588

Please sign in to comment.