Some Fixes
Dieser Commit ist enthalten in:
Ursprung
1d153c6a17
Commit
ac499b32b8
@ -20,6 +20,9 @@
|
|||||||
package de.steamwar.towerrun.config;
|
package de.steamwar.towerrun.config;
|
||||||
|
|
||||||
import de.steamwar.towerrun.TowerRun;
|
import de.steamwar.towerrun.TowerRun;
|
||||||
|
import de.steamwar.towerrun.winconditions.FirstOutsideWincondition;
|
||||||
|
import de.steamwar.towerrun.winconditions.LastOutsideWincondition;
|
||||||
|
import de.steamwar.towerrun.winconditions.LastRemainingWincondition;
|
||||||
import de.steamwar.towerrun.winconditions.WinCondition;
|
import de.steamwar.towerrun.winconditions.WinCondition;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.experimental.UtilityClass;
|
import lombok.experimental.UtilityClass;
|
||||||
@ -30,9 +33,8 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
|||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.HashMap;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@UtilityClass
|
@UtilityClass
|
||||||
public class WorldConfig {
|
public class WorldConfig {
|
||||||
@ -46,6 +48,13 @@ public class WorldConfig {
|
|||||||
public static final Location MAX_TOWER;
|
public static final Location MAX_TOWER;
|
||||||
public static final List<String> ACTIVE_WINCONDITIONS;
|
public static final List<String> ACTIVE_WINCONDITIONS;
|
||||||
|
|
||||||
|
public static final List<WinCondition> WINCONDITIONS = new ArrayList<>();
|
||||||
|
static {
|
||||||
|
WINCONDITIONS.add(new LastRemainingWincondition());
|
||||||
|
WINCONDITIONS.add(new LastOutsideWincondition());
|
||||||
|
WINCONDITIONS.add(new FirstOutsideWincondition());
|
||||||
|
}
|
||||||
|
|
||||||
private static Location parseLocation(ConfigurationSection section) {
|
private static Location parseLocation(ConfigurationSection section) {
|
||||||
Location loc = new Location(
|
Location loc = new Location(
|
||||||
Bukkit.getWorlds().get(0),
|
Bukkit.getWorlds().get(0),
|
||||||
@ -70,8 +79,6 @@ public class WorldConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ConfigurationSection config = YamlConfiguration.loadConfiguration(configFile);
|
ConfigurationSection config = YamlConfiguration.loadConfiguration(configFile);
|
||||||
System.out.println(configFile.getAbsolutePath());
|
|
||||||
System.out.println(config.getKeys(false));
|
|
||||||
ConfigurationSection tower = config.getConfigurationSection("tower");
|
ConfigurationSection tower = config.getConfigurationSection("tower");
|
||||||
|
|
||||||
List<ConfigurationSection> regions = tower.getConfigurationSection("regions").getKeys(false).stream()
|
List<ConfigurationSection> regions = tower.getConfigurationSection("regions").getKeys(false).stream()
|
||||||
@ -119,8 +126,8 @@ public class WorldConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LAVA_Y = tower.getInt("lavaY");
|
LAVA_Y = tower.getInt("lavaY");
|
||||||
ACTIVE_WINCONDITIONS = tower.getStringList("winconditions");
|
ACTIVE_WINCONDITIONS = config.getStringList("winconditions");
|
||||||
WinCondition.WINCONDITIONS.stream().filter(winCondition -> ACTIVE_WINCONDITIONS.contains(winCondition.getName())).forEach(WinCondition::enable);
|
WINCONDITIONS.stream().filter(winCondition -> ACTIVE_WINCONDITIONS.contains(winCondition.getName())).forEach(winCondition -> winCondition.setActive(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
package de.steamwar.towerrun.game;
|
package de.steamwar.towerrun.game;
|
||||||
|
|
||||||
import de.steamwar.towerrun.config.WorldConfig;
|
import de.steamwar.towerrun.config.WorldConfig;
|
||||||
|
import lombok.ToString;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -46,4 +47,11 @@ public record TowerRunPlayer(Player player) {
|
|||||||
player.teleport(WorldConfig.SPAWN);
|
player.teleport(WorldConfig.SPAWN);
|
||||||
player.setVelocity(new Vector(0, 0, 0));
|
player.setVelocity(new Vector(0, 0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "TowerRunPlayer{" +
|
||||||
|
"player=" + player.getName() +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ public abstract class OutsideWincondition extends WinCondition {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getPlayer().getLocation().add(0, -0.1, 0).getBlock().getType() == Material.AIR) {
|
if (event.getPlayer().getVelocity().getY() != -0.0784000015258789) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,13 +29,6 @@ import java.util.*;
|
|||||||
@Getter
|
@Getter
|
||||||
public abstract class WinCondition extends GameStateBukkitListener {
|
public abstract class WinCondition extends GameStateBukkitListener {
|
||||||
|
|
||||||
public static final List<WinCondition> WINCONDITIONS = new ArrayList<>();
|
|
||||||
static {
|
|
||||||
WINCONDITIONS.add(new LastRemainingWincondition());
|
|
||||||
WINCONDITIONS.add(new LastOutsideWincondition());
|
|
||||||
WINCONDITIONS.add(new FirstOutsideWincondition());
|
|
||||||
}
|
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
@Setter
|
@Setter
|
||||||
private boolean active = false;
|
private boolean active = false;
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren