@@ -129,6 +129,25 @@ private void fixItemLore(ItemStack original, Player player) {
129129 }
130130 }
131131 }
132+
133+ // hard code elytras
134+ if (finalItem .getType () == Material .ELYTRA ) {
135+ if (toolStats .config .getBoolean ("enabled.elytra-tag" )) {
136+ lore .add (toolStats .getLoreFromConfig ("looted.found-by" , true ).replace ("{player}" , player .getName ()));
137+ if (container .has (toolStats .timeCreated , PersistentDataType .LONG )) {
138+ Long time = container .get (toolStats .timeCreated , PersistentDataType .LONG );
139+ if (time != null ) {
140+ lore .add (toolStats .getLoreFromConfig ("looted.found-on" , true ).replace ("{date}" , format .format (new Date (time ))));
141+ }
142+ }
143+ finalMeta .setLore (lore );
144+ finalItem .setItemMeta (finalMeta );
145+ int slot = player .getInventory ().getHeldItemSlot ();
146+ player .getInventory ().setItem (slot , finalItem );
147+ return ;
148+ }
149+ }
150+
132151 if (toolStats .checkConfig (original , "created-by" )) {
133152 if (container .has (toolStats .genericOwner , new UUIDDataType ())) {
134153 container .set (toolStats .genericOwner , new UUIDDataType (), player .getUniqueId ());
@@ -143,7 +162,7 @@ private void fixItemLore(ItemStack original, Player player) {
143162 break ;
144163 }
145164 case "LOOTED" : {
146- lore .add (toolStats .getLoreFromConfig ("looted.looted -by" , true ).replace ("{player}" , player .getName ()));
165+ lore .add (toolStats .getLoreFromConfig ("looted.found -by" , true ).replace ("{player}" , player .getName ()));
147166 break ;
148167 }
149168 case "TRADED" : {
@@ -156,86 +175,81 @@ private void fixItemLore(ItemStack original, Player player) {
156175 if (toolStats .checkConfig (original , "created-date" )) {
157176 if (container .has (toolStats .timeCreated , PersistentDataType .LONG )) {
158177 Long time = container .get (toolStats .timeCreated , PersistentDataType .LONG );
159- if (time == null ) {
160- return ;
161- }
162- // show how when the item was created based on the previous lore
163- switch (type ) {
164- case "DEFAULT" : {
165- lore .add (toolStats .getLoreFromConfig ("created.created-on" , true ).replace ("{date}" , format .format (new Date (time ))));
166- break ;
167- }
168- case "CAUGHT" : {
169- lore .add (toolStats .getLoreFromConfig ("fished.caught-on" , true ).replace ("{date}" , format .format (new Date (time ))));
170- break ;
171- }
172- case "LOOTED" : {
173- lore .add (toolStats .getLoreFromConfig ("looted.looted-on" , true ).replace ("{date}" , format .format (new Date (time ))));
174- break ;
175- }
176- case "TRADED" : {
177- lore .add (toolStats .getLoreFromConfig ("traded.traded-on" , true ).replace ("{date}" , format .format (new Date (time ))));
178- break ;
178+ if (time != null ) {
179+ // show how when the item was created based on the previous lore
180+ switch (type ) {
181+ case "DEFAULT" : {
182+ lore .add (toolStats .getLoreFromConfig ("created.created-on" , true ).replace ("{date}" , format .format (new Date (time ))));
183+ break ;
184+ }
185+ case "CAUGHT" : {
186+ lore .add (toolStats .getLoreFromConfig ("fished.caught-on" , true ).replace ("{date}" , format .format (new Date (time ))));
187+ break ;
188+ }
189+ case "LOOTED" : {
190+ lore .add (toolStats .getLoreFromConfig ("looted.foundon" , true ).replace ("{date}" , format .format (new Date (time ))));
191+ break ;
192+ }
193+ case "TRADED" : {
194+ lore .add (toolStats .getLoreFromConfig ("traded.traded-on" , true ).replace ("{date}" , format .format (new Date (time ))));
195+ break ;
196+ }
179197 }
180198 }
181199 }
182200 }
183201 if (toolStats .checkConfig (original , "player-kills" )) {
184202 if (container .has (toolStats .swordPlayerKills , PersistentDataType .INTEGER )) {
185203 Integer kills = container .get (toolStats .swordPlayerKills , PersistentDataType .INTEGER );
186- if (kills = = null ) {
187- return ;
204+ if (kills ! = null ) {
205+ lore . add ( toolStats . getLoreFromConfig ( "kills.player" , true ). replace ( "{kills}" , Integer . toString ( kills ))) ;
188206 }
189- lore .add (toolStats .getLoreFromConfig ("kills.player" , true ).replace ("{kills}" , Integer .toString (kills )));
190207 }
191208 }
192209 if (toolStats .checkConfig (original , "mob-kills" )) {
193210 if (container .has (toolStats .swordMobKills , PersistentDataType .INTEGER )) {
194211 Integer kills = container .get (toolStats .swordMobKills , PersistentDataType .INTEGER );
195- if (kills = = null ) {
196- return ;
212+ if (kills ! = null ) {
213+ lore . add ( toolStats . getLoreFromConfig ( "kills.mob" , true ). replace ( "{kills}" , Integer . toString ( kills ))) ;
197214 }
198- lore .add (toolStats .getLoreFromConfig ("kills.mob" , true ).replace ("{kills}" , Integer .toString (kills )));
199215 }
200216 }
201217 if (toolStats .checkConfig (original , "blocks-mined" )) {
202218 if (container .has (toolStats .genericMined , PersistentDataType .INTEGER )) {
203219 Integer blocksMined = container .get (toolStats .genericMined , PersistentDataType .INTEGER );
204- if (blocksMined = = null ) {
205- return ;
220+ if (blocksMined ! = null ) {
221+ lore . add ( toolStats . getLoreFromConfig ( "blocks-mined" , true ). replace ( "{blocks}" , Integer . toString ( blocksMined ))) ;
206222 }
207- lore .add (toolStats .getLoreFromConfig ("blocks-mined" , true ).replace ("{blocks}" , Integer .toString (blocksMined )));
208223 }
209224 }
210225 if (toolStats .config .getBoolean ("enabled.fish-caught" )) {
211226 if (container .has (toolStats .fishingRodCaught , PersistentDataType .INTEGER )) {
212227 Integer fish = container .get (toolStats .fishingRodCaught , PersistentDataType .INTEGER );
213- if (fish = = null ) {
214- return ;
228+ if (fish ! = null ) {
229+ lore . add ( toolStats . getLoreFromConfig ( "fished.fish-caught" , true ). replace ( "{fish}" , Integer . toString ( fish ))) ;
215230 }
216- lore .add (toolStats .getLoreFromConfig ("fished.fish-caught" , true ).replace ("{fish}" , Integer .toString (fish )));
217231 }
218232 }
219233 if (toolStats .config .getBoolean ("enabled.sheep-sheared" )) {
220234 if (container .has (toolStats .shearsSheared , PersistentDataType .INTEGER )) {
221235 Integer sheep = container .get (toolStats .shearsSheared , PersistentDataType .INTEGER );
222- if (sheep = = null ) {
223- return ;
236+ if (sheep ! = null ) {
237+ lore . add ( toolStats . getLoreFromConfig ( "sheep-sheared" , true ). replace ( "{sheep}" , Integer . toString ( sheep ))) ;
224238 }
225- lore .add (toolStats .getLoreFromConfig ("sheep-sheared" , true ).replace ("{sheep}" , Integer .toString (sheep )));
226239 }
227240 }
228241 if (toolStats .config .getBoolean ("enabled.armor-damage" )) {
229242 if (container .has (toolStats .armorDamage , PersistentDataType .INTEGER )) {
230243 Integer damage = container .get (toolStats .armorDamage , PersistentDataType .INTEGER );
231- if (damage = = null ) {
232- return ;
244+ if (damage ! = null ) {
245+ lore . add ( toolStats . getLoreFromConfig ( "damage-taken" , true ). replace ( "{damage}" , Integer . toString ( damage ))) ;
233246 }
234- lore .add (toolStats .getLoreFromConfig ("damage-taken" , true ).replace ("{damage}" , Integer .toString (damage )));
235247 }
236248 }
237249 finalMeta .setLore (lore );
238250 finalItem .setItemMeta (finalMeta );
251+ int slot = player .getInventory ().getHeldItemSlot ();
252+ player .getInventory ().setItem (slot , finalItem );
239253 }
240254
241255 @ Nullable
0 commit comments