From 659acfe3db707379d55ecba088b530ec637dd0b8 Mon Sep 17 00:00:00 2001 From: KartoffelChipss Date: Wed, 8 May 2024 21:29:38 +0200 Subject: [PATCH] Fixed eliminatedjoin msg, added button localization --- dependency-reduced-pom.xml | 2 +- pom.xml | 2 +- .../listeners/PlayerLoginListener.java | 2 +- .../util/customitems/CustomItem.java | 8 ++++ .../util/customitems/CustomItemManager.java | 6 +-- src/main/resources/config.yml | 43 ++++++++++--------- src/main/resources/lang/de_DE.yml | 9 +++- src/main/resources/lang/en_US.yml | 5 +++ 8 files changed, 49 insertions(+), 28 deletions(-) diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml index 0c6c50dc..49b0a01f 100644 --- a/dependency-reduced-pom.xml +++ b/dependency-reduced-pom.xml @@ -4,7 +4,7 @@ org.strassburger LifeStealZ LifeStealZ - 1.1.10 + 1.1.11 A LifeSteal SMP plugin providing you all the features you need! diff --git a/pom.xml b/pom.xml index 4ed2b347..3568fab4 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.strassburger LifeStealZ - 1.1.10 + 1.1.11 jar LifeStealZ diff --git a/src/main/java/org/strassburger/lifestealz/listeners/PlayerLoginListener.java b/src/main/java/org/strassburger/lifestealz/listeners/PlayerLoginListener.java index feed45e0..f5ab6046 100644 --- a/src/main/java/org/strassburger/lifestealz/listeners/PlayerLoginListener.java +++ b/src/main/java/org/strassburger/lifestealz/listeners/PlayerLoginListener.java @@ -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); } diff --git a/src/main/java/org/strassburger/lifestealz/util/customitems/CustomItem.java b/src/main/java/org/strassburger/lifestealz/util/customitems/CustomItem.java index 3835103b..069cf8a4 100644 --- a/src/main/java/org/strassburger/lifestealz/util/customitems/CustomItem.java +++ b/src/main/java/org/strassburger/lifestealz/util/customitems/CustomItem.java @@ -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); diff --git a/src/main/java/org/strassburger/lifestealz/util/customitems/CustomItemManager.java b/src/main/java/org/strassburger/lifestealz/util/customitems/CustomItemManager.java index e62628c2..b73f0003 100644 --- a/src/main/java/org/strassburger/lifestealz/util/customitems/CustomItemManager.java +++ b/src/main/java/org/strassburger/lifestealz/util/customitems/CustomItemManager.java @@ -69,7 +69,7 @@ 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(); @@ -77,7 +77,7 @@ public static ItemStack createCloseItem() { 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); @@ -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); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 84012e06..efabfe4e 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -11,19 +11,22 @@ # 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! @@ -31,32 +34,32 @@ minHearts: 0 # This option will enforce the heart limit on admin commands like /lifestealz hearts 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 @@ -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: @@ -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" @@ -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 diff --git a/src/main/resources/lang/de_DE.yml b/src/main/resources/lang/de_DE.yml index 68e8db3d..7252d6f8 100644 --- a/src/main/resources/lang/de_DE.yml +++ b/src/main/resources/lang/de_DE.yml @@ -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&chttps://modrinth.com/plugin/lifestealz/versions" usageError: "&cVerwendung: %usage%" @@ -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 %version%" -noWithdraw: "&cDu würdest eliminiert werden, wenn du ein Herz auszahlst!" -withdrawConfirmmsg: "&8&oVerwende /withdrawheart %amount% confirm, wenn du wirklich ein Herz auszahlen möchtest." +noWithdraw: "&cDu würdest eliminiert werden, wenn du so viele Herzen auszahlst!" +withdrawConfirmmsg: "&8&oVerwende /withdrawheart %amount% confirm, 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!" diff --git a/src/main/resources/lang/en_US.yml b/src/main/resources/lang/en_US.yml index 3659e941..91761cd5 100644 --- a/src/main/resources/lang/en_US.yml +++ b/src/main/resources/lang/en_US.yml @@ -1,3 +1,6 @@ +# LifeStealZ language file +# en_US - by Kartoffelchipss + prefix: "&8[&cLifeStealZ&8]" newVersionAvailable: "&7A new version of LifeStealZ is available!\n&chttps://modrinth.com/plugin/lifestealz/versions" usageError: "&cUsage: %usage%" @@ -22,6 +25,8 @@ noWithdraw: "&cYou would be eliminated, if you withdraw a heart!" withdrawConfirmmsg: "&8&oUse /withdrawheart %amount% confirm 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!"