• Our Minecraft servers are offline but we will keep this forum online for any community communication. Site permissions for posting could change at a later date but will remain online.

(HungerGames) Set timer to 0:30 after 24 people have joined

ToxicRat2000

Spectator
Joined
Dec 25, 2013
Messages
17
Reaction score
1
So basically what the title says, then you don't have to wait like 2.5 minutes after the room is full.
Thanks in advance.
 

AmyGlitters

Career
Joined
Jun 11, 2013
Messages
315
Reaction score
457
An addition to this would have to make sure it didn't reset every time someone new joined/left...
 

ToxicRat2000

Spectator
Joined
Dec 25, 2013
Messages
17
Reaction score
1
An addition to this would have to make sure it didn't reset every time someone new joined/left...
That's pretty easy. I can think of the programming needed for this out of my head already. Assuming we have a method to update the time every second:
Code:
boolean reachedMaximum = false;
if(this.theWorld.playerEntities.size() == lobbyplugin.maxPlayers && !reachedMaximum)    //or whatever
{
reachedMaximum = true;
lobbyplugin.counterTime = 0,5    //in minutes
}
So it will only happen once.
 

Zaex

Diamond
Joined
Mar 30, 2013
Messages
2,441
Reaction score
2,765
That's pretty easy. I can think of the programming needed for this out of my head already. Assuming we have a method to update the time every second:
Code:
boolean reachedMaximum = false;
if(this.theWorld.playerEntities.size() == lobbyplugin.maxPlayers && !reachedMaximum)    //or whatever
{
reachedMaximum = true;
lobbyplugin.counterTime = 0,5    //in minutes
}
So it will only happen once.
I think that is correct coding for it.. Pixelatorx2
 

Pixelatorx2

Platinum
Joined
Oct 2, 2012
Messages
2,957
Reaction score
2,625
That's pretty easy. I can think of the programming needed for this out of my head already. Assuming we have a method to update the time every second:
Code:
boolean reachedMaximum = false;
if(this.theWorld.playerEntities.size() == lobbyplugin.maxPlayers && !reachedMaximum)    //or whatever
{
reachedMaximum = true;
lobbyplugin.counterTime = 0,5    //in minutes
}
So it will only happen once.
"this.theWorld.playerEntities.size()"
That that can be easily changed to Bukkit.getOnlinePlayers() because the lobby is one world, and you're calling useless calls. (Bukkit.getOnlinePlayers() would call faster because you only have to make one reference and then call it).

And I know for a fact MCGamer has the game gamemaster feature which allows staff to not participate in the game however allowing the server to have 25 players online, so the call would be somearraylistthinghashmaporlistthathastheingameplayers.size() (or .length in the case of a hashmap)

Actually I woudnt do anything like this, you have the scheduler calling a method repetively and without need. What if its already past 30 seconds? Just gonna set the time back to 30 :p.

I would delay a method to run when its lobby, there are greater then 31 seconds left. Have it run right after someone joins. Great idea though, I too want this :)
 
Last edited:

ToxicRat2000

Spectator
Joined
Dec 25, 2013
Messages
17
Reaction score
1
"this.theWorld.playerEntities.size()"
Actually I woudnt do anything like this, you have the scheduler calling a method repetively and without need. What if its already past 30 seconds? Just gonna set the time back to 30 :p.
Oh yea forgot to include that in the if statement. You get what I mean though and it's pretty easy to achieve.
 

JaviGBU

Platinum
Joined
May 20, 2014
Messages
728
Reaction score
437
I think that idea is really cool , but if The timer is going to restart when a person leave , its not cool xD
 

ViolentKitten

Platinum
Joined
Oct 20, 2012
Messages
877
Reaction score
846
This feature is something that is already in the works, I believe, and will be released in MCGamer v2. I do know for a fact the pre-game time is being shortened to 10 seconds, though :)
 

ToxicRat2000

Spectator
Joined
Dec 25, 2013
Messages
17
Reaction score
1
I think that idea is really cool , but if The timer is going to restart when a person leave , its not cool xD
That won't happen. Look at the code posted.
This feature is something that is already in the works, I believe, and will be released in MCGamer v2. I do know for a fact the pre-game time is being shortened to 10 seconds, though :)
Kewl! When will MCGamer v2 be released?
 

Members online

No members online now.

Forum statistics

Threads
242,192
Messages
2,449,601
Members
523,972
Latest member
Atasci