@@ -12,25 +12,24 @@ public class GameBorder {
1212
1313 private final HungerGame game ;
1414
15- private final GameBossBar bossBar ;
1615 private final WorldBorder border = Bukkit .getWorlds ().get (0 ).getWorldBorder ();
17- private final double MAX_BORDER_SIZE = 1000 ;
1816
1917 private BukkitTask borderTask ;
2018
19+ private double MAX_BORDER_SIZE = -0 ;
20+
2121 private final AtomicLong borderTicks = new AtomicLong ();
2222
2323 public GameBorder (HungerGame game ) {
2424 this .game = game ;
25- this .bossBar = game .getBossBar ();
2625 border .setDamageBuffer (2 );
2726 border .setDamageAmount (0.5D );
28- border .setSize (MAX_BORDER_SIZE );
2927 }
3028
3129 public void start () {
3230 reset ();
3331 double MIN_BORDER_SIZE = 16 ;
32+ MAX_BORDER_SIZE = border .getSize ();
3433 border .setSize (MIN_BORDER_SIZE , 900 );
3534
3635 final long PERIOD = 20 ;
@@ -41,12 +40,12 @@ public void start() {
4140 @ Override
4241 public void run () {
4342 if (borderTicks .incrementAndGet () >= timeInSeconds ) {
44- bossBar .hide ();
43+ game . getBossBar () .hide ();
4544 cancel ();
4645 return ;
4746 }
48- bossBar . setBossBar ("残りのプレイヤー数: &6" + ( game .getPlayers (). size () - game . getDeadPlayers (). size () ));
49- bossBar .setProgress ((double ) Math .max (timeInSeconds - borderTicks .get (), 0 )/timeInSeconds );
47+ game . getBossBar (). setBossBar ("残りのプレイヤー数: &6" + game .getAlivePlayersSize ( ));
48+ game . getBossBar () .setProgress ((double ) Math .max (timeInSeconds - borderTicks .get (), 0 )/timeInSeconds );
5049 }
5150 }.runTaskTimer (HungerGames .getInstance (), 0 , PERIOD );
5251 }
@@ -56,9 +55,9 @@ public void stop() {
5655 }
5756
5857 public void reset () {
59- border .setSize (MAX_BORDER_SIZE );
58+ if ( MAX_BORDER_SIZE != - 0 ) border .setSize (MAX_BORDER_SIZE );
6059 if (borderTask != null ) borderTask .cancel ();
6160 borderTicks .set (0 );
62- bossBar .hide ();
61+ game . getBossBar () .hide ();
6362 }
6463}
0 commit comments