fix: no Adventure Mode on PreSTART
This commit is contained in:
parent
6a39973d93
commit
a2f8039e53
3 changed files with 12 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
package de.cliffbreak.varo.managers;
|
package de.cliffbreak.varo.managers;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.World.Environment;
|
import org.bukkit.World.Environment;
|
||||||
import org.bukkit.entity.Creeper;
|
import org.bukkit.entity.Creeper;
|
||||||
|
@ -67,6 +68,7 @@ public class GameManager {
|
||||||
player.setHealth(20.0d);
|
player.setHealth(20.0d);
|
||||||
player.setFoodLevel(20);
|
player.setFoodLevel(20);
|
||||||
player.setSaturation(5.0f);
|
player.setSaturation(5.0f);
|
||||||
|
player.setGameMode(GameMode.ADVENTURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
|
@ -98,6 +100,9 @@ public class GameManager {
|
||||||
for (World world : Bukkit.getWorlds()) {
|
for (World world : Bukkit.getWorlds()) {
|
||||||
world.setPVP(false);
|
world.setPVP(false);
|
||||||
}
|
}
|
||||||
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
|
player.setGameMode(GameMode.SURVIVAL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -14,6 +14,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
import de.cliffbreak.varo.Varo;
|
import de.cliffbreak.varo.Varo;
|
||||||
|
import de.cliffbreak.varo.enums.GameState;
|
||||||
|
|
||||||
public class PlayerUtils {
|
public class PlayerUtils {
|
||||||
private final Varo plugin;
|
private final Varo plugin;
|
||||||
|
@ -79,7 +80,11 @@ public class PlayerUtils {
|
||||||
hidePlayersTask.cancel();
|
hidePlayersTask.cancel();
|
||||||
plugin.getNPCManager().removeClone(p.getUniqueId());
|
plugin.getNPCManager().removeClone(p.getUniqueId());
|
||||||
p.teleport(plugin.getPlayerCache().getPlayerLocationCache(p.getUniqueId().toString().replace("-", "")));
|
p.teleport(plugin.getPlayerCache().getPlayerLocationCache(p.getUniqueId().toString().replace("-", "")));
|
||||||
|
if (plugin.getGameManager().getGameState().equals(GameState.PRESTART)) {
|
||||||
|
p.setGameMode(GameMode.ADVENTURE);
|
||||||
|
} else {
|
||||||
p.setGameMode(GameMode.SURVIVAL);
|
p.setGameMode(GameMode.SURVIVAL);
|
||||||
|
}
|
||||||
p.setFlySpeed(0.1f);
|
p.setFlySpeed(0.1f);
|
||||||
p.setFlying(false);
|
p.setFlying(false);
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
|
|
Loading…
Reference in a new issue