3232import org .bukkit .enchantments .Enchantment ;
3333import org .bukkit .entity .Player ;
3434import org .bukkit .potion .PotionEffectType ;
35- import org .bukkit .Location ;
3635
3736import java .util .*;
3837import java .util .regex .Matcher ;
4241import static com .extendedclip .papi .expansion .player .PlayerUtil .format24 ;
4342import static com .extendedclip .papi .expansion .player .PlayerUtil .getBiome ;
4443import static com .extendedclip .papi .expansion .player .PlayerUtil .getCapitalizedBiome ;
45- import static com .extendedclip .papi .expansion .player .PlayerUtil .getCardinalDirection ;
4644import static com .extendedclip .papi .expansion .player .PlayerUtil .getEmptySlots ;
45+ import static com .extendedclip .papi .expansion .player .PlayerUtil .getDirection ;
4746import static com .extendedclip .papi .expansion .player .PlayerUtil .getTotalExperience ;
4847import static com .extendedclip .papi .expansion .player .PlayerUtil .getXZDirection ;
4948import static com .extendedclip .papi .expansion .player .PlayerUtil .itemInHand ;
@@ -56,6 +55,15 @@ public final class PlayerExpansion extends PlaceholderExpansion implements Confi
5655 private int mediumValue ;
5756 private int highValue ;
5857
58+ private String north ;
59+ private String northEast ;
60+ private String east ;
61+ private String southEast ;
62+ private String south ;
63+ private String southWest ;
64+ private String west ;
65+ private String northWest ;
66+
5967 @ Override
6068 public String getIdentifier () {
6169 return "player" ;
@@ -79,6 +87,14 @@ public Map<String, Object> getDefaults() {
7987 defaults .put ("ping_color.low" , "&a" );
8088 defaults .put ("ping_value.medium" , 50 );
8189 defaults .put ("ping_value.high" , 100 );
90+ defaults .put ("direction.north" , "N" );
91+ defaults .put ("direction.north_east" , "NE" );
92+ defaults .put ("direction.east" , "E" );
93+ defaults .put ("direction.south_east" , "SE" );
94+ defaults .put ("direction.south" , "S" );
95+ defaults .put ("direction.south_west" , "SW" );
96+ defaults .put ("direction.west" , "W" );
97+ defaults .put ("direction.north_west" , "NW" );
8298 return defaults ;
8399 }
84100
@@ -214,7 +230,25 @@ public String onRequest(OfflinePlayer player, String identifier) {
214230 case "gamemode" :
215231 return p .getGameMode ().name ();
216232 case "direction" :
217- return getCardinalDirection (p );
233+ switch (getDirection (p )) {
234+ case NORTH :
235+ return north ;
236+ case NORTH_EAST :
237+ return northEast ;
238+ case EAST :
239+ return east ;
240+ case SOUTH_EAST :
241+ return southEast ;
242+ case SOUTH :
243+ return south ;
244+ case SOUTH_WEST :
245+ return southWest ;
246+ case WEST :
247+ return west ;
248+ case NORTH_WEST :
249+ return northWest ;
250+ }
251+ return "" ;
218252 case "direction_xz" :
219253 return getXZDirection (p );
220254 case "world" :
@@ -401,6 +435,14 @@ public boolean register() {
401435 high = this .getString ("ping_color.high" , "&c" );
402436 mediumValue = this .getInt ("ping_value.medium" , 50 );
403437 highValue = this .getInt ("ping_value.high" , 100 );
438+ north = this .getString ("direction.north" , "N" );
439+ northEast = this .getString ("direction.north_east" , "NE" );
440+ east = this .getString ("direction.east" , "E" );
441+ southEast = this .getString ("direction.south_east" , "SE" );
442+ south = this .getString ("direction.south" , "S" );
443+ southWest = this .getString ("direction.south_west" , "SW" );
444+ west = this .getString ("direction.west" , "W" );
445+ northWest = this .getString ("direction.north_west" , "NW" );
404446
405447
406448 return super .register ();
0 commit comments