@@ -219,7 +219,7 @@ private ItemStack updatePlayerKills(ItemStack itemStack) {
219219 toolStats .logger .warning (itemStack + " does NOT have any meta! Unable to update stats." );
220220 return null ;
221221 }
222- Integer playerKills = null ;
222+ Integer playerKills ;
223223 PersistentDataContainer container = meta .getPersistentDataContainer ();
224224 if (container .has (toolStats .swordPlayerKills , PersistentDataType .INTEGER )) {
225225 playerKills = container .get (toolStats .swordPlayerKills , PersistentDataType .INTEGER );
@@ -243,6 +243,7 @@ private ItemStack updatePlayerKills(ItemStack itemStack) {
243243 }
244244
245245 List <String > lore ;
246+ String newLine = playerKillsLoreRaw .replace ("{kills}" , toolStats .commaFormat .format (playerKills ));
246247 if (meta .hasLore ()) {
247248 lore = meta .getLore ();
248249 boolean hasLore = false ;
@@ -251,18 +252,18 @@ private ItemStack updatePlayerKills(ItemStack itemStack) {
251252 for (int x = 0 ; x < lore .size (); x ++) {
252253 if (lore .get (x ).contains (playerKillsLore )) {
253254 hasLore = true ;
254- lore .set (x , playerKillsLoreRaw . replace ( "{kills}" , toolStats . commaFormat . format ( playerKills )) );
255+ lore .set (x , newLine );
255256 break ;
256257 }
257258 }
258259 // if the item has lore but doesn't have the tag, add it
259260 if (!hasLore ) {
260- lore .add (playerKillsLoreRaw . replace ( "{kills}" , toolStats . commaFormat . format ( playerKills )) );
261+ lore .add (newLine );
261262 }
262263 } else {
263264 // if the item has no lore, create a new list and add the string
264265 lore = new ArrayList <>();
265- lore .add (playerKillsLoreRaw . replace ( "{kills}" , toolStats . commaFormat . format ( playerKills )) );
266+ lore .add (newLine );
266267 }
267268 // do we add the lore based on the config?
268269 if (toolStats .checkConfig (itemStack , "player-kills" )) {
@@ -285,7 +286,7 @@ private ItemStack updateMobKills(ItemStack itemStack) {
285286 toolStats .logger .warning (itemStack + " does NOT have any meta! Unable to update stats." );
286287 return null ;
287288 }
288- Integer mobKills = null ;
289+ Integer mobKills ;
289290 PersistentDataContainer container = meta .getPersistentDataContainer ();
290291 if (container .has (toolStats .swordMobKills , PersistentDataType .INTEGER )) {
291292 mobKills = container .get (toolStats .swordMobKills , PersistentDataType .INTEGER );
@@ -310,6 +311,7 @@ private ItemStack updateMobKills(ItemStack itemStack) {
310311 }
311312
312313 List <String > lore ;
314+ String newLine = mobKillsLoreRaw .replace ("{kills}" , toolStats .commaFormat .format (mobKills ));
313315 if (meta .hasLore ()) {
314316 lore = meta .getLore ();
315317 boolean hasLore = false ;
@@ -318,18 +320,18 @@ private ItemStack updateMobKills(ItemStack itemStack) {
318320 for (int x = 0 ; x < lore .size (); x ++) {
319321 if (lore .get (x ).contains (mobKillsLore )) {
320322 hasLore = true ;
321- lore .set (x , mobKillsLoreRaw . replace ( "{kills}" , toolStats . commaFormat . format ( mobKills )) );
323+ lore .set (x , newLine );
322324 break ;
323325 }
324326 }
325327 // if the item has lore but doesn't have the tag, add it
326328 if (!hasLore ) {
327- lore .add (mobKillsLoreRaw . replace ( "{kills}" , toolStats . commaFormat . format ( mobKills )) );
329+ lore .add (newLine );
328330 }
329331 } else {
330332 // if the item has no lore, create a new list and add the string
331333 lore = new ArrayList <>();
332- lore .add (mobKillsLoreRaw . replace ( "{kills}" , toolStats . commaFormat . format ( mobKills )) );
334+ lore .add (newLine );
333335 }
334336 // do we add the lore based on the config?
335337 if (toolStats .checkConfig (itemStack , "mob-kills" )) {
@@ -376,6 +378,7 @@ private void updateArmorDamage(ItemStack itemStack, double damage) {
376378 }
377379
378380 List <String > lore ;
381+ String newLine = damageTakenLoreRaw .replace ("{damage}" , toolStats .decimalFormat .format (damageTaken ));
379382 if (meta .hasLore ()) {
380383 lore = meta .getLore ();
381384 boolean hasLore = false ;
@@ -384,18 +387,18 @@ private void updateArmorDamage(ItemStack itemStack, double damage) {
384387 for (int x = 0 ; x < lore .size (); x ++) {
385388 if (lore .get (x ).contains (damageTakenLore )) {
386389 hasLore = true ;
387- lore .set (x , damageTakenLoreRaw . replace ( "{damage}" , toolStats . decimalFormat . format ( damageTaken )) );
390+ lore .set (x , newLine );
388391 break ;
389392 }
390393 }
391394 // if the item has lore but doesn't have the tag, add it
392395 if (!hasLore ) {
393- lore .add (damageTakenLoreRaw . replace ( "{damage}" , toolStats . decimalFormat . format ( damageTaken )) );
396+ lore .add (newLine );
394397 }
395398 } else {
396399 // if the item has no lore, create a new list and add the string
397400 lore = new ArrayList <>();
398- lore .add (damageTakenLoreRaw . replace ( "{damage}" , toolStats . decimalFormat . format ( damageTaken )) );
401+ lore .add (newLine );
399402 }
400403 if (toolStats .config .getBoolean ("enabled.armor-damage" )) {
401404 meta .setLore (lore );
0 commit comments