44
44
* The {@link GPSNetwork} is a manager class for all {@link GPSTransmitter Transmitters} and waypoints.
45
45
* There can only be one instance of this class per {@link Server}.
46
46
* It is also responsible for teleportation and resource management.
47
- *
47
+ *
48
48
* @author TheBusyBiscuit
49
- *
49
+ *
50
50
* @see TeleportationManager
51
51
* @see ResourceManager
52
52
*
@@ -64,7 +64,7 @@ public class GPSNetwork {
64
64
/**
65
65
* This constructs a new {@link GPSNetwork}.
66
66
* Note that this network is per {@link Server} and not per {@link Player}.
67
- *
67
+ *
68
68
* @param plugin
69
69
* Our {@link Slimefun} instance
70
70
*/
@@ -74,7 +74,7 @@ public GPSNetwork(@Nonnull Slimefun plugin) {
74
74
75
75
/**
76
76
* This method updates the status of a {@link GPSTransmitter}.
77
- *
77
+ *
78
78
* @param l
79
79
* The {@link Location} of the {@link GPSTransmitter}
80
80
* @param uuid
@@ -96,10 +96,10 @@ public void updateTransmitter(@Nonnull Location l, @Nonnull UUID uuid, boolean o
96
96
* This method calculates the GPS complexity for the given {@link UUID}.
97
97
* The complexity is determined by the Y level of each {@link GPSTransmitter}
98
98
* multiplied by the multiplier of that transmitter.
99
- *
99
+ *
100
100
* @param uuid
101
101
* The {@link UUID} who to calculate it for
102
- *
102
+ *
103
103
* @return The network complexity for that {@link UUID}
104
104
*/
105
105
public int getNetworkComplexity (@ Nonnull UUID uuid ) {
@@ -124,10 +124,10 @@ public int getNetworkComplexity(@Nonnull UUID uuid) {
124
124
/**
125
125
* This method returns the amount of {@link GPSTransmitter Transmitters} for the
126
126
* given {@link UUID}.
127
- *
127
+ *
128
128
* @param uuid
129
129
* The {@link UUID} who these transmitters belong to
130
- *
130
+ *
131
131
* @return The amount of transmitters
132
132
*/
133
133
public int countTransmitters (@ Nonnull UUID uuid ) {
@@ -138,7 +138,7 @@ public int countTransmitters(@Nonnull UUID uuid) {
138
138
/**
139
139
* This method opens the {@link GPSTransmitter} control panel to the given
140
140
* {@link Player}.
141
- *
141
+ *
142
142
* @param p
143
143
* The {@link Player}
144
144
*/
@@ -149,18 +149,18 @@ public void openTransmitterControlPanel(@Nonnull Player p) {
149
149
menu .addItem (slot , ChestMenuUtils .getBackground (), ChestMenuUtils .getEmptyClickHandler ());
150
150
}
151
151
152
- menu .addItem (2 , new CustomItemStack (SlimefunItems .GPS_TRANSMITTER .item (), im -> {
152
+ menu .addItem (2 , CustomItemStack . create (SlimefunItems .GPS_TRANSMITTER .item (), im -> {
153
153
im .setDisplayName (ChatColor .GRAY + Slimefun .getLocalization ().getMessage (p , "machines.GPS_CONTROL_PANEL.transmitters" ));
154
154
im .setLore (null );
155
155
}));
156
156
157
157
menu .addMenuClickHandler (2 , ChestMenuUtils .getEmptyClickHandler ());
158
158
159
159
int complexity = getNetworkComplexity (p .getUniqueId ());
160
- menu .addItem (4 , new CustomItemStack (SlimefunItems .GPS_CONTROL_PANEL .item (), "&7Network Info" , "" , "&8\u21E8 &7Status: " + getStatusText (p , complexity ), "&8\u21E8 &7Complexity: &f" + complexity ));
160
+ menu .addItem (4 , CustomItemStack . create (SlimefunItems .GPS_CONTROL_PANEL .item (), "&7Network Info" , "" , "&8\u21E8 &7Status: " + getStatusText (p , complexity ), "&8\u21E8 &7Complexity: &f" + complexity ));
161
161
menu .addMenuClickHandler (4 , ChestMenuUtils .getEmptyClickHandler ());
162
162
163
- menu .addItem (6 , new CustomItemStack (HeadTexture .GLOBE_OVERWORLD .getAsItemStack (), "&7" + Slimefun .getLocalization ().getMessage (p , "machines.GPS_CONTROL_PANEL.waypoints" ), "" , ChatColor .GRAY + "\u21E8 " + Slimefun .getLocalization ().getMessage (p , "guide.tooltips.open-itemgroup" )));
163
+ menu .addItem (6 , CustomItemStack . create (HeadTexture .GLOBE_OVERWORLD .getAsItemStack (), "&7" + Slimefun .getLocalization ().getMessage (p , "machines.GPS_CONTROL_PANEL.waypoints" ), "" , ChatColor .GRAY + "\u21E8 " + Slimefun .getLocalization ().getMessage (p , "guide.tooltips.open-itemgroup" )));
164
164
menu .addMenuClickHandler (6 , (pl , slot , item , action ) -> {
165
165
openWaypointControlPanel (pl );
166
166
return false ;
@@ -177,7 +177,7 @@ public void openTransmitterControlPanel(@Nonnull Player p) {
177
177
if (sfi instanceof GPSTransmitter transmitter ) {
178
178
int slot = inventory [index ];
179
179
180
- menu .addItem (slot , new CustomItemStack (SlimefunItems .GPS_TRANSMITTER .item (), "&bGPS Transmitter" , "&8\u21E8 &7World: &f" + l .getWorld ().getName (), "&8\u21E8 &7X: &f" + l .getX (), "&8\u21E8 &7Y: &f" + l .getY (), "&8\u21E8 &7Z: &f" + l .getZ (), "" , "&8\u21E8 &7Signal Strength: &f" + transmitter .getMultiplier (l .getBlockY ()), "&8\u21E8 &7Ping: &f" + NumberUtils .roundDecimalNumber (1000D / l .getY ()) + "ms" ));
180
+ menu .addItem (slot , CustomItemStack . create (SlimefunItems .GPS_TRANSMITTER .item (), "&bGPS Transmitter" , "&8\u21E8 &7World: &f" + l .getWorld ().getName (), "&8\u21E8 &7X: &f" + l .getX (), "&8\u21E8 &7Y: &f" + l .getY (), "&8\u21E8 &7Z: &f" + l .getZ (), "" , "&8\u21E8 &7Signal Strength: &f" + transmitter .getMultiplier (l .getBlockY ()), "&8\u21E8 &7Ping: &f" + NumberUtils .roundDecimalNumber (1000D / l .getY ()) + "ms" ));
181
181
menu .addMenuClickHandler (slot , ChestMenuUtils .getEmptyClickHandler ());
182
182
183
183
index ++;
@@ -192,14 +192,14 @@ public void openTransmitterControlPanel(@Nonnull Player p) {
192
192
* The icon is dependent on the {@link Environment} of the waypoint's {@link World}.
193
193
* However if the name of this waypoint indicates that this is actually a deathmarker
194
194
* then a different texture will be used.
195
- *
195
+ *
196
196
* Otherwise it will return a globe, a nether or end sphere according to the {@link Environment}.
197
- *
197
+ *
198
198
* @param name
199
199
* The name of a waypoint
200
200
* @param environment
201
201
* The {@link Environment} of the waypoint's {@link World}
202
- *
202
+ *
203
203
* @return An icon for this waypoint
204
204
*/
205
205
@ ParametersAreNonnullByDefault
@@ -232,17 +232,17 @@ public void openWaypointControlPanel(@Nonnull Player p) {
232
232
menu .addItem (slot , ChestMenuUtils .getBackground (), ChestMenuUtils .getEmptyClickHandler ());
233
233
}
234
234
235
- menu .addItem (2 , new CustomItemStack (SlimefunItems .GPS_TRANSMITTER .item (), "&7" + Slimefun .getLocalization ().getMessage (p , "machines.GPS_CONTROL_PANEL.transmitters" ), "" , ChatColor .GRAY + "\u21E8 " + Slimefun .getLocalization ().getMessage (p , "guide.tooltips.open-itemgroup" )));
235
+ menu .addItem (2 , CustomItemStack . create (SlimefunItems .GPS_TRANSMITTER .item (), "&7" + Slimefun .getLocalization ().getMessage (p , "machines.GPS_CONTROL_PANEL.transmitters" ), "" , ChatColor .GRAY + "\u21E8 " + Slimefun .getLocalization ().getMessage (p , "guide.tooltips.open-itemgroup" )));
236
236
menu .addMenuClickHandler (2 , (pl , slot , item , action ) -> {
237
237
openTransmitterControlPanel (pl );
238
238
return false ;
239
239
});
240
240
241
241
int complexity = getNetworkComplexity (p .getUniqueId ());
242
- menu .addItem (4 , new CustomItemStack (SlimefunItems .GPS_CONTROL_PANEL .item (), "&7Network Info" , "" , "&8\u21E8 &7Status: " + (complexity > 0 ? "&2&lONLINE" : "&4&lOFFLINE" ), "&8\u21E8 &7Complexity: &f" + complexity ));
242
+ menu .addItem (4 , CustomItemStack . create (SlimefunItems .GPS_CONTROL_PANEL .item (), "&7Network Info" , "" , "&8\u21E8 &7Status: " + (complexity > 0 ? "&2&lONLINE" : "&4&lOFFLINE" ), "&8\u21E8 &7Complexity: &f" + complexity ));
243
243
menu .addMenuClickHandler (4 , ChestMenuUtils .getEmptyClickHandler ());
244
244
245
- menu .addItem (6 , new CustomItemStack (HeadTexture .GLOBE_OVERWORLD .getAsItemStack (), "&7" + Slimefun .getLocalization ().getMessage (p , "machines.GPS_CONTROL_PANEL.waypoints" )));
245
+ menu .addItem (6 , CustomItemStack . create (HeadTexture .GLOBE_OVERWORLD .getAsItemStack (), "&7" + Slimefun .getLocalization ().getMessage (p , "machines.GPS_CONTROL_PANEL.waypoints" )));
246
246
menu .addMenuClickHandler (6 , ChestMenuUtils .getEmptyClickHandler ());
247
247
248
248
int index = 0 ;
@@ -254,7 +254,7 @@ public void openWaypointControlPanel(@Nonnull Player p) {
254
254
int slot = inventory [index ];
255
255
256
256
Location l = waypoint .getLocation ();
257
- menu .addItem (slot , new CustomItemStack (waypoint .getIcon (), waypoint .getName ().replace ("player:death " , "" ), "&8\u21E8 &7World: &f" + l .getWorld ().getName (), "&8\u21E8 &7X: &f" + l .getX (), "&8\u21E8 &7Y: &f" + l .getY (), "&8\u21E8 &7Z: &f" + l .getZ (), "" , "&8\u21E8 &cClick to delete" ));
257
+ menu .addItem (slot , CustomItemStack . create (waypoint .getIcon (), waypoint .getName ().replace ("player:death " , "" ), "&8\u21E8 &7World: &f" + l .getWorld ().getName (), "&8\u21E8 &7X: &f" + l .getX (), "&8\u21E8 &7Y: &f" + l .getY (), "&8\u21E8 &7Z: &f" + l .getZ (), "" , "&8\u21E8 &cClick to delete" ));
258
258
menu .addMenuClickHandler (slot , (pl , s , item , action ) -> {
259
259
profile .removeWaypoint (waypoint );
260
260
SoundEffect .GPS_NETWORK_OPEN_PANEL_SOUND .playFor (p );
@@ -273,7 +273,7 @@ public void openWaypointControlPanel(@Nonnull Player p) {
273
273
/**
274
274
* This method will prompt the given {@link Player} to enter a name for a waypoint.
275
275
* After entering the name, it will be added to his waypoint list.
276
- *
276
+ *
277
277
* @param p
278
278
* The {@link Player} who should get a new waypoint
279
279
* @param l
@@ -298,7 +298,7 @@ public void createWaypoint(@Nonnull Player p, @Nonnull Location l) {
298
298
299
299
/**
300
300
* This method adds a new waypoint with the given name and {@link Location} for that {@link Player}.
301
- *
301
+ *
302
302
* @param p
303
303
* The {@link Player} to get the new waypoint
304
304
* @param name
@@ -343,10 +343,10 @@ public void addWaypoint(@Nonnull Player p, @Nonnull String name, @Nonnull Locati
343
343
/**
344
344
* This method returns a {@link Set} of {@link Location Locations} for all {@link GPSTransmitter Transmitters}
345
345
* owned by the given {@link UUID}.
346
- *
346
+ *
347
347
* @param uuid
348
348
* The {@link UUID} owning those transmitters
349
- *
349
+ *
350
350
* @return A {@link Set} with all {@link Location Locations} of transmitters for this {@link UUID}
351
351
*/
352
352
@ Nonnull
@@ -357,7 +357,7 @@ public Set<Location> getTransmitters(@Nonnull UUID uuid) {
357
357
/**
358
358
* This returns the {@link TeleportationManager} for this {@link GPSNetwork}.
359
359
* It is responsible for all actions that relate to the {@link Teleporter}.
360
- *
360
+ *
361
361
* @return The {@link TeleportationManager} for this {@link GPSNetwork}
362
362
*/
363
363
@ Nonnull
@@ -368,7 +368,7 @@ public TeleportationManager getTeleportationManager() {
368
368
/**
369
369
* This returns the {@link ResourceManager} for this {@link GPSNetwork}.
370
370
* Use this to access {@link GEOResource GEOResources}.
371
- *
371
+ *
372
372
* @return The {@link ResourceManager} for this {@link GPSNetwork}
373
373
*/
374
374
@ Nonnull
0 commit comments