fix: no Adventure Mode on PreSTART

This commit is contained in:
Simon Giesel 2020-06-01 00:21:32 +02:00
parent 6a39973d93
commit a2f8039e53
3 changed files with 12 additions and 2 deletions

View file

@ -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);
}
} }
/** /**

View file

@ -24,7 +24,7 @@ public class LangUtils {
this.config.addDefault("Service.BannedDead", this.config.addDefault("Service.BannedDead",
"§4Du bist gestorben.\n \n§cDamit bist du aus §eVaro§c ausgeschieden."); "§4Du bist gestorben.\n \n§cDamit bist du aus §eVaro§c ausgeschieden.");
this.config.addDefault("Service.Protection", this.config.addDefault("Service.Protection",
"§ aDie Schutzzeit ist in §2§l%minutes% Minuten§r§a vorbei. §r§7§o#staysafe"); " §aDie Schutzzeit ist in §2§l%minutes% Minuten§r§a vorbei. §r§7§o#staysafe");
this.config.addDefault("Service.ProtectionOver", this.config.addDefault("Service.ProtectionOver",
" §c§lAchtung: §r§aDie Schutzzeit ist§2§l JETZT§r§a vorbei. §r§7§o#staysafe"); " §c§lAchtung: §r§aDie Schutzzeit ist§2§l JETZT§r§a vorbei. §r§7§o#staysafe");
this.config.addDefault("Error.NoPlayer", this.config.addDefault("Error.NoPlayer",

View file

@ -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("-", "")));
p.setGameMode(GameMode.SURVIVAL); if (plugin.getGameManager().getGameState().equals(GameState.PRESTART)) {
p.setGameMode(GameMode.ADVENTURE);
} else {
p.setGameMode(GameMode.SURVIVAL);
}
p.setFlySpeed(0.1f); p.setFlySpeed(0.1f);
p.setFlying(false); p.setFlying(false);
new BukkitRunnable() { new BukkitRunnable() {