SteamWar/MissileWars
Archiviert
13
0

Fix Indentation

Dieser Commit ist enthalten in:
yoyosource 2021-10-27 20:22:10 +02:00
Ursprung 8457e4f7f2
Commit 2d6e89549e
3 geänderte Dateien mit 22 neuen und 32 gelöschten Zeilen

Datei anzeigen

@ -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(){
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);

Datei anzeigen

@ -28,26 +28,26 @@ import java.util.EnumSet;
public class EndCountdown extends StateDependent { public class EndCountdown extends StateDependent {
private BukkitTask task; private BukkitTask task;
public EndCountdown() { public EndCountdown() {
super(EnumSet.of(FightState.END)); super(EnumSet.of(FightState.END));
} }
@Override @Override
public void enable() { public void enable() {
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);
} }
@Override @Override
public void disable() { public void disable() {
if(task != null && !task.isCancelled()) if (task != null && !task.isCancelled())
task.cancel(); task.cancel();
} }
} }

Datei anzeigen

@ -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) {