From e5ba93ce9c8aa19cb6f2b15ed923be8227074e6b Mon Sep 17 00:00:00 2001 From: Holly Date: Sun, 9 Apr 2023 04:51:30 +0100 Subject: [PATCH] fix more codefactor issues --- server/generators/Hilly.ts | 1 - server/packets/DisconnectKick.ts | 9 +++++++-- server/packets/IPacket.ts | 2 +- server/packets/KeepAlive.ts | 1 + server/packets/MapChunk.ts | 3 ++- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/server/generators/Hilly.ts b/server/generators/Hilly.ts index 3ed9d53..27570c9 100644 --- a/server/generators/Hilly.ts +++ b/server/generators/Hilly.ts @@ -2,7 +2,6 @@ import { Block } from "../blocks/Block"; import { Chunk } from "../Chunk"; import { IGenerator } from "./IGenerator"; import { Noise2D, makeNoise2D } from "../../external/OpenSimplex2D"; -import shuffle_seed from "../../external/shuffle_seed"; export class HillyGenerator implements IGenerator { private seed:number; diff --git a/server/packets/DisconnectKick.ts b/server/packets/DisconnectKick.ts index 20acd18..3779cf1 100644 --- a/server/packets/DisconnectKick.ts +++ b/server/packets/DisconnectKick.ts @@ -6,11 +6,16 @@ export class PacketDisconnectKick implements IPacket { public packetId = Packets.DisconnectKick; public reason:string; - public constructor(reason:string) { - this.reason = reason; + public constructor(reason?:string) { + if (typeof(reason) === "string") { + this.reason = reason; + } else { + this.reason = ""; + } } public readData(reader:Reader) { + this.reason = reader.readString(); return this; } diff --git a/server/packets/IPacket.ts b/server/packets/IPacket.ts index d64416e..6447e48 100644 --- a/server/packets/IPacket.ts +++ b/server/packets/IPacket.ts @@ -1,4 +1,4 @@ -import { Reader, Writer } from "../../bufferStuff"; +import { Reader } from "../../bufferStuff"; import { Packets } from "../enums/Packets"; export interface IPacket { diff --git a/server/packets/KeepAlive.ts b/server/packets/KeepAlive.ts index 4f04a37..0462d66 100644 --- a/server/packets/KeepAlive.ts +++ b/server/packets/KeepAlive.ts @@ -7,6 +7,7 @@ export class PacketKeepAlive implements IPacket { private static readonly KeepAliveBuffer:Buffer = new Writer(1).writeByte(Packets.KeepAlive).toBuffer(); public readData(reader:Reader) { + reader; return this; } diff --git a/server/packets/MapChunk.ts b/server/packets/MapChunk.ts index 9f482b1..9880ba0 100644 --- a/server/packets/MapChunk.ts +++ b/server/packets/MapChunk.ts @@ -25,7 +25,8 @@ export class PacketMapChunk implements IPacket { } public readData(reader:Reader) { - + // TODO: Implement MapChunk reading + reader.readBool(); return this; }