make core start and end configurable
This commit is contained in:
parent
98ee395384
commit
ce173298d8
3 changed files with 54 additions and 11 deletions
|
@ -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();
|
||||
|
|
|
@ -35,7 +35,14 @@ keys:
|
|||
weatherApiKey: 'key here' # weatherapi.com key
|
||||
|
||||
core:
|
||||
layers: 3
|
||||
start:
|
||||
x: 0
|
||||
y: 0
|
||||
z: 0
|
||||
end:
|
||||
x: 15
|
||||
y: 2
|
||||
z: 15
|
||||
refillInterval: 300000 # (60 * 5) * 1000 (5 minutes)
|
||||
# PLEASE give valid JSON component here else the core don't refill at all
|
||||
customName: '[{"text":"ChomeNS ","color":"yellow"},{"text":"Core","color":"green"},{"text":"™","color":"gold"}]'
|
||||
|
|
Loading…
Reference in a new issue