Drop support for LiteLoader.

Liteloader is obsolete and abandoned. It is not worth the hassle of maintenance.
This commit is contained in:
Daniel Scalzi
2022-02-04 19:17:17 -05:00
parent f70c7b6802
commit 2f143d74a7
9 changed files with 6 additions and 175 deletions

View File

@@ -103,7 +103,7 @@ __*SubCommands*__
#### Generate Server
Generate an new server in the root directory. Options are provided to include forge/liteloader in the generated server.
Generate an new server in the root directory. Options are provided to include forge in the generated server.
`generate server <id> <version> <options>`
@@ -113,9 +113,6 @@ Options:
* OPTIONAL (default: null)
* If not provided forge will not be enabled.
* You can provide either `latest` or `recommended` to use the latest/recommended version of forge.
* `--liteloader <string>` Specify liteloader version.
* OPTIONAL (default: null)
* If not provided liteloader will not be enabled.
>
> Example Usage
@@ -215,8 +212,6 @@ Ex.
* `libraries` All modules of type `Library`
* `forgemods` All modules of type `ForgeMod`.
* This is a directory of toggleable modules. See the note below.
* `litemods` All modules of type `LiteMod`.
* This is a directory of toggleable modules. See the note below.
* `TestServer-1.12.2.png` Server icon file.
#### Toggleable Modules
@@ -315,7 +310,7 @@ In the above example, all files of type `cfg` in the config directory will be un
]
},
{
"appliesTo": ["forgemods", "litemods"],
"appliesTo": ["forgemods"],
"patterns": [
"optionalon/*.jar"
]
@@ -324,7 +319,7 @@ In the above example, all files of type `cfg` in the config directory will be un
}
```
Another example where all `optionalon` forgemods and litemods are untracked. **Untracking mods is NOT recommended. This is an example ONLY.**
Another example where all `optionalon` forgemods are untracked. **Untracking mods is NOT recommended. This is an example ONLY.**
### Note on JSON Schemas

Binary file not shown.

View File

@@ -174,19 +174,13 @@ const generateServerCommand: yargs.CommandModule = {
type: 'string',
default: null
})
.option('liteloader', {
describe: 'LiteLoader version.',
type: 'string',
default: null
})
},
handler: async (argv) => {
argv.root = getRoot()
logger.debug(`Root set to ${argv.root}`)
logger.debug(`Generating server ${argv.id} for Minecraft ${argv.version}.`,
`\n\t Forge version: ${argv.forge}`,
`\n\t└ LiteLoader version: ${argv.liteloader}`)
`\n\t Forge version: ${argv.forge}`)
const minecraftVersion = new MinecraftVersion(argv.version as string)
@@ -204,8 +198,7 @@ const generateServerCommand: yargs.CommandModule = {
argv.id as string,
minecraftVersion,
{
forgeVersion: argv.forge as string,
liteloaderVersion: argv.liteloader as string
forgeVersion: argv.forge as string
}
)

View File

@@ -1,6 +1,5 @@
export enum LibraryType {
FORGE = 'FORGE',
LITELOADER = 'LITELOADER'
FORGE = 'FORGE'
}

View File

@@ -1,10 +0,0 @@
export interface LiteMod {
name: string
version: string
mcversion: string
revision: string
description: string
author?: string
}

View File

@@ -14,7 +14,6 @@ export interface UntrackedFilesOption {
export interface ServerMetaOptions {
forgeVersion?: string
liteloaderVersion?: string
}
export function getDefaultServerMeta(id: string, version: string, options?: ServerMetaOptions): ServerMeta {
@@ -42,13 +41,6 @@ export function getDefaultServerMeta(id: string, version: string, options?: Serv
}
}
if(options?.liteloaderVersion) {
servMeta.meta.description = `${servMeta.meta.description} (Liteloader v${options.liteloaderVersion})`
servMeta.liteloader = {
version: options.liteloaderVersion
}
}
// Add empty untracked files.
servMeta.untrackedFiles = []
@@ -81,16 +73,6 @@ export interface ServerMeta {
version: string
}
/**
* Properties related to liteloader.
*/
liteloader?: {
/**
* The liteloader version.
*/
version: string
}
/**
* A list of option objects defining patterns for untracked files.
*/

View File

@@ -8,9 +8,6 @@ export class LibRepoStructure extends BaseMavenRepo {
public static readonly FORGE_GROUP = 'net.minecraftforge'
public static readonly FORGE_ARTIFACT = 'forge'
public static readonly LITELOADER_GROUP = 'com.mumfrey'
public static readonly LITELOADER_ARTIFACT = 'liteloader'
constructor(
absoluteRoot: string,
relativeRoot: string
@@ -29,11 +26,4 @@ export class LibRepoStructure extends BaseMavenRepo {
version, classifier, 'jar')
}
public getLocalLiteLoader(version: string, classifier?: string): string {
return this.getArtifactByComponents(
LibRepoStructure.LITELOADER_GROUP,
LibRepoStructure.LITELOADER_ARTIFACT,
version, classifier, 'jar')
}
}

View File

@@ -6,7 +6,6 @@ import { VersionSegmentedRegistry } from '../../util/VersionSegmentedRegistry'
import { ServerMeta, getDefaultServerMeta, ServerMetaOptions, UntrackedFilesOption } from '../../model/nebula/servermeta'
import { BaseModelStructure } from './BaseModel.struct'
import { MiscFileStructure } from './module/File.struct'
import { LiteModStructure } from './module/LiteMod.struct'
import { LibraryStructure } from './module/Library.struct'
import { MinecraftVersion } from '../../util/MinecraftVersion'
import { addSchemaToObject, SchemaTypes } from '../../util/SchemaUtil'
@@ -41,7 +40,6 @@ export class ServerStructure extends BaseModelStructure<Server> {
minecraftVersion: MinecraftVersion,
options: {
forgeVersion?: string
liteloaderVersion?: string
}
): Promise<void> {
const effectiveId = `${id}-${minecraftVersion}`
@@ -70,12 +68,6 @@ export class ServerStructure extends BaseModelStructure<Server> {
serverMetaOpts.forgeVersion = options.forgeVersion
}
if (options.liteloaderVersion != null) {
const lms = new LiteModStructure(absoluteServerRoot, relativeServerRoot, this.baseUrl, minecraftVersion, [])
await lms.init()
serverMetaOpts.liteloaderVersion = options.liteloaderVersion
}
const serverMeta: ServerMeta = addSchemaToObject(
getDefaultServerMeta(id, minecraftVersion.toString(), serverMetaOpts),
SchemaTypes.ServerMetaSchema,
@@ -159,13 +151,6 @@ export class ServerStructure extends BaseModelStructure<Server> {
modules.push(...forgeModModules)
}
if(serverMeta.liteloader) {
const liteModStruct = new LiteModStructure(absoluteServerRoot, relativeServerRoot, this.baseUrl, minecraftVersion, untrackedFiles)
const liteModModules = await liteModStruct.getSpecModel()
modules.push(...liteModModules)
}
const libraryStruct = new LibraryStructure(absoluteServerRoot, relativeServerRoot, this.baseUrl, minecraftVersion, untrackedFiles)
const libraryModules = await libraryStruct.getSpecModel()
modules.push(...libraryModules)

View File

@@ -1,103 +0,0 @@
import StreamZip from 'node-stream-zip'
import { Stats } from 'fs-extra'
import { Type } from 'helios-distribution-types'
import { join } from 'path'
import { URL } from 'url'
import { capitalize } from '../../../util/stringutils'
import { LiteMod } from '../../../model/liteloader/litemod'
import { ToggleableModuleStructure } from './ToggleableModule.struct'
import { MinecraftVersion } from '../../../util/MinecraftVersion'
import { LibraryType } from '../../../model/claritas/ClaritasLibraryType'
import { MetadataUtil } from '../../../util/MetadataUtil'
import { UntrackedFilesOption } from '../../../model/nebula/servermeta'
export class LiteModStructure extends ToggleableModuleStructure {
private liteModMetadata: {[property: string]: LiteMod | undefined} = {}
constructor(
absoluteRoot: string,
relativeRoot: string,
baseUrl: string,
minecraftVersion: MinecraftVersion,
untrackedFiles: UntrackedFilesOption[]
) {
super(absoluteRoot, relativeRoot, 'litemods', baseUrl, minecraftVersion, Type.LiteMod, untrackedFiles)
}
public getLoggerName(): string {
return 'LiteModStructure'
}
protected async getModuleId(name: string, path: string): Promise<string> {
const liteModData = await this.getLiteModMetadata(name, path)
return this.generateMavenIdentifier(
MetadataUtil.completeGroupInference(this.getClaritasGroup(path), liteModData.name), liteModData.name, `${liteModData.version}-${liteModData.mcversion}`)
}
protected async getModuleName(name: string, path: string): Promise<string> {
return capitalize((await this.getLiteModMetadata(name, path)).name)
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
protected async getModuleUrl(name: string, path: string, stats: Stats): Promise<string> {
return new URL(join(this.relativeRoot, this.getActiveNamespace(), name), this.baseUrl).toString()
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
protected async getModulePath(name: string, path: string, stats: Stats): Promise<string | null> {
return null
}
protected getClaritasType(): LibraryType {
return LibraryType.LITELOADER
}
private getLiteModMetadata(name: string, path: string): Promise<LiteMod> {
return new Promise((resolve, reject) => {
if (!Object.prototype.hasOwnProperty.call(this.liteModMetadata, name)) {
const zip = new StreamZip({
file: path,
storeEntries: true
})
zip.on('error', err => reject(err))
zip.on('ready', () => {
try {
const res = this.processZip(zip, name)
zip.close()
resolve(res)
return
} catch(err) {
zip.close()
reject(err)
return
}
})
} else {
resolve(this.liteModMetadata[name] as LiteMod)
return
}
})
}
private processZip(zip: StreamZip, name: string): LiteMod {
let raw: Buffer | undefined
try {
raw = zip.entryDataSync('litemod.json')
} catch(err) {
// ignored
}
if (raw) {
this.liteModMetadata[name] = JSON.parse(raw.toString()) as LiteMod
} else {
throw new Error(`Litemod ${name} does not contain litemod.json file.`)
}
return this.liteModMetadata[name] as LiteMod
}
}