File tree Expand file tree Collapse file tree
Plugin/src/main/java/dev/lrxh/neptune Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222import java .util .List ;
2323
2424public class CustomKitEffectsMenu extends PaginatedMenu {
25- private static final int DURATION = 1_000_000 ;
26- private static final int MAX_AMPLIFIER = 4 ;
2725 private final CustomKit kit ;
2826
2927 public CustomKitEffectsMenu (CustomKit kit ) {
@@ -59,12 +57,12 @@ public ItemStack getItemStack(Player p) {
5957 public void onClick (ClickType type2 , Player p ) {
6058 PotionEffect current = find (type );
6159 if (type2 .isRightClick ()) {
62- int amp = current == null ? 0 : (current .getAmplifier () + 1 ) % (MAX_AMPLIFIER + 1 );
60+ int amp = current == null ? 0 : (current .getAmplifier () + 1 ) % (4 + 1 );
6361 kit .getPotionEffects ().remove (current );
64- kit .getPotionEffects ().add (new PotionEffect (type , DURATION , amp ));
62+ kit .getPotionEffects ().add (new PotionEffect (type , 1_000_000 , amp ));
6563 } else {
6664 if (current != null ) kit .getPotionEffects ().remove (current );
67- else kit .getPotionEffects ().add (new PotionEffect (type , DURATION , 0 ));
65+ else kit .getPotionEffects ().add (new PotionEffect (type , 1_000_000 , 0 ));
6866 }
6967 Profile profile = API .getProfile (p );
7068 if (profile != null ) Profile .save (profile );
Original file line number Diff line number Diff line change @@ -68,7 +68,12 @@ public void run() {
6868 int ping1 = PlayerUtil .getPing (uuid1 );
6969 int ping2 = PlayerUtil .getPing (uuid2 );
7070
71- if (!(ping2 <= settings1 .getMaxPing () && ping1 <= settings2 .getMaxPing ())) {
71+ boolean pingInRange = ping2 <= settings1 .getMaxPing () && ping1 <= settings2 .getMaxPing ();
72+ // bypass ping range once a player has waited 10s
73+ boolean waitedTooLong = queueEntry1 .getTime ().getElapsed () >= 10_000
74+ || queueEntry2 .getTime ().getElapsed () >= 10_000 ;
75+
76+ if (!pingInRange && !waitedTooLong ) {
7277 QueueService .get ().add (queueEntry1 , false );
7378 QueueService .get ().add (queueEntry2 , false );
7479 continue ;
Original file line number Diff line number Diff line change @@ -24,7 +24,6 @@ public class ArenaService extends IService implements IArenaService {
2424 public final LinkedHashSet <Arena > arenas = new LinkedHashSet <>();
2525 public final LinkedHashSet <Arena > duplicates = new LinkedHashSet <>();
2626 private final Set <Integer > reservedIndices = new HashSet <>();
27- private static final int GRID_COLUMNS = 32 ;
2827
2928 public static ArenaService get () {
3029 if (instance == null ) instance = new ArenaService ();
@@ -84,11 +83,11 @@ public int gridDistance() {
8483 }
8584
8685 public int gridCellX (int index ) {
87- return (index % GRID_COLUMNS ) * gridDistance ();
86+ return (index % 32 ) * gridDistance ();
8887 }
8988
9089 public int gridCellZ (int index ) {
91- return (index / GRID_COLUMNS ) * gridDistance ();
90+ return (index / 32 ) * gridDistance ();
9291 }
9392
9493 public int nextFreeGridIndex () {
@@ -97,7 +96,7 @@ public int nextFreeGridIndex() {
9796 if (dup .getMin () != null ) {
9897 int col = Math .floorDiv (dup .getMin ().getBlockX (), gridDistance ());
9998 int row = Math .floorDiv (dup .getMin ().getBlockZ (), gridDistance ());
100- used .add (row * GRID_COLUMNS + col );
99+ used .add (row * 32 + col );
101100 }
102101 }
103102 int i = 0 ;
Original file line number Diff line number Diff line change @@ -116,7 +116,8 @@ public void run() {
116116 event .setCancelled (true );
117117 profile .getArenaProcedure ().setType (ArenaProcedureType .NONE );
118118 Arena arena = profile .getArenaProcedure ().getArena ();
119- if (!arena .isSetup () || !arena .isDoneLoading ()) {
119+ boolean firstSetup = !arena .isSetup () || !arena .isDoneLoading ();
120+ if (firstSetup ) {
120121 player .sendMessage (CC .success ("Arena setup complete" ));
121122 } else {
122123 player .sendMessage (CC .success ("Set arena max position" ));
@@ -126,6 +127,9 @@ public void run() {
126127 @ Override
127128 public void run () {
128129 arena .setMax (player .getLocation ());
130+ if (firstSetup && Neptune .get ().isDuplicatesEnabled ()) {
131+ ArenaService .get ().createDuplicate (arena );
132+ }
129133 new ArenaManagementMenu (profile .getArenaProcedure ().getArena ()).open (player );
130134 profile .getArenaProcedure ().setArena (null );
131135 }
Original file line number Diff line number Diff line change @@ -38,6 +38,10 @@ public String formatSecondsMillis() {
3838 return (seconds < 10 ? "0" : "" ) + seconds + "." + (millis < 10 ? "0" : "" ) + millis + "s" ;
3939 }
4040
41+ public long getElapsed () {
42+ return System .currentTimeMillis () - oldTime ;
43+ }
44+
4145 public void setZero () {
4246 this .oldTime = 0 ;
4347 this .lastCurrentTime = 0 ;
You can’t perform that action at this time.
0 commit comments