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;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.entity.Creeper;
@ -67,6 +68,7 @@ public class GameManager {
player.setHealth(20.0d);
player.setFoodLevel(20);
player.setSaturation(5.0f);
player.setGameMode(GameMode.ADVENTURE);
}
new BukkitRunnable() {
@ -98,6 +100,9 @@ public class GameManager {
for (World world : Bukkit.getWorlds()) {
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",
"§4Du bist gestorben.\n \n§cDamit bist du aus §eVaro§c ausgeschieden.");
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",
" §c§lAchtung: §r§aDie Schutzzeit ist§2§l JETZT§r§a vorbei. §r§7§o#staysafe");
this.config.addDefault("Error.NoPlayer",

View file

@ -14,6 +14,7 @@ import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitTask;
import de.cliffbreak.varo.Varo;
import de.cliffbreak.varo.enums.GameState;
public class PlayerUtils {
private final Varo plugin;
@ -79,7 +80,11 @@ public class PlayerUtils {
hidePlayersTask.cancel();
plugin.getNPCManager().removeClone(p.getUniqueId());
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.setFlying(false);
new BukkitRunnable() {