Skip to content

Commit 39ab753

Browse files
committed
Made naming scheme more consistent 😅
1 parent 0375a72 commit 39ab753

File tree

8 files changed

+34
-34
lines changed

8 files changed

+34
-34
lines changed

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
```TS
1313
import mineflayer from "mineflayer";
14-
import HyFlayer from "@hypixelic/mineflayer"
14+
import { HyFlayer } from "@hypixelic/mineflayer"
1515

1616
const bot = mineflayer.createBot({
1717
host: "hypixel.net",
@@ -22,7 +22,7 @@ const bot = mineflayer.createBot({
2222

2323
bot.loadPlugin(HyFlayer);
2424

25-
bot.on("HYPIXELIC_GUILD_CHAT", (event) => {
25+
bot.on("HYFLAYER_GUILD_CHAT", (event) => {
2626
/*
2727
On every Message sent in the Guild Chat you will now receive an Event Object structured like below:
2828
{

‎src/index.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
} from "./modules/index.js";
1010
import type { Bot } from "../types/index.js";
1111

12-
export default function (bot: Bot, options: any) {
12+
export const HyFlayer = (bot: Bot): void => {
1313
bot.mowojang = new MowojangClient();
1414
bot.hypixel = {
1515
location: {},
@@ -21,4 +21,4 @@ export default function (bot: Bot, options: any) {
2121
parseSkyblockCoopChat(bot);
2222
parseGuildChat(bot);
2323
parseGuildEvents(bot);
24-
}
24+
};

‎src/modules/guild.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const parseGuildChat = (bot: Bot) => {
2020
player = parsedMessage[3];
2121
}
2222

23-
bot.emit("HYPIXELIC_GUILD_CHAT", {
23+
bot.emit("HYFLAYER_GUILD_CHAT", {
2424
UUID: await bot.mowojang.getUUID(player),
2525
username: player as string,
2626
message: msg.toString().slice(msg.toString().indexOf(":") + 2),
@@ -44,7 +44,7 @@ export const parseGuildChat = (bot: Bot) => {
4444
player = parsedMessage[3];
4545
}
4646

47-
bot.emit("HYPIXELIC_GUILD_OFFICER_CHAT", {
47+
bot.emit("HYFLAYER_GUILD_OFFICER_CHAT", {
4848
UUID: await bot.mowojang.getUUID(player),
4949
username: player as string,
5050
message: msg.toString().slice(msg.toString().indexOf(":") + 2),
@@ -57,14 +57,14 @@ export const parseGuildEvents = (bot: Bot) => {
5757
bot.addChatPattern("hypixel_guild_join", /^Guild > [^:]+ joined\.$/);
5858
bot.addChatPattern("hypixel_guild_leave", /^Guild > [^:]+ left\.$/);
5959
bot.on("chat:hypixel_guild_join", async (msg) => {
60-
bot.emit("HYPIXELIC_GUILD_JOIN", {
60+
bot.emit("HYFLAYER_GUILD_JOIN", {
6161
UUID: await bot.mowojang.getUUID(msg.toString().split(" ")[2]),
6262
username: msg.toString().split(" ")[2],
6363
timestamp: Math.floor(Date.now() / 1000),
6464
});
6565
});
6666
bot.on("chat:hypixel_guild_leave", async (msg) => {
67-
bot.emit("HYPIXELIC_GUILD_LEAVE", {
67+
bot.emit("HYFLAYER_GUILD_LEAVE", {
6868
UUID: await bot.mowojang.getUUID(msg.toString().split(" ")[2]),
6969
username: msg.toString().split(" ")[2],
7070
timestamp: Math.floor(Date.now() / 1000),

‎src/modules/location.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const parseLocation = (bot: Bot) => {
1212
map: location?.map ?? null,
1313
lobby: location?.lobbyname ? Number(location.lobbyname.replace(/\D/g, "")) : null,
1414
};
15-
bot.emit("HYPIXELIC_LOCATION", bot.hypixel.location);
15+
bot.emit("HYFLAYER_LOCATION", bot.hypixel.location);
1616
} catch {
1717
console.error("Failed parsing current Hypixel Location");
1818
}

‎src/modules/pm.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const parsePrivateChat = (bot: Bot) => {
1212
player = parsedMessage[2];
1313
}
1414

15-
bot.emit("HYPIXELIC_PRIVATE_CHAT", {
15+
bot.emit("HYFLAYER_PRIVATE_CHAT", {
1616
UUID: await bot.mowojang.getUUID(player),
1717
username: player as string,
1818
message: msg.toString().slice(msg.toString().indexOf(":") + 2),

‎src/modules/skyblock.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const parseSkyblockCoopChat = (bot: Bot) => {
1212
player = parsedMessage[2];
1313
}
1414

15-
bot.emit("HYPIXELIC_SKYBLOCK_COOP_CHAT", {
15+
bot.emit("HYFLAYER_SKYBLOCK_COOP_CHAT", {
1616
UUID: await bot.mowojang.getUUID(player),
1717
username: player as string,
1818
message: msg.toString().slice(msg.toString().indexOf(":") + 2),

‎test/index.js‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import mineflayer from "mineflayer";
2-
import HyFlayer from "../dist/index.js";
2+
import { HyFlayer } from "../dist/index.js";
33

44
const bot = mineflayer.createBot({
55
host: "hypixel.net",
@@ -14,24 +14,24 @@ setTimeout(() => {
1414
bot.chat("/limbo");
1515
}, 3000);
1616

17-
bot.on("HYPIXELIC_LOCATION", (event) => {
18-
console.log("HYPIXELIC_LOCATION » " + JSON.stringify(event));
17+
bot.on("HYFLAYER_LOCATION", (event) => {
18+
console.log("HYFLAYER_LOCATION » " + JSON.stringify(event));
1919
});
20-
bot.on("HYPIXELIC_GUILD_CHAT", (event) => {
21-
console.log("HYPIXELIC_GUILD_CHAT » " + JSON.stringify(event));
20+
bot.on("HYFLAYER_GUILD_CHAT", (event) => {
21+
console.log("HYFLAYER_GUILD_CHAT » " + JSON.stringify(event));
2222
});
23-
bot.on("HYPIXELIC_GUILD_OFFICER_CHAT", (event) => {
24-
console.log("HYPIXELIC_GUILD_OFFICER_CHAT » " + JSON.stringify(event));
23+
bot.on("HYFLAYER_GUILD_OFFICER_CHAT", (event) => {
24+
console.log("HYFLAYER_GUILD_OFFICER_CHAT » " + JSON.stringify(event));
2525
});
26-
bot.on("HYPIXELIC_GUILD_JOIN", (event) => {
27-
console.log("HYPIXELIC_GUILD_JOIN » " + JSON.stringify(event));
26+
bot.on("HYFLAYER_GUILD_JOIN", (event) => {
27+
console.log("HYFLAYER_GUILD_JOIN » " + JSON.stringify(event));
2828
});
29-
bot.on("HYPIXELIC_GUILD_LEAVE", (event) => {
30-
console.log("HYPIXELIC_GUILD_LEAVE » " + JSON.stringify(event));
29+
bot.on("HYFLAYER_GUILD_LEAVE", (event) => {
30+
console.log("HYFLAYER_GUILD_LEAVE » " + JSON.stringify(event));
3131
});
32-
bot.on("HYPIXELIC_SKYBLOCK_COOP_CHAT", (event) => {
33-
console.log("HYPIXELIC_SKYBLOCK_COOP_CHAT » " + JSON.stringify(event));
32+
bot.on("HYFLAYER_SKYBLOCK_COOP_CHAT", (event) => {
33+
console.log("HYFLAYER_SKYBLOCK_COOP_CHAT » " + JSON.stringify(event));
3434
});
35-
bot.on("HYPIXELIC_PRIVATE_CHAT", (event) => {
36-
console.log("HYPIXELIC_PRIVATE_CHAT » " + JSON.stringify(event));
35+
bot.on("HYFLAYER_PRIVATE_CHAT", (event) => {
36+
console.log("HYFLAYER_PRIVATE_CHAT » " + JSON.stringify(event));
3737
});

‎types/index.d.ts‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export interface Bot extends MineflayerBot {
5353
hypixel: any;
5454
on<U extends keyof BotEvents>(event: U, listener: BotEvents[U]): this;
5555
once<U extends keyof BotEvents>(event: U, listener: BotEvents[U]): this;
56-
emit<U extends keyof BotEvents>(event: U, ...args: Parameters<BotEvents[U]>): boolean;
56+
emit<U extends keyof BotEvents>(event: U, ...args: Parameters<BotEvents[U]>): void;
5757
}
5858

5959
export interface BotEvents extends MineflayerBotEvents {
@@ -64,11 +64,11 @@ export interface BotEvents extends MineflayerBotEvents {
6464
"chat:hypixel_guild_leave": (msg: string) => void;
6565
"chat:hypixel_skyblock_coop_chat": (msg: string) => void;
6666
"chat:hypixel_private_chat": (msg: string) => void;
67-
HYPIXELIC_LOCATION: (event: LocationEvent) => void;
68-
HYPIXELIC_GUILD_CHAT: (event: GuildChatEvent) => void;
69-
HYPIXELIC_GUILD_OFFICER_CHAT: (event: GuildOfficerChatEvent) => void;
70-
HYPIXELIC_GUILD_JOIN: (event: GuildJoinEvent) => void;
71-
HYPIXELIC_GUILD_LEAVE: (event: GuildLeaveEvent) => void;
72-
HYPIXELIC_SKYBLOCK_COOP_CHAT: (event: SkyblockCoopChatEvent) => void;
73-
HYPIXELIC_PRIVATE_CHAT: (event: PrivateChatEvent) => void;
67+
HYFLAYER_LOCATION: (event: LocationEvent) => void;
68+
HYFLAYER_GUILD_CHAT: (event: GuildChatEvent) => void;
69+
HYFLAYER_GUILD_OFFICER_CHAT: (event: GuildOfficerChatEvent) => void;
70+
HYFLAYER_GUILD_JOIN: (event: GuildJoinEvent) => void;
71+
HYFLAYER_GUILD_LEAVE: (event: GuildLeaveEvent) => void;
72+
HYFLAYER_SKYBLOCK_COOP_CHAT: (event: SkyblockCoopChatEvent) => void;
73+
HYFLAYER_PRIVATE_CHAT: (event: PrivateChatEvent) => void;
7474
}

0 commit comments

Comments
 (0)