minor changes, added randomizer to get chance to have ZA
This commit is contained in:
parent
425614b45c
commit
add7525674
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>net.thedawnph</groupId>
|
<groupId>net.thedawnph</groupId>
|
||||||
<artifactId>servercore_za</artifactId>
|
<artifactId>servercore_za</artifactId>
|
||||||
<version>1.1.1</version>
|
<version>1.1.2</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>servercore_za</name>
|
<name>servercore_za</name>
|
||||||
|
|||||||
@ -15,6 +15,10 @@ public class StartNighttimeTask {
|
|||||||
private final JavaPlugin plugin;
|
private final JavaPlugin plugin;
|
||||||
private boolean isApocalyptic = false;
|
private boolean isApocalyptic = false;
|
||||||
|
|
||||||
|
public static int randomizer(int min, int max) {
|
||||||
|
return (int) ((Math.random() * (max - min)) + min);
|
||||||
|
}
|
||||||
|
|
||||||
public StartNighttimeTask(JavaPlugin plugin) {
|
public StartNighttimeTask(JavaPlugin plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
startScheduler();
|
startScheduler();
|
||||||
@ -36,21 +40,22 @@ public class StartNighttimeTask {
|
|||||||
|
|
||||||
long time = world.getTime();
|
long time = world.getTime();
|
||||||
|
|
||||||
|
|
||||||
// Check if it is nighttime
|
// Check if it is nighttime
|
||||||
if (time >= 12541 && time <= 23458) {
|
if (time >= 12541 && time <= 23458) {
|
||||||
|
int random = randomizer(0, 4);
|
||||||
if (!Bukkit.getOnlinePlayers().isEmpty() && !isApocalyptic) {
|
if (!Bukkit.getOnlinePlayers().isEmpty() && !isApocalyptic) {
|
||||||
// Play raid horn sound for all players
|
if (plugin.getConfig().getInt("ZA-duration") == 0 && random == 1) {
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
|
||||||
player.playSound(player.getLocation(), "item.goat_horn.sound.5", 16.0f, 1.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
long duration = 0;
|
|
||||||
if (plugin.getConfig().getInt("ZA-duration") == 0) {
|
|
||||||
// Start the apocalypse
|
// Start the apocalypse
|
||||||
apocalypseAPI.startApocalypse(
|
apocalypseAPI.startApocalypse(
|
||||||
worldName, true
|
worldName, true
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
|
// Play raid horn sound for all players
|
||||||
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
|
player.playSound(player.getLocation(), "item.goat_horn.sound.5", 16.0f, 1.0f);
|
||||||
|
}
|
||||||
|
} else if (plugin.getConfig().getInt("ZA-duration") != 0 && random == 1) {
|
||||||
// Start the apocalypse
|
// Start the apocalypse
|
||||||
apocalypseAPI.startApocalypse(
|
apocalypseAPI.startApocalypse(
|
||||||
worldName,
|
worldName,
|
||||||
@ -58,8 +63,17 @@ public class StartNighttimeTask {
|
|||||||
plugin.getConfig().getInt("ZA-mobs"),
|
plugin.getConfig().getInt("ZA-mobs"),
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
|
// Play raid horn sound for all players
|
||||||
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
|
player.playSound(player.getLocation(), "item.goat_horn.sound.5", 16.0f, 1.0f);
|
||||||
|
}
|
||||||
|
} else if (random != 1) {
|
||||||
|
// send message to all players
|
||||||
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
|
player.sendMessage("The night is quiet...");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
isApocalyptic = true;
|
isApocalyptic = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: servercore_za
|
name: servercore_za
|
||||||
version: '1.1.1'
|
version: '1.1.2'
|
||||||
main: net.thedawnph.servercore_za.Servercore_za
|
main: net.thedawnph.servercore_za.Servercore_za
|
||||||
api-version: '1.20'
|
api-version: '1.20'
|
||||||
authors: [ princepines ]
|
authors: [ princepines ]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user