Suvarii commited on
Commit
03eafbf
·
verified ·
1 Parent(s): 95c0e36

Update bot.js

Browse files
Files changed (1) hide show
  1. bot.js +281 -282
bot.js CHANGED
@@ -9,302 +9,301 @@ const loggers = require("./logging.js");
9
  const logger = loggers.logger;
10
 
11
  function createBot() {
12
- const bot = mineflayer.createBot({
13
- username: config["bot-account"]["username"],
14
- auth: config["bot-account"]["type"],
15
- host: config.server.ip,
16
- port: config.server.port,
17
- version: config.server.version,
18
- });
19
-
20
- bot.loadPlugin(pathfinder);
21
-
22
- // --- Yardımcı fonksiyonlar (güvenli entity isim okuma ve /home sonrası snapshot) ---
23
- function stripColorCodes(s) {
24
- if (!s || typeof s !== "string") return s;
25
- return s.replace(/§[0-9a-fk-or]/gi, "");
26
- }
27
-
28
- function getEntityReadableName(e) {
29
- if (!e) return "";
30
- try {
31
- if (e.displayName && typeof e.displayName.toString === "function") {
32
- const d = e.displayName.toString();
33
- if (d) return stripColorCodes(d);
34
- }
35
- } catch (err) {}
36
- if (e.name && typeof e.name === "string") return stripColorCodes(e.name);
37
- if (e.username && typeof e.username === "string") return stripColorCodes(e.username);
38
- return "";
39
- }
40
-
41
- function logEntitiesSnapshotToConsole() {
42
- try {
43
- const snapshot = Object.values(bot.entities).map(e => {
44
- const raw = getEntityReadableName(e);
45
- return {
46
- id: e.id,
47
- type: e.type,
48
- rawName: raw,
49
- pos: e.position ? { x: e.position.x, y: e.position.y, z: e.position.z } : null
50
- };
51
- });
52
- console.log("=== ENTITIES SNAPSHOT START ===");
53
- if (snapshot.length === 0) {
54
- console.log("No entities found in bot.entities");
55
- } else {
56
- snapshot.forEach(s => {
57
- console.log(`id:${s.id} type:${s.type} name:${s.rawName || 'null'} pos:${s.pos ? `${s.pos.x.toFixed(2)},${s.pos.y.toFixed(2)},${s.pos.z.toFixed(2)}` : 'null'}`);
58
- });
59
- }
60
- console.log("=== ENTITIES SNAPSHOT END ===");
61
- } catch (err) {
62
- console.error("Entities snapshot alınırken hata:", err);
63
- }
64
- }
65
-
66
- // /home sonrası snapshot tetikleyicisi
67
- function triggerHomeSnapshots() {
68
- setTimeout(() => {
69
- console.log("/home sonrası entity snapshot (5s):");
70
- logEntitiesSnapshotToConsole();
71
- }, 5000);
72
-
73
- setTimeout(() => {
74
- console.log("/home sonrası entity snapshot (12s):");
75
- logEntitiesSnapshotToConsole();
76
- }, 12000);
77
- }
78
-
79
- // Yeni spawn olan entityleri anında logla
80
- bot.on('entitySpawn', (entity) => {
81
- try {
82
- const raw = getEntityReadableName(entity);
83
- console.log(`entitySpawn id:${entity.id} type:${entity.type} name:${raw || 'null'}`);
84
- } catch (err) {
85
- console.error("entitySpawn log hatası:", err);
86
- }
87
- });
88
-
89
- bot.once("spawn", async() => {
90
- const defaultMove = new Movements(bot);
91
- bot.pathfinder.setMovements(defaultMove);
92
- bot.settings.colorsEnabled = false;
93
- logger.info("Bot sunucuya giriş yaptı.");
94
-
95
- if (config.utils["auto-auth"].enabled) {
96
-
97
- let password = config.utils["auto-auth"].password;
98
- setTimeout(() => {
99
- bot.chat(`/login ${password}`);
100
- logger.info(`[${config["bot-account"]["username"]}] Login komutu kullanıldı.`);
101
- }, 500);
102
-
103
- setTimeout(async () => {
104
- bot.chat(`/skyblock`);
105
- logger.info(`[${config["bot-account"]["username"]}] Skyblock'a ışınlanma komutu kullanıldı.`);
106
- }, 5000);
107
-
108
- setTimeout(async () => {
109
- bot.chat(`/home`);
110
- logger.info(`[${config["bot-account"]["username"]}] Home konumuna ışınlanma komutu kullanıldı.`);
111
- // /home sonrası entity snapshot'larını tetikle
112
- triggerHomeSnapshots();
113
- }, 10000);
114
-
115
- // Orijinal interval mantığını koruyorum ama JSON.stringify yerine güvenli kontrol kullanıldı
116
- setInterval(async () => {
117
- try {
118
- const entitiesArr = Object.values(bot.entities);
119
- // Burada eski kodda "ʙᴇsʟᴇʏiᴄi " arıyordun; biz güvenli isim okuma ile kontrol ediyoruz
120
- const foundIndex = entitiesArr.findIndex(e => {
121
- const name = getEntityReadableName(e);
122
- return name && name.includes("ʙᴇsʟᴇʏiᴄi ");
123
- });
124
- if (foundIndex > -1) {
125
- const ent = entitiesArr[foundIndex];
126
- // activateEntityAt çağrısı orijinal kodda vardı; hata verirse logla
127
- try {
128
- bot.activateEntityAt(ent, ent.position);
129
- } catch (err) {
130
- logger.error("activateEntityAt çağrılırken hata: " + (err && err.message ? err.message : err));
131
- }
132
- }
133
- } catch (err) {
134
- logger.error("Periyodik entity kontrolü sırasında hata: " + (err && err.message ? err.message : err));
135
- }
136
- }, 30000);
137
-
138
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
 
140
- if (config.utils["chat-messages"].enabled) {
141
- logger.info("Started chat-messages module");
 
 
 
142
 
143
- let messages = config.utils["chat-messages"]["messages"];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
 
145
- if (config.utils["chat-messages"].repeat) {
146
- let delay = config.utils["chat-messages"]["repeat-delay"];
147
- let i = 0;
148
 
149
- setInterval(() => {
150
- bot.chat(`${messages[i]}`);
 
 
 
 
151
 
152
- if (i + 1 === messages.length) {
153
- i = 0;
154
- } else i++;
155
- }, delay * 1000);
156
- } else {
157
- messages.forEach((msg) => {
158
- bot.chat(msg);
159
- });
160
- }
161
  }
162
 
163
- const pos = config.position;
164
-
165
- if (config.position.enabled) {
166
- logger.info(
167
- `Starting moving to target location (${pos.x}, ${pos.y}, ${pos.z})`,
168
- );
169
- bot.pathfinder.setGoal(new GoalBlock(pos.x, pos.y, pos.z));
170
  }
171
 
172
- if (config.utils["anti-afk"].enabled) {
173
- if (config.utils["anti-afk"].sneak) {
174
- bot.setControlState("sneak", true);
175
- }
176
-
177
- if (config.utils["anti-afk"].jump) {
178
- bot.setControlState("jump", true);
179
- }
180
-
181
- if (config.utils["anti-afk"]["hit"].enabled) {
182
- let delay = config.utils["anti-afk"]["hit"]["delay"];
183
- let attackMobs = config.utils["anti-afk"]["hit"]["attack-mobs"];
184
-
185
- setInterval(() => {
186
- if (attackMobs) {
187
- let entity = bot.nearestEntity(
188
- (e) =>
189
- e.type !== "object" &&
190
- e.type !== "player" &&
191
- e.type !== "global" &&
192
- e.type !== "orb" &&
193
- e.type !== "other",
194
- );
195
-
196
- if (entity) {
197
- bot.attack(entity);
198
- return;
199
- }
200
- }
201
-
202
- bot.swingArm("right", true);
203
- }, delay);
204
- }
205
-
206
- if (config.utils["anti-afk"].rotate) {
207
- setInterval(() => {
208
- bot.look(bot.entity.yaw + 1, bot.entity.pitch, true);
209
- }, 100);
210
- }
211
-
212
- if (config.utils["anti-afk"]["circle-walk"].enabled) {
213
- let radius = config.utils["anti-afk"]["circle-walk"]["radius"];
214
- setInterval(() => {
215
- circleWalk(bot, radius);
216
- }, 30000);
217
- }
218
- }
219
- });
220
-
221
- bot.on('windowOpen', function (window) {
222
- if(window.title.includes("ʙᴇsʟᴇʏiᴄi ᴍiɴʏᴏɴ ᴘᴀɴᴇʟi")){
223
- //Besleyici minyon paneli
224
- if(window.slots.filter(xx => xx?.name && xx?.name == "cooked_beef").length > 0){
225
- var minyoncani = Number((JSON.parse(window.slots.filter(xx => xx?.name && xx?.name == "cooked_beef")[0]?.nbt?.value?.display?.value?.Lore?.value?.value[1])?.extra[0].text).split("/")[0]);
226
- if(minyoncani <= 2){
227
- bot.clickWindow(36,0,0);
228
- logger.info(`[${config["bot-account"]["username"]}] Minyon canı ${minyoncani} olduğu için besleyici minyon beslendi.`);
229
- bot.closeWindow(window);
230
- }else{
231
- bot.closeWindow(window);
232
- }
233
- }else{
234
- bot.closeWindow(window);
235
- }
236
- }else{
237
- bot.closeWindow(window);
238
- }
239
- });
240
 
241
- bot.on("chat", (username, message) => {
242
- if (config.utils["chat-log"]) {
243
- logger.info(`<${username}> ${message}`);
244
  }
245
- });
246
 
247
- bot.on("goal_reached", () => {
248
- if (config.position.enabled) {
249
- logger.info(`Bot arrived to target location. ${bot.entity.position}`);
 
250
  }
251
- });
252
 
253
- bot.on("death", () => {
254
- logger.warn(
255
- `Bot has been died and was respawned at ${bot.entity.position}`,
256
- );
257
- });
258
-
259
- if (config.utils["auto-reconnect"]) {
260
- bot.on("end", () => {
261
- setTimeout(() => {
262
- createBot();
263
- }, config.utils["auto-reconnect-delay"]);
264
- });
265
- }
266
-
267
- bot.on("kicked", (reason) => {
268
- let reasonText = "";
269
- try {
270
- const parsed = JSON.parse(reason);
271
- reasonText = parsed.text || parsed.extra?.[0]?.text || "";
272
- reasonText = reasonText?.replace(/§./g, "");
273
- logger.warn(`Bot sunucudan atıldı.Sebep: ${reasonText}`);
274
- }catch{
275
- logger.warn(`Bot sunucudan atıldı.Sebep: Bulunamadı.`);
276
  }
277
-
278
- });
279
-
280
- bot.on("error", (err) => logger.error(`${err.message}`));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
  }
282
 
283
 
284
  function circleWalk(bot, radius) {
285
- // Make bot walk in square with center in bot's wthout stopping
286
- return new Promise(() => {
287
- const pos = bot.entity.position;
288
- const x = pos.x;
289
- const y = pos.y;
290
- const z = pos.z;
291
-
292
- const points = [
293
- [x + radius, y, z],
294
- [x, y, z + radius],
295
- [x - radius, y, z],
296
- [x, y, z - radius],
297
- ];
298
-
299
- let i = 0;
300
- setTimeout(() => {
301
- if (i === points.length) i = 0;
302
- const defaultMove = new Movements(bot);
303
- bot.pathfinder.setMovements(defaultMove);
304
- bot.pathfinder.setGoal(new GoalXZ(points[i][0], points[i][2]));
305
- i++;
306
- }, 1000);
307
- });
308
  }
309
 
310
  createBot();
@@ -316,12 +315,12 @@ const port = process.env.PORT || 7860; //buraya karışmayın.
316
  app.get("/", (req, res) => res.send("Pinglendi")); //değiştirebilirsiniz.
317
 
318
  app.listen(
319
- port,
320
- () =>
321
- console.log(`Bot bu adres üzerinde çalışıyor: http://localhost:${port}`), //port
322
  );
323
 
324
  process.on('uncaughtException', function (err) {
325
- console.error("Hata aldım!");
326
- console.log(err)
327
- })
 
9
  const logger = loggers.logger;
10
 
11
  function createBot() {
12
+ const bot = mineflayer.createBot({
13
+ username: config["bot-account"]["username"],
14
+ auth: config["bot-account"]["type"],
15
+ host: config.server.ip,
16
+ port: config.server.port,
17
+ version: config.server.version,
18
+ });
19
+
20
+ bot.loadPlugin(pathfinder);
21
+
22
+ // --- Yardımcı fonksiyonlar ---
23
+ function stripColorCodes(s) {
24
+ if (!s || typeof s !== "string") return s;
25
+ return s.replace(/§[0-9a-fk-or]/gi, "");
26
+ }
27
+
28
+ function getEntityReadableName(e) {
29
+ if (!e) return "";
30
+ try {
31
+ if (e.displayName && typeof e.displayName.toString === "function") {
32
+ const d = e.displayName.toString();
33
+ if (d) return stripColorCodes(d);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  }
35
+ } catch (err) {}
36
+ if (e.name && typeof e.name === "string") return stripColorCodes(e.name);
37
+ if (e.username && typeof e.username === "string") return stripColorCodes(e.username);
38
+ return "";
39
+ }
40
+
41
+ function normalizeForMatch(s) {
42
+ if (!s || typeof s !== "string") return "";
43
+ let t = stripColorCodes(s);
44
+ t = t.normalize ? t.normalize('NFKD').replace(/[\u0300-\u036f]/g, '') : t;
45
+ return t.toLowerCase();
46
+ }
47
+
48
+ function isBesleyiciName(name) {
49
+ if (!name) return false;
50
+ const norm = normalizeForMatch(name);
51
+ // Hem düz "besleyici" hem özel unicode varyasyonlarını yakalamak için
52
+ return norm.includes("besleyici") || norm.includes("ʙᴇsʟᴇʏiᴄi");
53
+ }
54
+
55
+ function safeActivateEntity(entity) {
56
+ try {
57
+ if (!entity) return false;
58
+ if (typeof bot.activateEntityAt === "function") {
59
+ bot.activateEntityAt(entity, entity.position);
60
+ return true;
61
+ }
62
+ if (typeof bot.activateEntity === "function") {
63
+ bot.activateEntity(entity);
64
+ return true;
65
+ }
66
+ logger.warn("activateEntityAt/activateEntity fonksiyonu bulunamadı.");
67
+ return false;
68
+ } catch (err) {
69
+ logger.error("Entity aktive edilirken hata: " + (err && err.message ? err.message : err));
70
+ return false;
71
+ }
72
+ }
73
+
74
+ // Tek seferlik snapshot ve aynı anda besleyici arama/aktive etme
75
+ function triggerHomeSnapshotOnce() {
76
+ setTimeout(() => {
77
+ try {
78
+ console.log("/home sonrası entity snapshot (5s):");
79
+ const arr = Object.values(bot.entities);
80
+ if (!arr || arr.length === 0) {
81
+ console.log("No entities found in bot.entities");
82
+ return;
83
+ }
84
+ // Konsola tek seferlik liste
85
+ arr.forEach(e => {
86
+ const raw = getEntityReadableName(e) || "null";
87
+ const pos = e.position ? `${e.position.x.toFixed(2)},${e.position.y.toFixed(2)},${e.position.z.toFixed(2)}` : "null";
88
+ console.log(`id:${e.id} type:${e.type} name:${raw} pos:${pos}`);
89
+ });
90
+
91
+ // Aynı anda "besleyici" araması yap
92
+ const besleyici = arr.find(e => {
93
+ const raw = getEntityReadableName(e);
94
+ return isBesleyiciName(raw);
95
+ });
96
+
97
+ if (besleyici) {
98
+ const readable = getEntityReadableName(besleyici);
99
+ logger.info(`[${config["bot-account"]["username"]}] Besleyici bulundu: ${readable} (id:${besleyici.id}) — aktive ediliyor.`);
100
+ safeActivateEntity(besleyici);
101
+ } else {
102
+ logger.info(`[${config["bot-account"]["username"]}] /home sonrası tarama: besleyici minyon bulunamadı.`);
103
+ }
104
+ } catch (err) {
105
+ console.error("triggerHomeSnapshotOnce hata:", err);
106
+ }
107
+ }, 5000); // 5 saniye sonra tek seferlik
108
+ }
109
 
110
+ bot.once("spawn", async () => {
111
+ const defaultMove = new Movements(bot);
112
+ bot.pathfinder.setMovements(defaultMove);
113
+ bot.settings.colorsEnabled = false;
114
+ logger.info("Bot sunucuya giriş yaptı.");
115
 
116
+ if (config.utils["auto-auth"].enabled) {
117
+ let password = config.utils["auto-auth"].password;
118
+ setTimeout(() => {
119
+ bot.chat(`/login ${password}`);
120
+ logger.info(`[${config["bot-account"]["username"]}] Login komutu kullanıldı.`);
121
+ }, 500);
122
+
123
+ setTimeout(async () => {
124
+ bot.chat(`/skyblock`);
125
+ logger.info(`[${config["bot-account"]["username"]}] Skyblock'a ışınlanma komutu kullanıldı.`);
126
+ }, 5000);
127
+
128
+ setTimeout(async () => {
129
+ bot.chat(`/home`);
130
+ logger.info(`[${config["bot-account"]["username"]}] Home konumuna ışınlanma komutu kullanıldı.`);
131
+ // /home sonrası sadece bir kere snapshot al
132
+ triggerHomeSnapshotOnce();
133
+ }, 10000);
134
+
135
+ // Orijinal periyodik JSON.stringify kontrolünü kaldırdım (spam oluyordu).
136
+ // İstersen buraya güvenli, periyodik bir kontrol ekleyebilirim.
137
+ }
138
+
139
+ if (config.utils["chat-messages"].enabled) {
140
+ logger.info("Started chat-messages module");
141
+
142
+ let messages = config.utils["chat-messages"]["messages"];
143
+
144
+ if (config.utils["chat-messages"].repeat) {
145
+ let delay = config.utils["chat-messages"]["repeat-delay"];
146
+ let i = 0;
147
+
148
+ setInterval(() => {
149
+ bot.chat(`${messages[i]}`);
150
+
151
+ if (i + 1 === messages.length) {
152
+ i = 0;
153
+ } else i++;
154
+ }, delay * 1000);
155
+ } else {
156
+ messages.forEach((msg) => {
157
+ bot.chat(msg);
158
+ });
159
+ }
160
+ }
161
 
162
+ const pos = config.position;
 
 
163
 
164
+ if (config.position.enabled) {
165
+ logger.info(
166
+ `Starting moving to target location (${pos.x}, ${pos.y}, ${pos.z})`,
167
+ );
168
+ bot.pathfinder.setGoal(new GoalBlock(pos.x, pos.y, pos.z));
169
+ }
170
 
171
+ if (config.utils["anti-afk"].enabled) {
172
+ if (config.utils["anti-afk"].sneak) {
173
+ bot.setControlState("sneak", true);
 
 
 
 
 
 
174
  }
175
 
176
+ if (config.utils["anti-afk"].jump) {
177
+ bot.setControlState("jump", true);
 
 
 
 
 
178
  }
179
 
180
+ if (config.utils["anti-afk"]["hit"].enabled) {
181
+ let delay = config.utils["anti-afk"]["hit"]["delay"];
182
+ let attackMobs = config.utils["anti-afk"]["hit"]["attack-mobs"];
183
+
184
+ setInterval(() => {
185
+ if (attackMobs) {
186
+ let entity = bot.nearestEntity(
187
+ (e) =>
188
+ e.type !== "object" &&
189
+ e.type !== "player" &&
190
+ e.type !== "global" &&
191
+ e.type !== "orb" &&
192
+ e.type !== "other",
193
+ );
194
+
195
+ if (entity) {
196
+ bot.attack(entity);
197
+ return;
198
+ }
199
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
 
201
+ bot.swingArm("right", true);
202
+ }, delay);
 
203
  }
 
204
 
205
+ if (config.utils["anti-afk"].rotate) {
206
+ setInterval(() => {
207
+ bot.look(bot.entity.yaw + 1, bot.entity.pitch, true);
208
+ }, 100);
209
  }
 
210
 
211
+ if (config.utils["anti-afk"]["circle-walk"].enabled) {
212
+ let radius = config.utils["anti-afk"]["circle-walk"]["radius"];
213
+ setInterval(() => {
214
+ circleWalk(bot, radius);
215
+ }, 30000);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
  }
217
+ }
218
+ });
219
+
220
+ bot.on('windowOpen', function (window) {
221
+ if (window.title && window.title.includes("ʙᴇsʟᴇʏiᴄi ᴍiɴʏᴏɴ ᴘᴀɴᴇʟi")) {
222
+ // Besleyici minyon paneli
223
+ if (window.slots.filter(xx => xx?.name && xx?.name == "cooked_beef").length > 0) {
224
+ var minyoncani = Number((JSON.parse(window.slots.filter(xx => xx?.name && xx?.name == "cooked_beef")[0]?.nbt?.value?.display?.value?.Lore?.value?.value[1])?.extra[0].text).split("/")[0]);
225
+ if (minyoncani <= 2) {
226
+ bot.clickWindow(36, 0, 0);
227
+ logger.info(`[${config["bot-account"]["username"]}] Minyon canı ${minyoncani} olduğu için besleyici minyon beslendi.`);
228
+ bot.closeWindow(window);
229
+ } else {
230
+ bot.closeWindow(window);
231
+ }
232
+ } else {
233
+ bot.closeWindow(window);
234
+ }
235
+ } else {
236
+ bot.closeWindow(window);
237
+ }
238
+ });
239
+
240
+ bot.on("chat", (username, message) => {
241
+ if (config.utils["chat-log"]) {
242
+ logger.info(`<${username}> ${message}`);
243
+ }
244
+ });
245
+
246
+ bot.on("goal_reached", () => {
247
+ if (config.position.enabled) {
248
+ logger.info(`Bot arrived to target location. ${bot.entity.position}`);
249
+ }
250
+ });
251
+
252
+ bot.on("death", () => {
253
+ logger.warn(
254
+ `Bot has been died and was respawned at ${bot.entity.position}`,
255
+ );
256
+ });
257
+
258
+ if (config.utils["auto-reconnect"]) {
259
+ bot.on("end", () => {
260
+ setTimeout(() => {
261
+ createBot();
262
+ }, config.utils["auto-reconnect-delay"]);
263
+ });
264
+ }
265
+
266
+ bot.on("kicked", (reason) => {
267
+ let reasonText = "";
268
+ try {
269
+ const parsed = JSON.parse(reason);
270
+ reasonText = parsed.text || parsed.extra?.[0]?.text || "";
271
+ reasonText = reasonText?.replace(/§./g, "");
272
+ logger.warn(`Bot sunucudan atıldı.Sebep: ${reasonText}`);
273
+ } catch {
274
+ logger.warn(`Bot sunucudan atıldı.Sebep: Bulunamadı.`);
275
+ }
276
+
277
+ });
278
+
279
+ bot.on("error", (err) => logger.error(`${err.message}`));
280
  }
281
 
282
 
283
  function circleWalk(bot, radius) {
284
+ // Make bot walk in square with center in bot's wthout stopping
285
+ return new Promise(() => {
286
+ const pos = bot.entity.position;
287
+ const x = pos.x;
288
+ const y = pos.y;
289
+ const z = pos.z;
290
+
291
+ const points = [
292
+ [x + radius, y, z],
293
+ [x, y, z + radius],
294
+ [x - radius, y, z],
295
+ [x, y, z - radius],
296
+ ];
297
+
298
+ let i = 0;
299
+ setTimeout(() => {
300
+ if (i === points.length) i = 0;
301
+ const defaultMove = new Movements(bot);
302
+ bot.pathfinder.setMovements(defaultMove);
303
+ bot.pathfinder.setGoal(new GoalXZ(points[i][0], points[i][2]));
304
+ i++;
305
+ }, 1000);
306
+ });
307
  }
308
 
309
  createBot();
 
315
  app.get("/", (req, res) => res.send("Pinglendi")); //değiştirebilirsiniz.
316
 
317
  app.listen(
318
+ port,
319
+ () =>
320
+ console.log(`Bot bu adres üzerinde çalışıyor: http://localhost:${port}`), //port
321
  );
322
 
323
  process.on('uncaughtException', function (err) {
324
+ console.error("Hata aldım!");
325
+ console.log(err)
326
+ });