mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-03 06:16:10 +00:00
Move lang and commands to Gaea
This commit is contained in:
5
.idea/jarRepositories.xml
generated
5
.idea/jarRepositories.xml
generated
@@ -21,6 +21,11 @@
|
||||
<option name="name" value="spigotmc-repo" />
|
||||
<option name="url" value="https://hub.spigotmc.org/nexus/content/repositories/snapshots/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="parsii.local" />
|
||||
<option name="name" value="parsii" />
|
||||
<option name="url" value="file:$PROJECT_DIR$/../parsii/repo" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
|
||||
16
pom.xml
16
pom.xml
@@ -33,6 +33,10 @@
|
||||
<pattern>org.bstats.bukkit</pattern>
|
||||
<shadedPattern>com.dfsek.terra.lib.bstats</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>parsii</pattern>
|
||||
<shadedPattern>com.dfsek.terra.lib.parsii</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
<executions>
|
||||
@@ -68,6 +72,11 @@
|
||||
<id>CodeMC</id>
|
||||
<url>https://repo.codemc.org/repository/maven-public</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>parsii.local</id>
|
||||
<name>parsii</name>
|
||||
<url>file:/home/dfsek/Documents/parsii/repo</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
@@ -91,7 +100,7 @@
|
||||
<dependency>
|
||||
<groupId>org.polydev</groupId>
|
||||
<artifactId>gaea</artifactId>
|
||||
<version>1.10.93</version>
|
||||
<version>1.11.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -123,6 +132,11 @@
|
||||
<version>1.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.scireum</groupId>
|
||||
<artifactId>parsii</artifactId>
|
||||
<version>1.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -2,6 +2,7 @@ package com.dfsek.terra;
|
||||
|
||||
import com.dfsek.terra.command.TerraCommand;
|
||||
import com.dfsek.terra.config.base.ConfigUtil;
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import com.dfsek.terra.generation.TerraChunkGenerator;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -10,10 +11,13 @@ import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.polydev.gaea.GaeaPlugin;
|
||||
import org.polydev.gaea.generation.GaeaChunkGenerator;
|
||||
import org.polydev.gaea.lang.Language;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class Terra extends JavaPlugin {
|
||||
public class Terra extends GaeaPlugin {
|
||||
private static Terra instance;
|
||||
|
||||
public static Terra getInstance() {
|
||||
@@ -34,7 +38,7 @@ public class Terra extends JavaPlugin {
|
||||
ConfigUtil.loadConfig(this);
|
||||
|
||||
PluginCommand c = Objects.requireNonNull(getCommand("terra"));
|
||||
TerraCommand command = new TerraCommand();
|
||||
TerraCommand command = new TerraCommand(this);
|
||||
c.setExecutor(command);
|
||||
c.setTabCompleter(command);
|
||||
|
||||
@@ -47,4 +51,19 @@ public class Terra extends JavaPlugin {
|
||||
public @Nullable ChunkGenerator getDefaultWorldGenerator(@NotNull String worldName, @Nullable String id) {
|
||||
return new TerraChunkGenerator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDebug() {
|
||||
return ConfigUtil.debug;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GaeaChunkGenerator> getGeneratorClass() {
|
||||
return TerraChunkGenerator.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Language getLanguage() {
|
||||
return LangUtil.getLanguage();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
package com.dfsek.terra.biome;
|
||||
|
||||
import com.dfsek.terra.biome.failsafe.FailoverBiome;
|
||||
import com.dfsek.terra.config.base.ConfigPack;
|
||||
import com.dfsek.terra.config.base.ConfigUtil;
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import com.dfsek.terra.procgen.math.Vector2;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.polydev.gaea.biome.Biome;
|
||||
import org.polydev.gaea.biome.BiomeGrid;
|
||||
import org.polydev.gaea.generation.GenerationPhase;
|
||||
import org.polydev.gaea.math.parsii.tokenizer.ParseException;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class TerraBiomeGrid extends BiomeGrid {
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.dfsek.terra.biome.failsafe;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.polydev.gaea.biome.Biome;
|
||||
import org.polydev.gaea.math.parsii.tokenizer.ParseException;
|
||||
import parsii.tokenizer.ParseException;
|
||||
|
||||
/**
|
||||
* What happens if terrain generation is attempted with an unrecoverable config error.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.dfsek.terra.biome.failsafe;
|
||||
|
||||
import com.dfsek.terra.biome.UserDefinedBiome;
|
||||
import org.polydev.gaea.math.parsii.tokenizer.ParseException;
|
||||
import parsii.tokenizer.ParseException;
|
||||
|
||||
/**
|
||||
* Blank biome to generate in case of a severe config error
|
||||
|
||||
@@ -3,13 +3,11 @@ package com.dfsek.terra.biome.failsafe;
|
||||
import com.dfsek.terra.generation.UserDefinedGenerator;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.polydev.gaea.math.parsii.eval.Variable;
|
||||
import org.polydev.gaea.math.parsii.tokenizer.ParseException;
|
||||
import org.polydev.gaea.world.palette.Palette;
|
||||
import org.polydev.gaea.world.palette.RandomPalette;
|
||||
import parsii.tokenizer.ParseException;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.TreeMap;
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.dfsek.terra.command;
|
||||
|
||||
import com.dfsek.terra.TerraWorld;
|
||||
import com.dfsek.terra.command.type.PlayerCommand;
|
||||
import com.dfsek.terra.command.type.WorldCommand;
|
||||
import com.dfsek.terra.config.base.WorldConfig;
|
||||
import com.dfsek.terra.config.genconfig.OreConfig;
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import org.bukkit.World;
|
||||
@@ -12,12 +9,17 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.polydev.gaea.command.WorldCommand;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class OreCommand extends WorldCommand {
|
||||
public OreCommand(org.polydev.gaea.command.Command parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args, World w) {
|
||||
Block bl = sender.getTargetBlockExact(25);
|
||||
@@ -39,7 +41,7 @@ public class OreCommand extends WorldCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<com.dfsek.terra.command.type.Command> getSubCommands() {
|
||||
public List<org.polydev.gaea.command.Command> getSubCommands() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
package com.dfsek.terra.command;
|
||||
|
||||
import com.dfsek.terra.Terra;
|
||||
import com.dfsek.terra.command.type.Command;
|
||||
import com.dfsek.terra.command.type.DebugCommand;
|
||||
import com.dfsek.terra.config.base.ConfigUtil;
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.polydev.gaea.command.Command;
|
||||
import org.polydev.gaea.command.DebugCommand;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class ReloadCommand extends Command implements DebugCommand {
|
||||
public ReloadCommand(Command parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "reload";
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
package com.dfsek.terra.command;
|
||||
|
||||
import com.dfsek.terra.command.type.Command;
|
||||
import com.dfsek.terra.command.type.WorldCommand;
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import com.dfsek.terra.generation.TerraChunkGenerator;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.polydev.gaea.command.Command;
|
||||
import org.polydev.gaea.command.WorldCommand;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class SaveDataCommand extends WorldCommand {
|
||||
public SaveDataCommand(Command parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "save-data";
|
||||
|
||||
@@ -5,24 +5,29 @@ import com.dfsek.terra.command.geometry.GeometryCommand;
|
||||
import com.dfsek.terra.command.image.ImageCommand;
|
||||
import com.dfsek.terra.command.profile.ProfileCommand;
|
||||
import com.dfsek.terra.command.structure.StructureCommand;
|
||||
import com.dfsek.terra.command.type.Command;
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.polydev.gaea.GaeaPlugin;
|
||||
import org.polydev.gaea.command.Command;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class TerraCommand extends Command {
|
||||
private final List<com.dfsek.terra.command.type.Command> commands = Arrays.asList(new ReloadCommand(),
|
||||
new BiomeCommand(),
|
||||
new OreCommand(),
|
||||
new ProfileCommand(),
|
||||
new SaveDataCommand(),
|
||||
new StructureCommand(),
|
||||
new ImageCommand(),
|
||||
new GeometryCommand());
|
||||
private final List<Command> commands = Arrays.asList(new ReloadCommand(this),
|
||||
new BiomeCommand(this),
|
||||
new OreCommand(this),
|
||||
new ProfileCommand(this),
|
||||
new SaveDataCommand(this),
|
||||
new StructureCommand(this),
|
||||
new ImageCommand(this),
|
||||
new GeometryCommand(this));
|
||||
|
||||
public TerraCommand(GaeaPlugin main) {
|
||||
super(main);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
|
||||
@@ -3,13 +3,13 @@ package com.dfsek.terra.command.biome;
|
||||
import com.dfsek.terra.TerraWorld;
|
||||
import com.dfsek.terra.biome.TerraBiomeGrid;
|
||||
import com.dfsek.terra.biome.UserDefinedBiome;
|
||||
import com.dfsek.terra.command.type.WorldCommand;
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.polydev.gaea.command.WorldCommand;
|
||||
import org.polydev.gaea.generation.GenerationPhase;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -17,6 +17,10 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class BiomeCommand extends WorldCommand {
|
||||
public BiomeCommand(org.polydev.gaea.command.Command parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args, World w) {
|
||||
TerraBiomeGrid grid = TerraWorld.getWorld(sender.getWorld()).getGrid();
|
||||
@@ -31,8 +35,8 @@ public class BiomeCommand extends WorldCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<com.dfsek.terra.command.type.Command> getSubCommands() {
|
||||
return Arrays.asList(new BiomeLocateCommand(true), new BiomeLocateCommand(false), new BiomeInfoCommand());
|
||||
public List<org.polydev.gaea.command.Command> getSubCommands() {
|
||||
return Arrays.asList(new BiomeLocateCommand(this, true), new BiomeLocateCommand(this, false), new BiomeInfoCommand(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package com.dfsek.terra.command.biome;
|
||||
|
||||
import com.dfsek.terra.TerraWorld;
|
||||
import com.dfsek.terra.biome.TerraBiomeGrid;
|
||||
import com.dfsek.terra.biome.UserDefinedBiome;
|
||||
import com.dfsek.terra.command.type.WorldCommand;
|
||||
import com.dfsek.terra.config.TerraConfig;
|
||||
import com.dfsek.terra.config.base.ConfigPack;
|
||||
import com.dfsek.terra.config.genconfig.StructureConfig;
|
||||
import com.dfsek.terra.config.genconfig.biome.BiomeConfig;
|
||||
@@ -16,13 +13,17 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.polydev.gaea.generation.GenerationPhase;
|
||||
import org.polydev.gaea.command.WorldCommand;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class BiomeInfoCommand extends WorldCommand {
|
||||
public BiomeInfoCommand(org.polydev.gaea.command.Command parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args, World world) {
|
||||
String id = args[0];
|
||||
@@ -92,7 +93,7 @@ public class BiomeInfoCommand extends WorldCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<com.dfsek.terra.command.type.Command> getSubCommands() {
|
||||
public List<org.polydev.gaea.command.Command> getSubCommands() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.dfsek.terra.Terra;
|
||||
import com.dfsek.terra.TerraWorld;
|
||||
import com.dfsek.terra.async.AsyncBiomeFinder;
|
||||
import com.dfsek.terra.biome.UserDefinedBiome;
|
||||
import com.dfsek.terra.command.type.WorldCommand;
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import com.dfsek.terra.generation.TerraChunkGenerator;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -13,15 +12,16 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.polydev.gaea.command.WorldCommand;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class BiomeLocateCommand extends WorldCommand {
|
||||
private final boolean tp;
|
||||
public BiomeLocateCommand(boolean teleport) {
|
||||
public BiomeLocateCommand(org.polydev.gaea.command.Command parent, boolean teleport) {
|
||||
super(parent);
|
||||
this.tp = teleport;
|
||||
}
|
||||
@Override
|
||||
@@ -51,7 +51,7 @@ public class BiomeLocateCommand extends WorldCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<com.dfsek.terra.command.type.Command> getSubCommands() {
|
||||
public List<org.polydev.gaea.command.Command> getSubCommands() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,21 +1,24 @@
|
||||
package com.dfsek.terra.command.geometry;
|
||||
|
||||
import com.dfsek.terra.command.type.PlayerCommand;
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import com.dfsek.terra.procgen.voxel.DeformedSphere;
|
||||
import com.dfsek.terra.procgen.voxel.Sphere;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.polydev.gaea.command.PlayerCommand;
|
||||
import org.polydev.gaea.math.FastNoise;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class DeformedSphereCommand extends PlayerCommand {
|
||||
public DeformedSphereCommand(org.polydev.gaea.command.Command parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||
int radius;
|
||||
@@ -56,7 +59,7 @@ public class DeformedSphereCommand extends PlayerCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<com.dfsek.terra.command.type.Command> getSubCommands() {
|
||||
public List<org.polydev.gaea.command.Command> getSubCommands() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
package com.dfsek.terra.command.geometry;
|
||||
|
||||
import com.dfsek.terra.command.type.DebugCommand;
|
||||
import com.dfsek.terra.command.type.PlayerCommand;
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.polydev.gaea.command.DebugCommand;
|
||||
import org.polydev.gaea.command.PlayerCommand;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class GeometryCommand extends PlayerCommand implements DebugCommand {
|
||||
public GeometryCommand(org.polydev.gaea.command.Command parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||
LangUtil.send("command.geometry.main-menu", sender);
|
||||
@@ -25,8 +29,8 @@ public class GeometryCommand extends PlayerCommand implements DebugCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<com.dfsek.terra.command.type.Command> getSubCommands() {
|
||||
return Arrays.asList(new SphereCommand(), new TubeCommand(), new DeformedSphereCommand());
|
||||
public List<org.polydev.gaea.command.Command> getSubCommands() {
|
||||
return Arrays.asList(new SphereCommand(this), new TubeCommand(this), new DeformedSphereCommand(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.dfsek.terra.command.geometry;
|
||||
|
||||
import com.dfsek.terra.command.type.PlayerCommand;
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import com.dfsek.terra.procgen.voxel.Sphere;
|
||||
import org.bukkit.Material;
|
||||
@@ -9,11 +8,16 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.polydev.gaea.command.PlayerCommand;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class SphereCommand extends PlayerCommand {
|
||||
public SphereCommand(org.polydev.gaea.command.Command parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||
int radius;
|
||||
@@ -36,7 +40,7 @@ public class SphereCommand extends PlayerCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<com.dfsek.terra.command.type.Command> getSubCommands() {
|
||||
public List<org.polydev.gaea.command.Command> getSubCommands() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package com.dfsek.terra.command.geometry;
|
||||
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import com.dfsek.terra.util.structure.WorldEditUtil;
|
||||
import com.dfsek.terra.command.type.PlayerCommand;
|
||||
import com.dfsek.terra.procgen.voxel.Tube;
|
||||
import com.dfsek.terra.util.structure.WorldEditUtil;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
@@ -11,11 +10,16 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.polydev.gaea.command.PlayerCommand;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class TubeCommand extends PlayerCommand {
|
||||
public TubeCommand(org.polydev.gaea.command.Command parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||
Location[] l = WorldEditUtil.getSelectionPositions(sender);
|
||||
@@ -40,7 +44,7 @@ public class TubeCommand extends PlayerCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<com.dfsek.terra.command.type.Command> getSubCommands() {
|
||||
public List<org.polydev.gaea.command.Command> getSubCommands() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.dfsek.terra.command.image;
|
||||
|
||||
import com.dfsek.terra.command.type.WorldCommand;
|
||||
import com.dfsek.terra.command.image.gui.GUICommand;
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import org.bukkit.World;
|
||||
@@ -8,12 +7,17 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.polydev.gaea.command.WorldCommand;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class ImageCommand extends WorldCommand {
|
||||
public ImageCommand(org.polydev.gaea.command.Command parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args, World w) {
|
||||
LangUtil.send("command.image.main-menu", sender);
|
||||
@@ -21,8 +25,8 @@ public class ImageCommand extends WorldCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<com.dfsek.terra.command.type.Command> getSubCommands() {
|
||||
return Arrays.asList(new RenderCommand(), new GUICommand());
|
||||
public List<org.polydev.gaea.command.Command> getSubCommands() {
|
||||
return Arrays.asList(new RenderCommand(this), new GUICommand(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.dfsek.terra.command.image;
|
||||
|
||||
import com.dfsek.terra.Terra;
|
||||
import com.dfsek.terra.command.type.WorldCommand;
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import com.dfsek.terra.image.WorldImageGenerator;
|
||||
import org.bukkit.World;
|
||||
@@ -9,12 +8,17 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.polydev.gaea.command.WorldCommand;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class RenderCommand extends WorldCommand {
|
||||
public RenderCommand(org.polydev.gaea.command.Command parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args, World world) {
|
||||
try {
|
||||
@@ -39,7 +43,7 @@ public class RenderCommand extends WorldCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<com.dfsek.terra.command.type.Command> getSubCommands() {
|
||||
public List<org.polydev.gaea.command.Command> getSubCommands() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,23 @@
|
||||
package com.dfsek.terra.command.image.gui;
|
||||
|
||||
import com.dfsek.terra.command.type.DebugCommand;
|
||||
import com.dfsek.terra.command.type.WorldCommand;
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.polydev.gaea.command.DebugCommand;
|
||||
import org.polydev.gaea.command.WorldCommand;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class GUICommand extends WorldCommand implements DebugCommand {
|
||||
public GUICommand(org.polydev.gaea.command.Command parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args, World world) {
|
||||
LangUtil.send("command.image.gui.main-menu", sender);
|
||||
@@ -26,8 +30,8 @@ public class GUICommand extends WorldCommand implements DebugCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<com.dfsek.terra.command.type.Command> getSubCommands() {
|
||||
return Arrays.asList(new StepGUICommand(), new RawGUICommand());
|
||||
public List<org.polydev.gaea.command.Command> getSubCommands() {
|
||||
return Arrays.asList(new StepGUICommand(this), new RawGUICommand(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package com.dfsek.terra.command.image.gui;
|
||||
|
||||
import com.dfsek.terra.TerraWorld;
|
||||
import com.dfsek.terra.command.type.WorldCommand;
|
||||
import com.dfsek.terra.config.base.ConfigUtil;
|
||||
import com.dfsek.terra.config.base.WorldConfig;
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import com.dfsek.terra.image.ImageLoader;
|
||||
import org.bukkit.World;
|
||||
@@ -11,11 +9,16 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.polydev.gaea.command.WorldCommand;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class RawGUICommand extends WorldCommand {
|
||||
public RawGUICommand(org.polydev.gaea.command.Command parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args, World world) {
|
||||
if(! ConfigUtil.debug) {
|
||||
@@ -34,7 +37,7 @@ public class RawGUICommand extends WorldCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<com.dfsek.terra.command.type.Command> getSubCommands() {
|
||||
public List<org.polydev.gaea.command.Command> getSubCommands() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package com.dfsek.terra.command.image.gui;
|
||||
|
||||
import com.dfsek.terra.TerraWorld;
|
||||
import com.dfsek.terra.command.type.WorldCommand;
|
||||
import com.dfsek.terra.config.base.ConfigUtil;
|
||||
import com.dfsek.terra.config.base.WorldConfig;
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import com.dfsek.terra.image.ImageLoader;
|
||||
import org.bukkit.World;
|
||||
@@ -11,11 +9,16 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.polydev.gaea.command.WorldCommand;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class StepGUICommand extends WorldCommand {
|
||||
public StepGUICommand(org.polydev.gaea.command.Command parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args, World world) {
|
||||
if(! ConfigUtil.debug) {
|
||||
@@ -34,7 +37,7 @@ public class StepGUICommand extends WorldCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<com.dfsek.terra.command.type.Command> getSubCommands() {
|
||||
public List<org.polydev.gaea.command.Command> getSubCommands() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
package com.dfsek.terra.command.profile;
|
||||
|
||||
import com.dfsek.terra.command.type.WorldCommand;
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.polydev.gaea.command.WorldCommand;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class ProfileCommand extends WorldCommand {
|
||||
public ProfileCommand(org.polydev.gaea.command.Command parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args, World w) {
|
||||
LangUtil.send("command.profile.main-menu", sender);
|
||||
@@ -25,8 +29,8 @@ public class ProfileCommand extends WorldCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<com.dfsek.terra.command.type.Command> getSubCommands() {
|
||||
return Arrays.asList(new QueryCommand(), new ResetCommand(), new StartCommand(), new StopCommand());
|
||||
public List<org.polydev.gaea.command.Command> getSubCommands() {
|
||||
return Arrays.asList(new QueryCommand(this), new ResetCommand(this), new StartCommand(this), new StopCommand(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
package com.dfsek.terra.command.profile;
|
||||
|
||||
import com.dfsek.terra.TerraProfiler;
|
||||
import com.dfsek.terra.command.type.WorldCommand;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.polydev.gaea.command.WorldCommand;
|
||||
import org.polydev.gaea.profiler.WorldProfiler;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class QueryCommand extends WorldCommand {
|
||||
public QueryCommand(org.polydev.gaea.command.Command parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args, World w) {
|
||||
WorldProfiler profile = TerraProfiler.fromWorld(w);
|
||||
@@ -26,7 +30,7 @@ public class QueryCommand extends WorldCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<com.dfsek.terra.command.type.Command> getSubCommands() {
|
||||
public List<org.polydev.gaea.command.Command> getSubCommands() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,23 @@
|
||||
package com.dfsek.terra.command.profile;
|
||||
|
||||
import com.dfsek.terra.TerraProfiler;
|
||||
import com.dfsek.terra.command.type.WorldCommand;
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.polydev.gaea.command.WorldCommand;
|
||||
import org.polydev.gaea.profiler.WorldProfiler;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class ResetCommand extends WorldCommand {
|
||||
public ResetCommand(org.polydev.gaea.command.Command parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args, World world) {
|
||||
WorldProfiler profile = TerraProfiler.fromWorld(world);
|
||||
@@ -28,7 +32,7 @@ public class ResetCommand extends WorldCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<com.dfsek.terra.command.type.Command> getSubCommands() {
|
||||
public List<org.polydev.gaea.command.Command> getSubCommands() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,23 @@
|
||||
package com.dfsek.terra.command.profile;
|
||||
|
||||
import com.dfsek.terra.TerraProfiler;
|
||||
import com.dfsek.terra.command.type.WorldCommand;
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.polydev.gaea.command.WorldCommand;
|
||||
import org.polydev.gaea.profiler.WorldProfiler;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class StartCommand extends WorldCommand {
|
||||
public StartCommand(org.polydev.gaea.command.Command parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args, World world) {
|
||||
WorldProfiler profile = TerraProfiler.fromWorld(world);
|
||||
@@ -28,7 +32,7 @@ public class StartCommand extends WorldCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<com.dfsek.terra.command.type.Command> getSubCommands() {
|
||||
public List<org.polydev.gaea.command.Command> getSubCommands() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,23 @@
|
||||
package com.dfsek.terra.command.profile;
|
||||
|
||||
import com.dfsek.terra.TerraProfiler;
|
||||
import com.dfsek.terra.command.type.WorldCommand;
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.polydev.gaea.command.WorldCommand;
|
||||
import org.polydev.gaea.profiler.WorldProfiler;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class StopCommand extends WorldCommand {
|
||||
public StopCommand(org.polydev.gaea.command.Command parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args, World world) {
|
||||
WorldProfiler profile = TerraProfiler.fromWorld(world);
|
||||
@@ -28,7 +32,7 @@ public class StopCommand extends WorldCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<com.dfsek.terra.command.type.Command> getSubCommands() {
|
||||
public List<org.polydev.gaea.command.Command> getSubCommands() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.dfsek.terra.command.structure;
|
||||
import com.dfsek.terra.Terra;
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import com.dfsek.terra.util.structure.WorldEditUtil;
|
||||
import com.dfsek.terra.command.type.PlayerCommand;
|
||||
import com.dfsek.terra.structure.Structure;
|
||||
import com.dfsek.terra.structure.InitializationException;
|
||||
import org.bukkit.Location;
|
||||
@@ -11,6 +10,7 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.polydev.gaea.command.PlayerCommand;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -18,6 +18,10 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class ExportCommand extends PlayerCommand {
|
||||
public ExportCommand(org.polydev.gaea.command.Command parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||
Location[] l = WorldEditUtil.getSelectionLocations(sender);
|
||||
@@ -54,7 +58,7 @@ public class ExportCommand extends PlayerCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<com.dfsek.terra.command.type.Command> getSubCommands() {
|
||||
public List<org.polydev.gaea.command.Command> getSubCommands() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package com.dfsek.terra.command.structure;
|
||||
|
||||
import com.dfsek.terra.Terra;
|
||||
import com.dfsek.terra.command.type.DebugCommand;
|
||||
import com.dfsek.terra.command.type.PlayerCommand;
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import com.dfsek.terra.structure.Structure;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.polydev.gaea.command.DebugCommand;
|
||||
import org.polydev.gaea.command.PlayerCommand;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -16,6 +16,10 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class LoadCommand extends PlayerCommand implements DebugCommand {
|
||||
public LoadCommand(org.polydev.gaea.command.Command parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||
try {
|
||||
@@ -48,7 +52,7 @@ public class LoadCommand extends PlayerCommand implements DebugCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<com.dfsek.terra.command.type.Command> getSubCommands() {
|
||||
public List<org.polydev.gaea.command.Command> getSubCommands() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,21 +3,16 @@ package com.dfsek.terra.command.structure;
|
||||
import com.dfsek.terra.Terra;
|
||||
import com.dfsek.terra.TerraWorld;
|
||||
import com.dfsek.terra.async.AsyncStructureFinder;
|
||||
import com.dfsek.terra.biome.UserDefinedBiome;
|
||||
import com.dfsek.terra.command.type.WorldCommand;
|
||||
import com.dfsek.terra.config.genconfig.StructureConfig;
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import com.dfsek.terra.generation.TerraChunkGenerator;
|
||||
import com.dfsek.terra.procgen.GridSpawn;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.polydev.gaea.structures.UserDefinedStructure;
|
||||
import org.polydev.gaea.command.WorldCommand;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -26,7 +21,8 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class LocateCommand extends WorldCommand {
|
||||
private final boolean tp;
|
||||
public LocateCommand(boolean tp) {
|
||||
public LocateCommand(org.polydev.gaea.command.Command parent, boolean tp) {
|
||||
super(parent);
|
||||
this.tp = tp;
|
||||
}
|
||||
@Override
|
||||
@@ -56,7 +52,7 @@ public class LocateCommand extends WorldCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<com.dfsek.terra.command.type.Command> getSubCommands() {
|
||||
public List<org.polydev.gaea.command.Command> getSubCommands() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.dfsek.terra.command.structure;
|
||||
|
||||
import com.dfsek.terra.command.type.DebugCommand;
|
||||
import com.dfsek.terra.command.type.WorldCommand;
|
||||
import com.dfsek.terra.structure.StructureSpawnRequirement;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
@@ -9,11 +7,17 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.polydev.gaea.command.DebugCommand;
|
||||
import org.polydev.gaea.command.WorldCommand;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class SpawnCommand extends WorldCommand implements DebugCommand {
|
||||
public SpawnCommand(org.polydev.gaea.command.Command parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args, World world) {
|
||||
Location p = sender.getLocation();
|
||||
@@ -34,7 +38,7 @@ public class SpawnCommand extends WorldCommand implements DebugCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<com.dfsek.terra.command.type.Command> getSubCommands() {
|
||||
public List<org.polydev.gaea.command.Command> getSubCommands() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
package com.dfsek.terra.command.structure;
|
||||
|
||||
import com.dfsek.terra.command.type.PlayerCommand;
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.polydev.gaea.command.PlayerCommand;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class StructureCommand extends PlayerCommand {
|
||||
public StructureCommand(org.polydev.gaea.command.Command parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||
LangUtil.send("command.structure.main-menu", sender);
|
||||
@@ -19,8 +23,8 @@ public class StructureCommand extends PlayerCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<com.dfsek.terra.command.type.Command> getSubCommands() {
|
||||
return Arrays.asList(new ExportCommand(), new LoadCommand(), new LocateCommand(false), new LocateCommand(true), new SpawnCommand());
|
||||
public List<org.polydev.gaea.command.Command> getSubCommands() {
|
||||
return Arrays.asList(new ExportCommand(this), new LoadCommand(this), new LocateCommand(this, false), new LocateCommand(this, true), new SpawnCommand(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
package com.dfsek.terra.command.type;
|
||||
|
||||
import com.dfsek.terra.Debug;
|
||||
import com.dfsek.terra.config.base.ConfigUtil;
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents a command or subcommand, can be nested via getSubCommands.
|
||||
*/
|
||||
public abstract class Command implements CommandExecutor, TabCompleter {
|
||||
/**
|
||||
* Gets the name of the command/subcommand
|
||||
* @return Name of command
|
||||
*/
|
||||
public abstract String getName();
|
||||
|
||||
/**
|
||||
* Gets a list of subcommands
|
||||
* @return List of subcommands
|
||||
*/
|
||||
public abstract List<Command> getSubCommands();
|
||||
|
||||
/**
|
||||
* Executes the given command, returning its success.
|
||||
* <br>
|
||||
* If false is returned, then the "usage" plugin.yml entry for this command
|
||||
* (if defined) will be sent to the player.
|
||||
*
|
||||
* @param sender Source of the command
|
||||
* @param command Command which was executed
|
||||
* @param label Alias of the command which was used
|
||||
* @param args Passed command arguments
|
||||
* @return true if a valid command, otherwise false
|
||||
*/
|
||||
|
||||
public abstract boolean execute(@NotNull CommandSender sender, @NotNull org.bukkit.command.Command command, @NotNull String label, @NotNull String[] args);
|
||||
/**
|
||||
* Gets the number of arguments
|
||||
* @return Number of arguments
|
||||
*/
|
||||
public abstract int arguments();
|
||||
|
||||
/**
|
||||
* Executes the given command, invoking subcommands if applicable and returning its success.
|
||||
* <br>
|
||||
* If false is returned, then the "usage" plugin.yml entry for this command
|
||||
* (if defined) will be sent to the player.
|
||||
*
|
||||
* @param sender Source of the command
|
||||
* @param command Command which was executed
|
||||
* @param label Alias of the command which was used
|
||||
* @param args Passed command arguments
|
||||
* @return true if a valid command, otherwise false
|
||||
*/
|
||||
@Override
|
||||
public final boolean onCommand(@NotNull CommandSender sender, @NotNull org.bukkit.command.Command command, @NotNull String label, @NotNull String[] args) {
|
||||
if(this instanceof DebugCommand && ! ConfigUtil.debug) {
|
||||
LangUtil.send("command.debug-only", sender);
|
||||
return true;
|
||||
}
|
||||
if(args.length > 0) {
|
||||
for(Command c : getSubCommands()) {
|
||||
if(c.getName().equals(args[0])) {
|
||||
return c.onCommand(sender, command, label, Arrays.stream(args, 1, args.length).toArray(String[]::new));
|
||||
}
|
||||
}
|
||||
if(args.length != arguments()) {
|
||||
LangUtil.send("command.invalid", sender, String.valueOf(arguments()), String.valueOf(args.length));
|
||||
return true;
|
||||
}
|
||||
return execute(sender, command, label, args);
|
||||
}
|
||||
if(args.length != arguments()) {
|
||||
LangUtil.send("command.invalid", sender, String.valueOf(arguments()), String.valueOf(args.length));
|
||||
return true;
|
||||
}
|
||||
return execute(sender, command, label, new String[] {});
|
||||
}
|
||||
|
||||
public abstract List<String> getTabCompletions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args);
|
||||
|
||||
@Override
|
||||
public final @Nullable List<String> onTabComplete(@NotNull CommandSender sender, org.bukkit.command.@NotNull Command command, @NotNull String alias, @NotNull String[] args) {
|
||||
List<String> complete = new ArrayList<>();
|
||||
if(args.length > 0) for(Command c : getSubCommands()) {
|
||||
if(c.getName().startsWith(args[0])) complete.add(c.getName());
|
||||
if(c.getName().equals(args[0])) return c.onTabComplete(sender, command, alias, Arrays.stream(args, 1, args.length).toArray(String[]::new));
|
||||
}
|
||||
complete.addAll(getTabCompletions(sender, alias, args));
|
||||
return complete;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.dfsek.terra.command.type;
|
||||
|
||||
/**
|
||||
* Implementing this interface marks a command as debug-only.
|
||||
* If a parent command implements this interface, all child commands will be considered debug commands, regardless of whether they implement DebugCommand as well.
|
||||
*/
|
||||
public interface DebugCommand {
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.dfsek.terra.command.type;
|
||||
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* A command that may only be executed by a player. If executor is not a player, a message will be displayed and no action will be performed.
|
||||
*/
|
||||
public abstract class PlayerCommand extends Command {
|
||||
/**
|
||||
* Executes the given command, returning its success.
|
||||
* <br>
|
||||
* If false is returned, then the "usage" plugin.yml entry for this command
|
||||
* (if defined) will be sent to the player.
|
||||
*
|
||||
* @param sender Source of the command
|
||||
* @param command Command which was executed
|
||||
* @param label Alias of the command which was used
|
||||
* @param args Passed command arguments
|
||||
* @return true if a valid command, otherwise false
|
||||
*/
|
||||
@Override
|
||||
public final boolean execute(@NotNull CommandSender sender, org.bukkit.command.@NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||
if(!(sender instanceof Player)) {
|
||||
LangUtil.send("command.players-only", sender);
|
||||
return true;
|
||||
}
|
||||
Player p = (Player) sender;
|
||||
return execute(p, command, label, args);
|
||||
}
|
||||
/**
|
||||
* Executes the given command, returning its success.
|
||||
* <br>
|
||||
* If false is returned, then the "usage" plugin.yml entry for this command
|
||||
* (if defined) will be sent to the player.
|
||||
*
|
||||
* @param sender Player that executed command
|
||||
* @param command Command which was executed
|
||||
* @param label Alias of the command which was used
|
||||
* @param args Passed command arguments
|
||||
* @return true if a valid command, otherwise false
|
||||
*/
|
||||
public abstract boolean execute(@NotNull Player sender, org.bukkit.command.@NotNull Command command, @NotNull String label, @NotNull String[] args);
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package com.dfsek.terra.command.type;
|
||||
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import com.dfsek.terra.generation.TerraChunkGenerator;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* A command that must be executed by a player, in a Terra world.
|
||||
*/
|
||||
public abstract class WorldCommand extends PlayerCommand {
|
||||
/**
|
||||
* Executes the given command, returning its success.
|
||||
* <br>
|
||||
* If false is returned, then the "usage" plugin.yml entry for this command
|
||||
* (if defined) will be sent to the player.
|
||||
*
|
||||
* @param sender Source of the command
|
||||
* @param command Command which was executed
|
||||
* @param label Alias of the command which was used
|
||||
* @param args Passed command arguments
|
||||
* @return true if a valid command, otherwise false
|
||||
*/
|
||||
@Override
|
||||
public final boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||
if(sender.getWorld().getGenerator() instanceof TerraChunkGenerator) {
|
||||
return execute(sender, command, label, args, sender.getWorld());
|
||||
} else {
|
||||
LangUtil.send("command.world", sender);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the given command, returning its success.
|
||||
* <br>
|
||||
* If false is returned, then the "usage" plugin.yml entry for this command
|
||||
* (if defined) will be sent to the player.
|
||||
*
|
||||
* @param sender Player that executed command
|
||||
* @param command Command which was executed
|
||||
* @param label Alias of the command which was used
|
||||
* @param args Passed command arguments
|
||||
* @param world World in which command was executed
|
||||
* @return true if a valid command, otherwise false
|
||||
*/
|
||||
public abstract boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args, World world);
|
||||
}
|
||||
@@ -3,9 +3,7 @@ package com.dfsek.terra.config;
|
||||
import com.dfsek.terra.config.base.ConfigPack;
|
||||
import com.dfsek.terra.config.base.ConfigUtil;
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.polydev.gaea.commons.io.FilenameUtils;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -2,13 +2,13 @@ package com.dfsek.terra.config.base;
|
||||
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import com.dfsek.terra.image.ImageLoader;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.polydev.gaea.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -12,9 +12,9 @@ import com.dfsek.terra.generation.UserDefinedDecorator;
|
||||
import com.dfsek.terra.generation.UserDefinedGenerator;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.polydev.gaea.math.Range;
|
||||
import org.polydev.gaea.math.parsii.tokenizer.ParseException;
|
||||
import org.polydev.gaea.tree.Tree;
|
||||
import org.polydev.gaea.world.Flora;
|
||||
import parsii.tokenizer.ParseException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.dfsek.terra.Terra;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.polydev.gaea.lang.Language;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
@@ -63,6 +64,11 @@ public final class LangUtil {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Language getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public static void log(String messageID, Level level, String... args) {
|
||||
language.getMessage(messageID).log(logger, level, args);
|
||||
}
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
package com.dfsek.terra.config.lang;
|
||||
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class Language extends YamlConfiguration {
|
||||
public Language(File file) throws IOException, InvalidConfigurationException {
|
||||
load(file);
|
||||
}
|
||||
@Override
|
||||
public void load(@NotNull File file) throws IOException, InvalidConfigurationException {
|
||||
super.load(file);
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
public Message getMessage(String id) {
|
||||
Object m = get(id);
|
||||
Message temp;
|
||||
if(m instanceof List) {
|
||||
temp = new MultiLineMessage((List<String>) m);
|
||||
} else if(m instanceof String) {
|
||||
temp = new SingleLineMessage((String) m);
|
||||
} else return new SingleLineMessage("message:" + id + ":translation_undefined");
|
||||
if(temp.isEmpty()) return new SingleLineMessage("message:" + id + ":translation_undefined");
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.dfsek.terra.config.lang;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public interface Message {
|
||||
void log(Logger logger, Level level, String... args);
|
||||
void send(CommandSender sender, String... args);
|
||||
boolean isEmpty();
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.dfsek.terra.config.lang;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class MultiLineMessage implements Message {
|
||||
private final List<String> message;
|
||||
public MultiLineMessage(List<String> message) {
|
||||
this.message = message;
|
||||
}
|
||||
@Override
|
||||
public void log(Logger logger, Level level, String... args) {
|
||||
for(String line: message) {
|
||||
logger.log(level, String.format(line, Arrays.asList(args).toArray()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(CommandSender sender, String... args) {
|
||||
for(String line: message) {
|
||||
sender.sendMessage(String.format(line, Arrays.asList(args).toArray()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return message == null || message.isEmpty();
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.dfsek.terra.config.lang;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class SingleLineMessage implements Message {
|
||||
private final String message;
|
||||
public SingleLineMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
@Override
|
||||
public void log(Logger logger, Level level, String... args) {
|
||||
logger.log(level, String.format(message, Arrays.asList(args).toArray()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(CommandSender sender, String... args) {
|
||||
sender.sendMessage(String.format(message, Arrays.asList(args).toArray()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return message == null || message.equals("");
|
||||
}
|
||||
}
|
||||
@@ -7,12 +7,12 @@ import org.bukkit.World;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.polydev.gaea.biome.Generator;
|
||||
import org.polydev.gaea.math.FastNoise;
|
||||
import org.polydev.gaea.math.parsii.eval.Expression;
|
||||
import org.polydev.gaea.math.parsii.eval.Parser;
|
||||
import org.polydev.gaea.math.parsii.eval.Scope;
|
||||
import org.polydev.gaea.math.parsii.eval.Variable;
|
||||
import org.polydev.gaea.math.parsii.tokenizer.ParseException;
|
||||
import org.polydev.gaea.world.palette.Palette;
|
||||
import parsii.eval.Expression;
|
||||
import parsii.eval.Parser;
|
||||
import parsii.eval.Scope;
|
||||
import parsii.eval.Variable;
|
||||
import parsii.tokenizer.ParseException;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.dfsek.terra.math;
|
||||
|
||||
import org.polydev.gaea.math.FastNoise;
|
||||
import org.polydev.gaea.math.parsii.eval.Expression;
|
||||
import org.polydev.gaea.math.parsii.eval.Function;
|
||||
import parsii.eval.Expression;
|
||||
import parsii.eval.Function;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.dfsek.terra.math;
|
||||
|
||||
import org.polydev.gaea.math.FastNoise;
|
||||
import org.polydev.gaea.math.parsii.eval.Expression;
|
||||
import org.polydev.gaea.math.parsii.eval.Function;
|
||||
import parsii.eval.Expression;
|
||||
import parsii.eval.Function;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -43,10 +43,10 @@ public class TreePopulator extends GaeaBlockPopulator {
|
||||
for(int i = 0; i < b.getDecorator().getTreeDensity() && att < max; ) {
|
||||
att++;
|
||||
for(Block block : getValidSpawnsAt(chunk, x, z, new Range(0, 254))) {
|
||||
b = grid.getBiome(x+origX, z+origZ, GenerationPhase.POPULATE);
|
||||
Tree tree = b.getDecorator().getTrees().get(random);
|
||||
Range range = tw.getConfig().getBiome((UserDefinedBiome) b).getTreeRange(tree);
|
||||
if(!range.isInRange(block.getY())) continue;
|
||||
b = grid.getBiome(x+origX, z+origZ, GenerationPhase.POPULATE);
|
||||
try {
|
||||
if(tree.plant(block.getLocation(), random, false, Terra.getInstance())) i++;
|
||||
} catch(NullPointerException ignore) {}
|
||||
|
||||
Reference in New Issue
Block a user