Skip to content

Commit 7d84ecf

Browse files
committed
Fix: Export StrafingScript and apply Prettier formatting
- Exported StrafingScript class from main.ts to resolve TypeScript import errors. - Applied Prettier formatting to ArrowRefiller.ts, AutoClicker.ts, FixHand.ts, TriggerBot.ts and main.ts for consistent code style.
1 parent 175276e commit 7d84ecf

File tree

5 files changed

+33
-18
lines changed

5 files changed

+33
-18
lines changed

src/skyblock/ArrowRefiller.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class ArrowRefiller {
2525
private readonly defaultConfig: ArrowRefillerConfig = {
2626
enabled: true,
2727
minArrows: 64,
28-
cooldownSeconds: 300 // Default 5 minutes
28+
cooldownSeconds: 300, // Default 5 minutes
2929
};
3030

3131
private config: ArrowRefillerConfig;
@@ -36,19 +36,23 @@ export class ArrowRefiller {
3636

3737
// Constants for delays
3838
private readonly MAX_SCREEN_WAIT_TICKS = 60; // 3 seconds
39-
private readonly CLICK_DELAY_TICKS = 5; // 250ms
39+
private readonly CLICK_DELAY_TICKS = 5; // 250ms
4040

4141
private strafer: StrafingScript; // New: Reference to StrafingScript
4242

43-
constructor(strafer: StrafingScript) { // Modified constructor
43+
constructor(strafer: StrafingScript) {
44+
// Modified constructor
4445
this.strafer = strafer;
4546
this.config = Config.readConfig(this.configPath, this.defaultConfig, this.scriptId);
4647
this.registerListeners();
4748
this.registerCommands();
4849
}
4950

5051
private registerListeners() {
51-
JsMacros.on('Tick', JavaWrapper.methodToJava(() => this.onTick()));
52+
JsMacros.on(
53+
'Tick',
54+
JavaWrapper.methodToJava(() => this.onTick())
55+
);
5256
}
5357

5458
private onTick() {
@@ -110,7 +114,8 @@ export class ArrowRefiller {
110114
break;
111115

112116
case RefillState.CLICK_SLOT_15:
113-
if (this.stateTickCounter >= this.CLICK_DELAY_TICKS) { // Wait a few ticks before clicking
117+
if (this.stateTickCounter >= this.CLICK_DELAY_TICKS) {
118+
// Wait a few ticks before clicking
114119
if (!this.clickSlot(15)) {
115120
this.resetState();
116121
return;
@@ -119,7 +124,7 @@ export class ArrowRefiller {
119124
this.stateTickCounter = 0;
120125
}
121126
break;
122-
127+
123128
case RefillState.WAIT_AFTER_CLICK_15:
124129
if (this.stateTickCounter >= this.CLICK_DELAY_TICKS) {
125130
this.refillState = RefillState.CLICK_SLOT_12;
@@ -128,7 +133,8 @@ export class ArrowRefiller {
128133
break;
129134

130135
case RefillState.CLICK_SLOT_12:
131-
if (this.stateTickCounter >= this.CLICK_DELAY_TICKS) { // Wait a few ticks before clicking
136+
if (this.stateTickCounter >= this.CLICK_DELAY_TICKS) {
137+
// Wait a few ticks before clicking
132138
if (!this.clickSlot(12)) {
133139
this.resetState();
134140
return;
@@ -220,7 +226,7 @@ export class ArrowRefiller {
220226
this.saveConfig();
221227
Chat.log(`§7ArrowRefill threshold set to §a${amt}`);
222228
});
223-
229+
224230
cmd.literal('cooldown') // New command to set cooldown
225231
.argument('seconds', 'int')
226232
.executes((ctx) => {

src/skyblock/AutoClicker.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ export class AutoClicker {
2525
}
2626

2727
private registerListeners() {
28-
JsMacros.on('Tick', JavaWrapper.methodToJava(() => this.onTick()));
28+
JsMacros.on(
29+
'Tick',
30+
JavaWrapper.methodToJava(() => this.onTick())
31+
);
2932
}
3033

3134
private onTick() {
@@ -49,7 +52,7 @@ export class AutoClicker {
4952
// Add +/- 20% randomness
5053
const variance = baseDelay * 0.2;
5154
const random = Math.random() * (variance * 2) - variance;
52-
55+
5356
this.nextClickTime = now + baseDelay + random;
5457
} else {
5558
// Release between clicks to respect CPS

src/skyblock/FixHand.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export class FixHand {
1111
private readonly scriptId = 'fixHand';
1212
private readonly defaultConfig: FixHandConfig = {
1313
enabled: true,
14-
threshold: 0.20,
14+
threshold: 0.2,
1515
};
1616

1717
private config: FixHandConfig;
@@ -24,18 +24,21 @@ export class FixHand {
2424
}
2525

2626
private registerListeners() {
27-
JsMacros.on('Tick', JavaWrapper.methodToJava(() => this.onTick()));
27+
JsMacros.on(
28+
'Tick',
29+
JavaWrapper.methodToJava(() => this.onTick())
30+
);
2831
}
2932

3033
private onTick() {
3134
if (!this.config.enabled) return;
32-
35+
3336
// 5 seconds cooldown to prevent spamming the command
3437
if (Date.now() - this.lastFixTime < 5000) return;
3538

3639
const player = Player.getPlayer();
3740
if (!player) return;
38-
41+
3942
const item = player.getMainHand();
4043
if (!item || item.isEmpty()) return;
4144

@@ -73,7 +76,7 @@ export class FixHand {
7376
let val = ctx.getArg('percent');
7477
// Optional: normalize if user enters 20 instead of 0.2
7578
if (val > 1) val = val / 100;
76-
79+
7780
this.config.threshold = val;
7881
this.saveConfig();
7982
Chat.log(`§7FixHand threshold set to §a${(val * 100).toFixed(1)}%`);

src/skyblock/TriggerBot.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ export class TriggerBot {
2525
}
2626

2727
private registerListeners() {
28-
JsMacros.on('Tick', JavaWrapper.methodToJava(() => this.onTick()));
28+
JsMacros.on(
29+
'Tick',
30+
JavaWrapper.methodToJava(() => this.onTick())
31+
);
2932
}
3033

3134
private onTick() {
@@ -42,7 +45,7 @@ export class TriggerBot {
4245
// then verify distance if needed, but usually rayTraceEntity handles the intersection correctly.
4346
// We pass the float; JsMacros/Java usually handles Number -> int/double conversion or the method supports double.
4447
// If the method strictly cuts off at int, Math.ceil ensures we cover the range.
45-
const traceDist = Math.ceil(this.config.reach);
48+
const traceDist = Math.ceil(this.config.reach);
4649
const target = player.rayTraceEntity(traceDist);
4750

4851
if (target) {

src/skyblock/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ interface ClickState {
6161
// Main Script Class
6262
// =============================================================================
6363

64-
class StrafingScript {
64+
export class StrafingScript {
6565
private readonly configPath = './config/jayc331-config.json';
6666
private readonly scriptId = 'skyblock';
6767

0 commit comments

Comments
 (0)