make core start and end configurable
This commit is contained in:
@@ -32,11 +32,18 @@ public class Configuration {
|
||||
@Getter public BotOption[] bots = new BotOption[]{};
|
||||
|
||||
public static class Core {
|
||||
@Getter public int layers = 3;
|
||||
@Getter public Position start = new Position();
|
||||
@Getter public Position end = new Position();
|
||||
@Getter public int refillInterval = (60 * 5) * 1000; // 5 minutes
|
||||
@Getter public String customName = "[{\"text\":\"ChomeNS \",\"color\":\"yellow\"},{\"text\":\"Core\",\"color\":\"green\"},{\"text\":\"™\",\"color\":\"gold\"}]";
|
||||
}
|
||||
|
||||
public static class Position {
|
||||
@Getter public int x = 0;
|
||||
@Getter public int y = 0;
|
||||
@Getter public int z = 0;
|
||||
}
|
||||
|
||||
public static class Discord {
|
||||
@Getter public String prefix = "default!";
|
||||
@Getter public String token;
|
||||
|
||||
@@ -41,13 +41,13 @@ public class CorePlugin extends PositionPlugin.Listener {
|
||||
|
||||
private ScheduledFuture<?> refillTask;
|
||||
|
||||
public final Vector3i coreStart = Vector3i.from(0, 0, 0);
|
||||
public Vector3i coreEnd;
|
||||
public final Vector3i coreStart;
|
||||
public final Vector3i coreEnd;
|
||||
|
||||
public Vector3i origin;
|
||||
public Vector3i originEnd;
|
||||
|
||||
public Vector3i relativeCorePosition = Vector3i.from(coreStart);
|
||||
public Vector3i relativeCorePosition;
|
||||
|
||||
private int nextTransactionId = 0;
|
||||
private final Map<Integer, CompletableFuture<CompoundTag>> transactions = new HashMap<>();
|
||||
@@ -58,6 +58,19 @@ public class CorePlugin extends PositionPlugin.Listener {
|
||||
this.bot = bot;
|
||||
this.kaboom = bot.options().kaboom();
|
||||
|
||||
this.coreStart = Vector3i.from(
|
||||
bot.config().core().start().x(),
|
||||
bot.config().core().start().y(),
|
||||
bot.config().core().start().z()
|
||||
);
|
||||
this.coreEnd = Vector3i.from(
|
||||
bot.config().core().end().x(),
|
||||
bot.config().core().end().y(),
|
||||
bot.config().core().end().z()
|
||||
);
|
||||
|
||||
this.relativeCorePosition = Vector3i.from(coreStart);
|
||||
|
||||
bot.position().addListener(this);
|
||||
|
||||
bot.addListener(new Bot.Listener() {
|
||||
@@ -241,12 +254,28 @@ public class CorePlugin extends PositionPlugin.Listener {
|
||||
|
||||
@Override
|
||||
public void positionChange (Vector3i position) {
|
||||
coreEnd = Vector3i.from(15, bot.config().core().layers() - 1, 15);
|
||||
origin = Vector3i.from(
|
||||
Math.floor((double) bot.position().position().getX() / 16) * 16,
|
||||
0,
|
||||
Math.floor((double) bot.position().position().getZ() / 16) * 16
|
||||
);
|
||||
// hm?
|
||||
if (
|
||||
coreStart.getX() == 0 &&
|
||||
coreStart.getY() == 0 &&
|
||||
coreStart.getZ() == 0 &&
|
||||
|
||||
coreEnd.getX() == 15 &&
|
||||
coreEnd.getY() == 2 &&
|
||||
coreEnd.getZ() == 15
|
||||
) {
|
||||
origin = Vector3i.from(
|
||||
Math.floor((double) bot.position().position().getX() / 16) * 16,
|
||||
0,
|
||||
Math.floor((double) bot.position().position().getZ() / 16) * 16
|
||||
);
|
||||
} else {
|
||||
origin = Vector3i.from(
|
||||
bot.position().position().getX(),
|
||||
0,
|
||||
bot.position().position().getZ()
|
||||
);
|
||||
}
|
||||
originEnd = origin.add(coreEnd);
|
||||
|
||||
refill();
|
||||
|
||||
Reference in New Issue
Block a user