Implement reset after win! #36
@ -38,11 +38,11 @@ public class FightWorld {
|
|||||||
private static final World world = Bukkit.getWorlds().get(0);
|
private static final World world = Bukkit.getWorlds().get(0);
|
||||||
private static final boolean paper = Bukkit.getVersion().contains("git-Paper");
|
private static final boolean paper = Bukkit.getVersion().contains("git-Paper");
|
||||||
|
|
||||||
public static boolean isPaper(){
|
private static boolean isPaper(){
|
||||||
YoyoNow markierte diese Unterhaltung als gelöst
Veraltet
|
|||||||
return paper;
|
return paper;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double posToChunk(int pos){
|
private static double posToChunk(int pos){
|
||||||
return pos / 16.0;
|
return pos / 16.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ public class FightWorld {
|
|||||||
return (int) Math.ceil(posToChunk(Config.ArenaMaxZ));
|
return (int) Math.ceil(posToChunk(Config.ArenaMaxZ));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void forEachChunk(ObjIntConsumer<Integer> executor) {
|
private static void forEachChunk(ObjIntConsumer<Integer> executor) {
|
||||||
for(int x = getMinChunkX(); x <= getMaxChunkX(); x++)
|
for(int x = getMinChunkX(); x <= getMaxChunkX(); x++)
|
||||||
for(int z = getMinChunkZ(); z <= getMaxChunkZ(); z++)
|
for(int z = getMinChunkZ(); z <= getMaxChunkZ(); z++)
|
||||||
executor.accept(x, z);
|
executor.accept(x, z);
|
||||||
@ -81,7 +81,7 @@ public class FightWorld {
|
|||||||
Bukkit.unloadWorld(backup, false);
|
Bukkit.unloadWorld(backup, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void resetChunk(World world, World backup, int x, int z) {
|
private static void resetChunk(World world, World backup, int x, int z) {
|
||||||
net.minecraft.server.v1_15_R1.World w = ((CraftWorld) world).getHandle();
|
net.minecraft.server.v1_15_R1.World w = ((CraftWorld) world).getHandle();
|
||||||
Chunk chunk = w.getChunkAt(x, z);
|
Chunk chunk = w.getChunkAt(x, z);
|
||||||
Chunk backupChunk = ((CraftWorld) backup).getHandle().getChunkAt(x, z);
|
Chunk backupChunk = ((CraftWorld) backup).getHandle().getChunkAt(x, z);
|
||||||
|
@ -39,7 +39,7 @@ public class EndCountdown extends StateDependent {
|
|||||||
task = Bukkit.getScheduler().runTaskLater(MissileWars.getPlugin(), this::restart, Config.EndTime);
|
task = Bukkit.getScheduler().runTaskLater(MissileWars.getPlugin(), this::restart, Config.EndTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void restart(){
|
private void restart() {
|
||||||
FightWorld.resetWorld();
|
FightWorld.resetWorld();
|
||||||
MissileWars.waiting();
|
MissileWars.waiting();
|
||||||
Bukkit.getOnlinePlayers().forEach(JoinListener::join);
|
Bukkit.getOnlinePlayers().forEach(JoinListener::join);
|
||||||
YoyoNow markierte diese Unterhaltung als gelöst
Veraltet
Lixfel
hat
Na das ist mal eine abentheuerliche Intendation. Na das ist mal eine abentheuerliche Intendation.
|
|||||||
@ -47,7 +47,7 @@ public class EndCountdown extends StateDependent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disable() {
|
public void disable() {
|
||||||
if(task != null && !task.isCancelled())
|
if (task != null && !task.isCancelled())
|
||||||
task.cancel();
|
task.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,17 +38,7 @@ public class JoinListener extends BasicListener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onJoin(PlayerJoinEvent e){
|
public void onJoin(PlayerJoinEvent e){
|
||||||
e.setJoinMessage("§a» " + e.getPlayer().getDisplayName());
|
e.setJoinMessage("§a» " + e.getPlayer().getDisplayName());
|
||||||
if (Config.isChallenge()) {
|
join(e.getPlayer());
|
||||||
if (Config.RedLeader.equals(e.getPlayer().getUniqueId())) {
|
|
||||||
MissileWars.getRedTeam().join(e.getPlayer());
|
|
||||||
} else if (Config.BlueLeader.equals(e.getPlayer().getUniqueId())) {
|
|
||||||
MissileWars.getBlueTeam().join(e.getPlayer());
|
|
||||||
} else {
|
|
||||||
e.getPlayer().teleport(MissileWars.getRedTeam().getSpawn().toVector().midpoint(MissileWars.getBlueTeam().getSpawn().toVector()).toLocation(e.getPlayer().getWorld()));
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
MissileWars.join(e.getPlayer());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void join(Player p) {
|
public static void join(Player p) {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren
Alles Public oder was? (Betrifft auch nachfolgende Methoden)