Skip to content

Commit

Permalink
Fixed eliminatedjoin msg, added button localization
Browse files Browse the repository at this point in the history
  • Loading branch information
KartoffelChipss committed May 8, 2024
1 parent 3082c7f commit 659acfe
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 28 deletions.
2 changes: 1 addition & 1 deletion dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>org.strassburger</groupId>
<artifactId>LifeStealZ</artifactId>
<name>LifeStealZ</name>
<version>1.1.10</version>
<version>1.1.11</version>
<description>A LifeSteal SMP plugin providing you all the features you need!</description>
<build>
<resources>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>org.strassburger</groupId>
<artifactId>LifeStealZ</artifactId>
<version>1.1.10</version>
<version>1.1.11</version>
<packaging>jar</packaging>

<name>LifeStealZ</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void onPlayerLogin(PlayerLoginEvent event) {
double minHearts = LifeStealZ.getInstance().getConfig().getInt("minHearts") * 2;
if (playerData.getMaxhp() <= minHearts && !disabledBanOnDeath) {
event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
Component kickmsg = MessageUtils.getAndFormatMsg(false, "messages.eliminatedjoin", "&cYou don't have any hearts left!");
Component kickmsg = MessageUtils.getAndFormatMsg(false, "eliminatedJoin", "&cYou don't have any hearts left!");
event.kickMessage(kickmsg);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ public CustomItem setName(String name) {
return this;
}

public CustomItem setName(Component name) {
ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.displayName(name);
itemStack.setItemMeta(itemMeta);

return this;
}

public CustomItem setCustomModelID(int customModelID) {
ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.setCustomModelData(customModelID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ public static ItemStack createRevive() {

public static ItemStack createCloseItem() {
return new CustomItem(Material.BARRIER)
.setName("&cClose")
.setName(MessageUtils.getAndFormatMsg(false, "closeBtn", "&cClose"))
.setCustomModelID(999)
.addFlag(ItemFlag.HIDE_ATTRIBUTES)
.getItemStack();
}

public static ItemStack createBackItem(int page) {
CustomItem ci = new CustomItem(Material.ARROW)
.setName("&cBack")
.setName(MessageUtils.getAndFormatMsg(false, "backBtn", "&cBack"))
.setCustomModelID(998)
.addFlag(ItemFlag.HIDE_ATTRIBUTES);

Expand All @@ -90,7 +90,7 @@ public static ItemStack createBackItem(int page) {

public static ItemStack createNextItem(int page) {
CustomItem ci = new CustomItem(Material.ARROW)
.setName("&cNext")
.setName(MessageUtils.getAndFormatMsg(false, "nextBtn", "&cNext"))
.setCustomModelID(997)
.addFlag(ItemFlag.HIDE_ATTRIBUTES);

Expand Down
43 changes: 23 additions & 20 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,52 +11,55 @@
# https://docs.advntr.dev/minimessage/format.html
# With these, you can also add HEX colors, gradients, hover and click events, etc

# If set to true, LifeStealZ will check for updates and let you know if there's a newer version
checkForUpdates: true

# Set the language to any code found in the "lang" folder (don't add the .yml extension)
# You can add your own language files. Use https://github.com/KartoffelChipss/LifeStealZ/tree/main/src/main/resources/lang/en_US.yml as a template
lang: "en_US"

#A list of worlds, where the plugin should take effect
# A list of worlds, where the plugin should take effect
worlds:
- "world"
- "world_nether"
- "world_the_end"

#The amount of hearts a player has, when joining for the first time
# The amount of hearts a player has, when joining for the first time
startHearts: 10
#The maximal amount of hearts, a player can have
# The maximal amount of hearts, a player can have
maxHearts: 20
# The minimal amount of hearts. If a player gets to this amount of hearts, they will be eliminated.
# PLEASE ONLY CHANGE IF YOU KNOW WHAT YOU ARE DOING!
minHearts: 0
# 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
# 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
# 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
# If a player should lose a heart, when dying to hostile mobs or falldamage, lava, etc
looseHeartsToNature: true
#If a player should lose a heart, when being killed by another player
# If a player should lose a heart, when being killed by another player
looseHeartsToPlayer: true
#Whether it should be announced, when a player got eliminated (has no more hearts)
# Whether it should be announced, when a player got eliminated (has no more hearts)
announceElimination: true

#Allows players to withdraw a heart, even if they only have one left
# Allows players to withdraw a heart, even if they only have one left
allowDyingFromWithdraw: true
#If the totem effect should be played, when you use a heart
# If the totem effect should be played, when you use a heart
playTotemEffect: false
#The time you have to wait, before you can use another heart in Milliseconds
# The time you have to wait, before you can use another heart in Milliseconds
heartCooldown: 0
#How many times a player can be revived. Set to -1 to make it infinite
# How many times a player can be revived. Set to -1 to make it infinite
maxRevives: -1

#If the use of totems of undying should be prevented
# If the use of totems of undying should be prevented
preventTotems: false
#If crystalpvp should be disabled
# If crystalpvp should be disabled
preventCrystalPVP: false

#Only disable this option if you want to add custom commands on elimination and don't want the player to get banned
# Only disable this option if you want to add custom commands on elimination and don't want the player to get banned
disablePlayerBanOnElimination: false
# The amount of hp a player should have after getting eliminated
respawnHP: 10
Expand Down Expand Up @@ -101,7 +104,7 @@ storage:
username: "root"
password: "password"

#Here you can modify everything about the custom items
# Here you can modify everything about the custom items
items:
# DONT DELETE THE defaultheart ITEM!!!
defaultheart:
Expand All @@ -120,9 +123,9 @@ items:
# true if this item should be craftable
craftable: true
recipe:
#Every item represents one slot in the crafting table
#The first item in a row is the left most item in the crafting table
#If you want a slot to be blant, use 'AIR'
# Every item represents one slot in the crafting table
# The first item in a row is the left most item in the crafting table
# If you want a slot to be blank, use 'AIR'
rowOne:
- "GOLD_BLOCK"
- "GOLD_BLOCK"
Expand Down Expand Up @@ -166,7 +169,7 @@ items:
- "AMETHYST_SHARD"
sound:
enabled: false
sound: ENTITY_PLAYER_LEVELUP # Find all sounds here: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Sound.html
sound: ENTITY_PLAYER_LEVELUP
volume: 1.0
pitch: 1.0

Expand Down
9 changes: 7 additions & 2 deletions src/main/resources/lang/de_DE.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# LifeStealZ language file
# de_DE - by Kartoffelchipss

prefix: "&8[&cLifeStealZ&8]"
newVersionAvailable: "&7Eine neue Version von LifeStealZ ist verfügbar!\n&c<click:OPEN_URL:https://modrinth.com/plugin/lifestealz/versions>https://modrinth.com/plugin/lifestealz/versions</click>"
usageError: "&cVerwendung: %usage%"
Expand All @@ -18,10 +21,12 @@ setHeartsConfirm: "&7Die Herzen von &c%player%&7 wurden erfolgreich auf &c%amoun
getHearts: "&c%player% &7hat derzeit &c%amount% &7Herzen!"
reloadMsg: "&7Das Plugin wurde erfolgreich neu geladen!"
versionMsg: "&7Du benutzt Version <red>%version%"
noWithdraw: "&cDu würdest eliminiert werden, wenn du ein Herz auszahlst!"
withdrawConfirmmsg: "&8&oVerwende <underlined><click:SUGGEST_COMMAND:/withdrawheart %amount% confirm>/withdrawheart %amount% confirm</click></underlined>, wenn du wirklich ein Herz auszahlen möchtest."
noWithdraw: "&cDu würdest eliminiert werden, wenn du so viele Herzen auszahlst!"
withdrawConfirmmsg: "&8&oVerwende <underlined><click:SUGGEST_COMMAND:/withdrawheart %amount% confirm>/withdrawheart %amount% confirm</click></underlined>, wenn du wirklich Herzen auszahlen möchtest."
maxHeartLimitReached: "&cDu hast bereits das Limit von %limit% Herzen erreicht!"
closeBtn: "&cSchließen"
backBtn: "&cZurück"
nextBtn: "&cNächste Seite"
reviveTitle: "&8Spieler wiederbeleben"
revivePlayerDesc: "&7Klicke hier, um diesen Spieler wiederzubeleben"
viewheartsYou: "&7Du hast derzeit &c%amount% &7Herzen!"
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/lang/en_US.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# LifeStealZ language file
# en_US - by Kartoffelchipss

prefix: "&8[&cLifeStealZ&8]"
newVersionAvailable: "&7A new version of LifeStealZ is available!\n&c<click:OPEN_URL:https://modrinth.com/plugin/lifestealz/versions>https://modrinth.com/plugin/lifestealz/versions</click>"
usageError: "&cUsage: %usage%"
Expand All @@ -22,6 +25,8 @@ noWithdraw: "&cYou would be eliminated, if you withdraw a heart!"
withdrawConfirmmsg: "&8&oUse <underlined><click:SUGGEST_COMMAND:/withdrawheart %amount% confirm>/withdrawheart %amount% confirm</click></underlined> if you really want to withdraw a heart"
maxHeartLimitReached: "&cYou already reached the limit of %limit% hearts!"
closeBtn: "&cClose"
backBtn: "&cBack"
nextBtn: "&cNext"
reviveTitle: "&8Revive a player"
revivePlayerDesc: "&7Click to revive this player"
viewheartsYou: "&7You currently have &c%amount% &7hearts!"
Expand Down

0 comments on commit 659acfe

Please sign in to comment.