@zardoy/flying-squid 0.0.99 → 0.0.101
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/modules/customBlockBreakTime.d.ts +1 -0
- package/dist/lib/modules/customBlockBreakTime.js +2 -1
- package/dist/lib/modules/inventory.js +2 -2
- package/dist/lib/modules/logout.js +8 -1
- package/dist/lib/modules/safeZones.d.ts +2 -0
- package/dist/lib/modules/safeZones.js +4 -2
- package/dist/lib/modules/updatePositions.d.ts +1 -0
- package/package.json +2 -1
|
@@ -32,7 +32,8 @@ function sendBreakTimeConfig(player, serv) {
|
|
|
32
32
|
const config = serv.customPlayersBreakTime[player.uuid];
|
|
33
33
|
const data = {
|
|
34
34
|
customBreakTime: config?.blocks ?? {},
|
|
35
|
-
customBreakTimeToolAllowance: config?.toolNames ?? []
|
|
35
|
+
customBreakTimeToolAllowance: config?.toolNames ?? [],
|
|
36
|
+
...config?.rawConfig
|
|
36
37
|
};
|
|
37
38
|
player._client.writeChannel(CHANNEL_NAME, {
|
|
38
39
|
newConfiguration: JSON.stringify(data)
|
|
@@ -75,7 +75,7 @@ const player = function (player, serv, { version }) {
|
|
|
75
75
|
items: player.inventory.slots.map(item => Item.toNotch(item)),
|
|
76
76
|
carriedItem: { present: false }
|
|
77
77
|
});
|
|
78
|
-
|
|
78
|
+
options.onClose?.(window);
|
|
79
79
|
};
|
|
80
80
|
const listener = ({ windowId }) => {
|
|
81
81
|
if (windowId !== player.windowId)
|
|
@@ -96,6 +96,7 @@ const player = function (player, serv, { version }) {
|
|
|
96
96
|
onWindowClosed();
|
|
97
97
|
};
|
|
98
98
|
window.close = closeWindow;
|
|
99
|
+
player.customWindow = window;
|
|
99
100
|
return window;
|
|
100
101
|
};
|
|
101
102
|
serv.tabComplete.add('inventoryType', () => {
|
|
@@ -122,7 +123,6 @@ const player = function (player, serv, { version }) {
|
|
|
122
123
|
windowSlots: new Array(52).fill(null).map((_, i) => new serv.PrismarineItem(1, 1, 0)),
|
|
123
124
|
resultSlot: new serv.PrismarineItem(serv.mcData.itemsByName.redstone_block.id, 1, 0),
|
|
124
125
|
onSlotClick: (slot, oldItem, newItem, closeWindow) => {
|
|
125
|
-
closeWindow();
|
|
126
126
|
}
|
|
127
127
|
});
|
|
128
128
|
}
|
|
@@ -7,7 +7,14 @@ exports.player = exports.server = void 0;
|
|
|
7
7
|
const once_1 = __importDefault(require("@tootallnate/once"));
|
|
8
8
|
const server = function (serv) {
|
|
9
9
|
serv.quit = async (reason = 'Server closed') => {
|
|
10
|
-
serv.cleanupFunctions.forEach(fn =>
|
|
10
|
+
serv.cleanupFunctions.forEach(fn => {
|
|
11
|
+
try {
|
|
12
|
+
fn?.();
|
|
13
|
+
}
|
|
14
|
+
catch (err) {
|
|
15
|
+
serv.err('[quit] Error in cleanup function: ' + err);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
11
18
|
await Promise.all(serv.players.map((player) => {
|
|
12
19
|
player.kick(reason);
|
|
13
20
|
return (0, once_1.default)(player, 'disconnected');
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Vec3 } from 'vec3';
|
|
2
2
|
export declare const server: (serv: Server) => void;
|
|
3
3
|
export declare const player: (player: Player, serv: Server, { basePositionAntiCheat, positionAntiCheatNotifyPlayer }: Options) => void;
|
|
4
|
+
export declare function isInsideStrict(pos: Vec3, box: AABB): boolean;
|
|
4
5
|
export type AABB = {
|
|
5
6
|
min: Vec3;
|
|
6
7
|
max: Vec3;
|
|
@@ -14,5 +15,6 @@ declare global {
|
|
|
14
15
|
safeZones: AABB[];
|
|
15
16
|
resetSafeZones: () => void;
|
|
16
17
|
addSafeZones: (x1: number, y1: number, z1: number, x2: number, y2: number, z2: number) => void;
|
|
18
|
+
onSafeZoneViolation?: (player: Player) => Vec3 | void;
|
|
17
19
|
}
|
|
18
20
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.player = exports.server = void 0;
|
|
4
|
+
exports.isInsideStrict = isInsideStrict;
|
|
4
5
|
const vec3_1 = require("vec3");
|
|
5
6
|
// Module to make positions safe to move to.
|
|
6
7
|
// If a client sends a position outside by more than threshold, ignore and teleport back inside.
|
|
@@ -123,10 +124,11 @@ const player = (player, serv, { basePositionAntiCheat = false, positionAntiCheat
|
|
|
123
124
|
if (isInsideExpanded(position, zone, THRESHOLD))
|
|
124
125
|
return;
|
|
125
126
|
// Otherwise, clamp back inside from direction of attempted position
|
|
126
|
-
|
|
127
|
+
let corrected = clampToAABBFromDirection(position, zone);
|
|
128
|
+
corrected = serv.onSafeZoneViolation?.(player) ?? corrected;
|
|
127
129
|
// Prevent default cancel handling and perform corrective teleport ourselves
|
|
128
130
|
if (positionAntiCheatNotifyPlayer) {
|
|
129
|
-
player.chat(`[safeZones] Out of bounds. Teleporting to safe position.`);
|
|
131
|
+
player.chat(`[safeZones] Out of bounds ${zone.min.toString()} <-> ${zone.max.toString()}: ${position.toString()} -> ${corrected.toString()}. Teleporting to safe position.`);
|
|
130
132
|
}
|
|
131
133
|
cancel(false);
|
|
132
134
|
player.teleport(corrected);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zardoy/flying-squid",
|
|
3
3
|
"description": "A minecraft server written in TS",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.101",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"bin": "dist/app.js",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"prismarine-chunk": "^1.39.0",
|
|
39
39
|
"prismarine-entity": "^2.5.0",
|
|
40
40
|
"prismarine-item": "^1.17.0",
|
|
41
|
+
"prismarine-block": "^1.22.0",
|
|
41
42
|
"prismarine-nbt": "^2.7.0",
|
|
42
43
|
"prismarine-provider-anvil": "github:zardoy/prismarine-provider-anvil#everything",
|
|
43
44
|
"prismarine-windows": "^2.8.0",
|