@zardoy/flying-squid 0.0.76 → 0.0.78
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/index.js
CHANGED
|
@@ -102,14 +102,22 @@ class MCServer extends events_1.EventEmitter {
|
|
|
102
102
|
const oldServer = options.oldServerData;
|
|
103
103
|
server._server = oldServer?._server ?? (0, minecraft_protocol_1.createServer)({
|
|
104
104
|
...options,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
105
|
+
});
|
|
106
|
+
server._server.on('connection', (client) => {
|
|
107
|
+
const loginOld = client['_events'].login_start;
|
|
108
|
+
if (typeof loginOld === 'function') {
|
|
109
|
+
client['_events'].login_start = (packet) => {
|
|
110
|
+
const username = packet.username.toLowerCase();
|
|
111
|
+
const existingPlayer = Object.values(server._server.clients)
|
|
112
|
+
.find(c => c.username?.toLowerCase?.() === username);
|
|
113
|
+
if (existingPlayer) {
|
|
114
|
+
client.end('A player with this username is already connected');
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
loginOld(packet);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
}
|
|
113
121
|
});
|
|
114
122
|
patchServerSocket(server._server['socketServer'], server);
|
|
115
123
|
if (oldServer) {
|
|
@@ -104,6 +104,7 @@ const server = function (serv, { version }) {
|
|
|
104
104
|
});
|
|
105
105
|
serv.commands.add({
|
|
106
106
|
base: 'fill',
|
|
107
|
+
op: true,
|
|
107
108
|
info: 'Fills a region with a specific block',
|
|
108
109
|
usage: '/fill <from> <to> <block>', // todo impl destroy|hollow|keep|outline|replace filter
|
|
109
110
|
parse(string, ctx) {
|
|
@@ -136,6 +137,7 @@ const server = function (serv, { version }) {
|
|
|
136
137
|
serv.commands.add({
|
|
137
138
|
base: 'testforblock',
|
|
138
139
|
info: '',
|
|
140
|
+
op: true,
|
|
139
141
|
usage: '/testforblock',
|
|
140
142
|
tab: ['blockX', 'blockY', 'blockZ', 'block'],
|
|
141
143
|
parse(string, ctx) {
|
|
@@ -49,6 +49,7 @@ const server = function (serv, { version }) {
|
|
|
49
49
|
serv.commands.add({
|
|
50
50
|
base: 'title',
|
|
51
51
|
info: 'show title',
|
|
52
|
+
op: true,
|
|
52
53
|
usage: '/title <targets> (title|subtitle|actionBar) <title>',
|
|
53
54
|
parse(str) {
|
|
54
55
|
const match = str.match(/([A-Za-z0-9]+( [A-Za-z0-9]+)+) ^(title|subtitle|actionBar)$ \{[^}]*\}/i);
|
|
@@ -86,7 +87,7 @@ const server = function (serv, { version }) {
|
|
|
86
87
|
usage: '/ping [number]',
|
|
87
88
|
action(params, ctx) {
|
|
88
89
|
const num = params[0] * 1 + 1;
|
|
89
|
-
let str = '
|
|
90
|
+
let str = 'Pong';
|
|
90
91
|
if (!isNaN(num))
|
|
91
92
|
str += ' [' + num + ']';
|
|
92
93
|
if (ctx.player)
|
|
@@ -122,7 +123,7 @@ const server = function (serv, { version }) {
|
|
|
122
123
|
info: 'to bug report',
|
|
123
124
|
usage: '/bug',
|
|
124
125
|
action() {
|
|
125
|
-
return 'Report bugs or issues here: https://github.com/
|
|
126
|
+
return 'Report bugs or issues here: https://github.com/zardoy/flying-squid/issues';
|
|
126
127
|
}
|
|
127
128
|
});
|
|
128
129
|
serv.commands.add({
|
|
@@ -234,7 +235,7 @@ const server = function (serv, { version }) {
|
|
|
234
235
|
base: 'me',
|
|
235
236
|
info: 'Displays a message about yourself',
|
|
236
237
|
usage: '/me <message>',
|
|
237
|
-
op:
|
|
238
|
+
op: true,
|
|
238
239
|
parse(params) {
|
|
239
240
|
return params || false;
|
|
240
241
|
},
|
|
@@ -109,7 +109,7 @@ const entity = function (entity, serv) {
|
|
|
109
109
|
// of other players
|
|
110
110
|
entity.knownPosition = entity.knownPosition === undefined ? entity.position : entity.knownPosition;
|
|
111
111
|
const diff = position.minus(entity.knownPosition);
|
|
112
|
-
let maxDelta;
|
|
112
|
+
let maxDelta = 0;
|
|
113
113
|
if (serv.supportFeature('fixedPointDelta')) {
|
|
114
114
|
maxDelta = 3;
|
|
115
115
|
}
|