aboutsummaryrefslogtreecommitdiff
path: root/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'index.js')
-rw-r--r--index.js44
1 files changed, 22 insertions, 22 deletions
diff --git a/index.js b/index.js
index cf1e65f..733c338 100644
--- a/index.js
+++ b/index.js
@@ -1,7 +1,7 @@
-const ServerPort = 8888;
+const ServerPort = 8448;
const AllowMods = false;
-const _version = "0.1";
+const _version = "0.2";
const Net = require('net');
const clients = {};
@@ -67,7 +67,7 @@ server.on('connection', (socket) => {
console.log("New connection " + socket.connectionId)
if (clients.length > 280) {
- throw new KartikError("Server is full", "net.minteckprojects.kartik.KartikServer.IdentifierAllocationException");
+ throw new KartikError("Server is full", "lt.ro.minteck.cutefox.kartik.KartikServer.IdentifierAllocationException");
}
socket.write(JSON.stringify(
@@ -83,7 +83,7 @@ server.on('connection', (socket) => {
setTimeout(() => {
try {
if (socket.linkedTo === null) {
- throw new KartikError("Not linked within 3 minutes", "net.minteckprojects.kartik.KartikServer.ClientConnectTimeoutException");
+ throw new KartikError("Not linked within 3 minutes", "lt.ro.minteck.cutefox.kartik.KartikServer.ClientConnectTimeoutException");
}
} catch (e) {
console.error(e);
@@ -122,17 +122,17 @@ server.on('connection', (socket) => {
if (data.length > 1200) {
console.dir(data);
- throw new KartikError("Received data is too long", "net.minteckprojects.kartik.KartikServer.DataLengthException");
+ throw new KartikError("Received data is too long", "lt.ro.minteck.cutefox.kartik.KartikServer.DataLengthException");
}
if (typeof info['_type'] != "string") {
- throw new KartikError("Invalid JSON data", "net.minteckprojects.kartik.KartikServer.JsonDataException");
+ throw new KartikError("Invalid JSON data", "lt.ro.minteck.cutefox.kartik.KartikServer.JsonDataException");
}
if (!socket.initialized) {
switch (info['_type']) {
case "init":
if (info['name'] !== "Kartik Core") {
- throw new KartikError("Invalid client", "net.minteckprojects.kartik.KartikServer.AuthenticationException");
+ throw new KartikError("Invalid client", "lt.ro.minteck.cutefox.kartik.KartikServer.AuthenticationException");
}
if (!info.modded) {
console.log("Connection initialized. Client running " + info.name + " version " + info.version + ", official client");
@@ -146,18 +146,18 @@ server.on('connection', (socket) => {
socket.initialized = true;
break;
default:
- throw new KartikError("Trying to receive data but client not initialized", "net.minteckprojects.kartik.KartikServer.AuthenticationException");
+ throw new KartikError("Trying to receive data but client not initialized", "lt.ro.minteck.cutefox.kartik.KartikServer.AuthenticationException");
}
} else {
switch (info['_type']) {
case "init":
- throw new KartikError("Trying to initialize client but client is already initialized", "net.minteckprojects.kartik.KartikServer.AuthenticationException");
+ throw new KartikError("Trying to initialize client but client is already initialized", "lt.ro.minteck.cutefox.kartik.KartikServer.AuthenticationException");
case "link":
if (typeof info['client'] !== "string" || isNaN(parseInt(info['client'], 16))) {
- throw new KartikError("Invalid client link ID", "net.minteckprojects.kartik.KartikServer.GuestIdentifierException");
+ throw new KartikError("Invalid client link ID", "lt.ro.minteck.cutefox.kartik.KartikServer.GuestIdentifierException");
}
if (typeof clients[info['client']] === "undefined") {
- throw new KartikError("Guest client not found", "net.minteckprojects.kartik.KartikServer.GuestConnectException");
+ throw new KartikError("Guest client not found", "lt.ro.minteck.cutefox.kartik.KartikServer.GuestConnectException");
}
if (clients[info['client']].linkedTo === null) {
socket.linkedTo = clients[info['client']];
@@ -186,12 +186,12 @@ server.on('connection', (socket) => {
))
console.log("Link created: (H) " + socket.connectionId + " <-> " + socket.linkedTo.connectionId + " (G)")
} else {
- throw new KartikError("Client already linked to another client", "net.minteckprojects.kartik.KartikServer.GuestAllocationException")
+ throw new KartikError("Client already linked to another client", "lt.ro.minteck.cutefox.kartik.KartikServer.GuestAllocationException")
}
break;
default:
if (socket.linkedTo === null) {
- throw new KartikError("Client not linked to another client", "net.minteckprojects.kartik.KartikServer.DataRoutingException");
+ throw new KartikError("Client not linked to another client", "lt.ro.minteck.cutefox.kartik.KartikServer.DataRoutingException");
} else {
socket.linkedTo.write(JSON.stringify(info));
}
@@ -231,17 +231,17 @@ server.on('connection', (socket) => {
if (data.length > 1200) {
console.dir(data);
- throw new KartikError("Received data is too long", "net.minteckprojects.kartik.KartikServer.DataLengthException");
+ throw new KartikError("Received data is too long", "lt.ro.minteck.cutefox.kartik.KartikServer.DataLengthException");
}
if (typeof info['_type'] != "string") {
- throw new KartikError("Invalid JSON data", "net.minteckprojects.kartik.KartikServer.JsonDataException");
+ throw new KartikError("Invalid JSON data", "lt.ro.minteck.cutefox.kartik.KartikServer.JsonDataException");
}
if (!socket.initialized) {
switch (info['_type']) {
case "init":
if (info['name'] !== "Kartik Core") {
- throw new KartikError("Invalid client", "net.minteckprojects.kartik.KartikServer.AuthenticationException");
+ throw new KartikError("Invalid client", "lt.ro.minteck.cutefox.kartik.KartikServer.AuthenticationException");
}
if (!info.modded) {
console.log("Connection initialized. Client running " + info.name + " version " + info.version + ", official client");
@@ -255,12 +255,12 @@ server.on('connection', (socket) => {
socket.initialized = true;
break;
default:
- throw new KartikError("Trying to receive data but client not initialized", "net.minteckprojects.kartik.KartikServer.AuthenticationException");
+ throw new KartikError("Trying to receive data but client not initialized", "lt.ro.minteck.cutefox.kartik.KartikServer.AuthenticationException");
}
} else {
switch (info['_type']) {
case "init":
- throw new KartikError("Trying to initialize client but client is already initialized", "net.minteckprojects.kartik.KartikServer.AuthenticationException");
+ throw new KartikError("Trying to initialize client but client is already initialized", "lt.ro.minteck.cutefox.kartik.KartikServer.AuthenticationException");
case "ping":
socket.write(JSON.stringify(
{
@@ -270,10 +270,10 @@ server.on('connection', (socket) => {
break;
case "link":
if (typeof info['client'] !== "string" || isNaN(parseInt(info['client'], 36))) {
- throw new KartikError("Invalid client link ID", "net.minteckprojects.kartik.KartikServer.GuestIdentifierException");
+ throw new KartikError("Invalid client link ID", "lt.ro.minteck.cutefox.kartik.KartikServer.GuestIdentifierException");
}
if (typeof clients[info['client']] === "undefined") {
- throw new KartikError("Guest client not found", "net.minteckprojects.kartik.KartikServer.GuestConnectException");
+ throw new KartikError("Guest client not found", "lt.ro.minteck.cutefox.kartik.KartikServer.GuestConnectException");
}
if (clients[info['client']].linkedTo === null) {
socket.linkedTo = clients[info['client']];
@@ -302,12 +302,12 @@ server.on('connection', (socket) => {
) + "\n")
console.log("Link created: (H) " + socket.connectionId + " <-> " + socket.linkedTo.connectionId + " (G)")
} else {
- throw new KartikError("Client already linked to another client", "net.minteckprojects.kartik.KartikServer.GuestAllocationException")
+ throw new KartikError("Client already linked to another client", "lt.ro.minteck.cutefox.kartik.KartikServer.GuestAllocationException")
}
break;
default:
if (socket.linkedTo === null) {
- throw new KartikError("Client not linked to another client", "net.minteckprojects.kartik.KartikServer.DataRoutingException");
+ throw new KartikError("Client not linked to another client", "lt.ro.minteck.cutefox.kartik.KartikServer.DataRoutingException");
} else {
socket.linkedTo.write(JSON.stringify(info).replaceAll("<", "-").replaceAll(">", "-") + "\n");
}