1919
2020public class PlayerPlaceholders {
2121 public static void register () {
22- Placeholders .register (new Identifier ("player" , "name" ), (ctx , arg ) -> {
22+ Placeholders .register (Identifier . of ("player" , "name" ), (ctx , arg ) -> {
2323 if (ctx .hasPlayer ()) {
2424 return PlaceholderResult .value (ctx .player ().getName ());
2525 } else if (ctx .hasGameProfile ()) {
@@ -29,7 +29,7 @@ public static void register() {
2929 }
3030 });
3131
32- Placeholders .register (new Identifier ("player" , "name_visual" ), (ctx , arg ) -> {
32+ Placeholders .register (Identifier . of ("player" , "name_visual" ), (ctx , arg ) -> {
3333 if (ctx .hasPlayer ()) {
3434 return PlaceholderResult .value (GeneralUtils .removeHoverAndClick (ctx .player ().getName ()));
3535 } else if (ctx .hasGameProfile ()) {
@@ -39,7 +39,7 @@ public static void register() {
3939 }
4040 });
4141
42- Placeholders .register (new Identifier ("player" , "name_unformatted" ), (ctx , arg ) -> {
42+ Placeholders .register (Identifier . of ("player" , "name_unformatted" ), (ctx , arg ) -> {
4343 if (ctx .hasPlayer ()) {
4444 return PlaceholderResult .value (ctx .player ().getName ().getString ());
4545 } else if (ctx .hasGameProfile ()) {
@@ -49,15 +49,15 @@ public static void register() {
4949 }
5050 });
5151
52- Placeholders .register (new Identifier ("player" , "ping" ), (ctx , arg ) -> {
52+ Placeholders .register (Identifier . of ("player" , "ping" ), (ctx , arg ) -> {
5353 if (ctx .hasPlayer ()) {
5454 return PlaceholderResult .value (String .valueOf (ctx .player ().networkHandler .getLatency ()));
5555 } else {
5656 return PlaceholderResult .invalid ("No player!" );
5757 }
5858 });
5959
60- Placeholders .register (new Identifier ("player" , "ping_colored" ), (ctx , arg ) -> {
60+ Placeholders .register (Identifier . of ("player" , "ping_colored" ), (ctx , arg ) -> {
6161 if (ctx .hasPlayer ()) {
6262 int x = ctx .player ().networkHandler .getLatency ();
6363 return PlaceholderResult .value (Text .literal (String .valueOf (x )).formatted (x < 100 ? Formatting .GREEN : x < 200 ? Formatting .GOLD : Formatting .RED ));
@@ -66,7 +66,7 @@ public static void register() {
6666 }
6767 });
6868
69- Placeholders .register (new Identifier ("player" , "displayname" ), (ctx , arg ) -> {
69+ Placeholders .register (Identifier . of ("player" , "displayname" ), (ctx , arg ) -> {
7070 if (ctx .hasPlayer ()) {
7171 return PlaceholderResult .value (ctx .player ().getDisplayName ());
7272 } else if (ctx .hasGameProfile ()) {
@@ -76,9 +76,9 @@ public static void register() {
7676 }
7777 });
7878
79- Placeholders .register (new Identifier ("player" , "display_name" ), Placeholders .getPlaceholders ().get (new Identifier ("player" , "displayname" )));
79+ Placeholders .register (Identifier . of ("player" , "display_name" ), Placeholders .getPlaceholders ().get (Identifier . of ("player" , "displayname" )));
8080
81- Placeholders .register (new Identifier ("player" , "displayname_visual" ), (ctx , arg ) -> {
81+ Placeholders .register (Identifier . of ("player" , "displayname_visual" ), (ctx , arg ) -> {
8282 if (ctx .hasPlayer ()) {
8383 return PlaceholderResult .value (GeneralUtils .removeHoverAndClick (ctx .player ().getDisplayName ()));
8484 } else if (ctx .hasGameProfile ()) {
@@ -88,9 +88,9 @@ public static void register() {
8888 }
8989 });
9090
91- Placeholders .register (new Identifier ("player" , "display_name_visual" ), Placeholders .getPlaceholders ().get (new Identifier ("player" , "displayname_visual" )));
91+ Placeholders .register (Identifier . of ("player" , "display_name_visual" ), Placeholders .getPlaceholders ().get (Identifier . of ("player" , "displayname_visual" )));
9292
93- Placeholders .register (new Identifier ("player" , "displayname_unformatted" ), (ctx , arg ) -> {
93+ Placeholders .register (Identifier . of ("player" , "displayname_unformatted" ), (ctx , arg ) -> {
9494 if (ctx .hasPlayer ()) {
9595 return PlaceholderResult .value (Text .literal (ctx .player ().getDisplayName ().getString ()));
9696 } else if (ctx .hasGameProfile ()) {
@@ -99,9 +99,9 @@ public static void register() {
9999 return PlaceholderResult .invalid ("No player!" );
100100 }
101101 });
102- Placeholders .register (new Identifier ("player" , "display_name_unformatted" ), Placeholders .getPlaceholders ().get (new Identifier ("player" , "displayname_unformatted" )));
102+ Placeholders .register (Identifier . of ("player" , "display_name_unformatted" ), Placeholders .getPlaceholders ().get (Identifier . of ("player" , "displayname_unformatted" )));
103103
104- Placeholders .register (new Identifier ("player" , "inventory_slot" ), (ctx , arg ) -> {
104+ Placeholders .register (Identifier . of ("player" , "inventory_slot" ), (ctx , arg ) -> {
105105 if (ctx .hasPlayer () && arg != null ) {
106106 try {
107107 int slot = Integer .parseInt (arg );
@@ -123,7 +123,7 @@ public static void register() {
123123 }
124124 });
125125
126- Placeholders .register (new Identifier ("player" , "inventory_slot_no_rarity" ), (ctx , arg ) -> {
126+ Placeholders .register (Identifier . of ("player" , "inventory_slot_no_rarity" ), (ctx , arg ) -> {
127127 if (ctx .hasPlayer () && arg != null ) {
128128 try {
129129 int slot = Integer .parseInt (arg );
@@ -145,7 +145,7 @@ public static void register() {
145145 }
146146 });
147147
148- Placeholders .register (new Identifier ("player" , "equipment_slot" ), (ctx , arg ) -> {
148+ Placeholders .register (Identifier . of ("player" , "equipment_slot" ), (ctx , arg ) -> {
149149 if (ctx .hasPlayer () && arg != null ) {
150150 try {
151151 var slot = EquipmentSlot .byName (arg );
@@ -161,7 +161,7 @@ public static void register() {
161161 }
162162 });
163163
164- Placeholders .register (new Identifier ("player" , "equipment_slot_no_rarity" ), (ctx , arg ) -> {
164+ Placeholders .register (Identifier . of ("player" , "equipment_slot_no_rarity" ), (ctx , arg ) -> {
165165 if (ctx .hasPlayer () && arg != null ) {
166166 try {
167167 var slot = EquipmentSlot .byName (arg );
@@ -177,7 +177,7 @@ public static void register() {
177177 }
178178 });
179179
180- Placeholders .register (new Identifier ("player" , "playtime" ), (ctx , arg ) -> {
180+ Placeholders .register (Identifier . of ("player" , "playtime" ), (ctx , arg ) -> {
181181 if (ctx .hasPlayer ()) {
182182 int x = ctx .player ().getStatHandler ().getStat (Stats .CUSTOM .getOrCreateStat (Stats .PLAY_TIME ));
183183 return PlaceholderResult .value (arg != null
@@ -189,7 +189,7 @@ public static void register() {
189189 }
190190 });
191191
192- Placeholders .register (new Identifier ("player" , "statistic" ), (ctx , arg ) -> {
192+ Placeholders .register (Identifier . of ("player" , "statistic" ), (ctx , arg ) -> {
193193 if (ctx .hasPlayer () && arg != null ) {
194194 try {
195195 var args = arg .split (" " );
@@ -226,7 +226,7 @@ public static void register() {
226226 }
227227 });
228228
229- Placeholders .register (new Identifier ("player" , "statistic_raw" ), (ctx , arg ) -> {
229+ Placeholders .register (Identifier . of ("player" , "statistic_raw" ), (ctx , arg ) -> {
230230 if (ctx .hasPlayer () && arg != null ) {
231231 try {
232232 var args = arg .split (" " );
@@ -263,7 +263,7 @@ public static void register() {
263263 }
264264 });
265265
266- Placeholders .register (new Identifier ("player" , "objective" ), (ctx , arg ) -> {
266+ Placeholders .register (Identifier . of ("player" , "objective" ), (ctx , arg ) -> {
267267 if (ctx .hasPlayer () && arg != null ) {
268268 try {
269269 ServerScoreboard scoreboard = ctx .server ().getScoreboard ();
@@ -282,7 +282,7 @@ public static void register() {
282282 }
283283 });
284284
285- Placeholders .register (new Identifier ("player" , "pos_x" ), (ctx , arg ) -> {
285+ Placeholders .register (Identifier . of ("player" , "pos_x" ), (ctx , arg ) -> {
286286 if (ctx .hasPlayer ()) {
287287 double value = ctx .player ().getX ();
288288 String format = "%.2f" ;
@@ -302,7 +302,7 @@ public static void register() {
302302 }
303303 });
304304
305- Placeholders .register (new Identifier ("player" , "pos_y" ), (ctx , arg ) -> {
305+ Placeholders .register (Identifier . of ("player" , "pos_y" ), (ctx , arg ) -> {
306306 if (ctx .hasPlayer ()) {
307307 double value = ctx .player ().getY ();
308308 String format = "%.2f" ;
@@ -322,7 +322,7 @@ public static void register() {
322322 }
323323 });
324324
325- Placeholders .register (new Identifier ("player" , "pos_z" ), (ctx , arg ) -> {
325+ Placeholders .register (Identifier . of ("player" , "pos_z" ), (ctx , arg ) -> {
326326 if (ctx .hasPlayer ()) {
327327 double value = ctx .player ().getZ ();
328328 String format = "%.2f" ;
@@ -342,7 +342,7 @@ public static void register() {
342342 }
343343 });
344344
345- Placeholders .register (new Identifier ("player" , "uuid" ), (ctx , arg ) -> {
345+ Placeholders .register (Identifier . of ("player" , "uuid" ), (ctx , arg ) -> {
346346 if (ctx .hasPlayer ()) {
347347 return PlaceholderResult .value (ctx .player ().getUuidAsString ());
348348 } else if (ctx .hasGameProfile ()) {
@@ -352,39 +352,39 @@ public static void register() {
352352 }
353353 });
354354
355- Placeholders .register (new Identifier ("player" , "health" ), (ctx , arg ) -> {
355+ Placeholders .register (Identifier . of ("player" , "health" ), (ctx , arg ) -> {
356356 if (ctx .hasPlayer ()) {
357357 return PlaceholderResult .value (String .format ("%.0f" , ctx .player ().getHealth ()));
358358 } else {
359359 return PlaceholderResult .invalid ("No player!" );
360360 }
361361 });
362362
363- Placeholders .register (new Identifier ("player" , "max_health" ), (ctx , arg ) -> {
363+ Placeholders .register (Identifier . of ("player" , "max_health" ), (ctx , arg ) -> {
364364 if (ctx .hasPlayer ()) {
365365 return PlaceholderResult .value (String .format ("%.0f" , ctx .player ().getMaxHealth ()));
366366 } else {
367367 return PlaceholderResult .invalid ("No player!" );
368368 }
369369 });
370370
371- Placeholders .register (new Identifier ("player" , "hunger" ), (ctx , arg ) -> {
371+ Placeholders .register (Identifier . of ("player" , "hunger" ), (ctx , arg ) -> {
372372 if (ctx .hasPlayer ()) {
373373 return PlaceholderResult .value (String .valueOf (ctx .player ().getHungerManager ().getFoodLevel ()));
374374 } else {
375375 return PlaceholderResult .invalid ("No player!" );
376376 }
377377 });
378378
379- Placeholders .register (new Identifier ("player" , "saturation" ), (ctx , arg ) -> {
379+ Placeholders .register (Identifier . of ("player" , "saturation" ), (ctx , arg ) -> {
380380 if (ctx .hasPlayer ()) {
381381 return PlaceholderResult .value (String .format ("%.0f" , ctx .player ().getHungerManager ().getSaturationLevel ()));
382382 } else {
383383 return PlaceholderResult .invalid ("No player!" );
384384 }
385385 });
386386
387- Placeholders .register (new Identifier ("player" , "team_name" ), (ctx , arg ) -> {
387+ Placeholders .register (Identifier . of ("player" , "team_name" ), (ctx , arg ) -> {
388388 if (ctx .hasPlayer ()) {
389389 var team = ctx .player ().getScoreboardTeam ();
390390 return PlaceholderResult .value (team ==null ? Text .empty () : Text .of (team .getName ()));
@@ -393,7 +393,7 @@ public static void register() {
393393 }
394394 });
395395
396- Placeholders .register (new Identifier ("player" , "team_displayname" ), (ctx , arg ) -> {
396+ Placeholders .register (Identifier . of ("player" , "team_displayname" ), (ctx , arg ) -> {
397397 if (ctx .hasPlayer ()) {
398398 var team = (Team ) ctx .player ().getScoreboardTeam ();
399399 return PlaceholderResult .value (team ==null ? Text .empty () : team .getDisplayName ());
@@ -402,7 +402,7 @@ public static void register() {
402402 }
403403 });
404404
405- Placeholders .register (new Identifier ("player" , "team_displayname_formatted" ), (ctx , arg ) -> {
405+ Placeholders .register (Identifier . of ("player" , "team_displayname_formatted" ), (ctx , arg ) -> {
406406 if (ctx .hasPlayer ()) {
407407 var team = (Team ) ctx .player ().getScoreboardTeam ();
408408 return PlaceholderResult .value (team ==null ? Text .empty () : team .getFormattedName ());
0 commit comments