Restructure LiveAtlasServerDefinition
This commit is contained in:
parent
e61d0def04
commit
355c0c71cf
11
src/index.d.ts
vendored
11
src/index.d.ts
vendored
@ -41,13 +41,10 @@ interface LiveAtlasGlobalConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface LiveAtlasServerDefinition {
|
interface LiveAtlasServerDefinition {
|
||||||
id: string
|
id: string;
|
||||||
label?: string
|
label?: string;
|
||||||
}
|
type: 'dynmap'
|
||||||
|
dynmap: DynmapUrlConfig;
|
||||||
interface LiveAtlasDynmapServerDefinition extends LiveAtlasServerDefinition {
|
|
||||||
type: 'dynmap',
|
|
||||||
dynmap: DynmapUrlConfig,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Messages defined directly in LiveAtlas and used for all servers
|
// Messages defined directly in LiveAtlas and used for all servers
|
||||||
|
@ -19,7 +19,6 @@ import {
|
|||||||
LiveAtlasArea,
|
LiveAtlasArea,
|
||||||
LiveAtlasCircle,
|
LiveAtlasCircle,
|
||||||
LiveAtlasDimension,
|
LiveAtlasDimension,
|
||||||
LiveAtlasDynmapServerDefinition,
|
|
||||||
LiveAtlasLine,
|
LiveAtlasLine,
|
||||||
LiveAtlasMarker,
|
LiveAtlasMarker,
|
||||||
LiveAtlasMarkerSet,
|
LiveAtlasMarkerSet,
|
||||||
@ -51,8 +50,8 @@ export default class DynmapMapProvider extends MapProvider {
|
|||||||
private updateTimestamp: Date = new Date();
|
private updateTimestamp: Date = new Date();
|
||||||
private updateInterval: number = 3000;
|
private updateInterval: number = 3000;
|
||||||
|
|
||||||
constructor(config: LiveAtlasDynmapServerDefinition) {
|
constructor(config: LiveAtlasServerDefinition) {
|
||||||
super(config as LiveAtlasServerDefinition);
|
super(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static buildServerConfig(response: any): DynmapServerConfig {
|
private static buildServerConfig(response: any): DynmapServerConfig {
|
||||||
|
@ -34,11 +34,10 @@ import {
|
|||||||
LiveAtlasGlobalConfig,
|
LiveAtlasGlobalConfig,
|
||||||
LiveAtlasGlobalMessageConfig,
|
LiveAtlasGlobalMessageConfig,
|
||||||
LiveAtlasServerMessageConfig,
|
LiveAtlasServerMessageConfig,
|
||||||
LiveAtlasDynmapServerDefinition,
|
|
||||||
LiveAtlasPlayer,
|
LiveAtlasPlayer,
|
||||||
LiveAtlasCircle,
|
LiveAtlasCircle,
|
||||||
LiveAtlasLine,
|
LiveAtlasLine,
|
||||||
LiveAtlasArea, LiveAtlasMarker, LiveAtlasMarkerSet
|
LiveAtlasArea, LiveAtlasMarker, LiveAtlasMarkerSet, LiveAtlasServerDefinition
|
||||||
} from "@/index";
|
} from "@/index";
|
||||||
import DynmapMapProvider from "@/providers/DynmapMapProvider";
|
import DynmapMapProvider from "@/providers/DynmapMapProvider";
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {LiveAtlasDynmapServerDefinition, LiveAtlasGlobalConfig, LiveAtlasServerDefinition} from "@/index";
|
import {LiveAtlasGlobalConfig, LiveAtlasServerDefinition} from "@/index";
|
||||||
import ConfigurationError from "@/errors/ConfigurationError";
|
import ConfigurationError from "@/errors/ConfigurationError";
|
||||||
import {DynmapUrlConfig} from "@/dynmap";
|
import {DynmapUrlConfig} from "@/dynmap";
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ const validateLiveAtlasConfiguration = (config: any): Map<string, LiveAtlasServe
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
const validateDynmapConfiguration = (config: DynmapUrlConfig): Map<string, LiveAtlasDynmapServerDefinition> => {
|
const validateDynmapConfiguration = (config: DynmapUrlConfig): Map<string, LiveAtlasServerDefinition> => {
|
||||||
const check = '\nCheck your standalone/config.js file exists and is being loaded correctly.';
|
const check = '\nCheck your standalone/config.js file exists and is being loaded correctly.';
|
||||||
|
|
||||||
if (!config) {
|
if (!config) {
|
||||||
@ -91,7 +91,7 @@ const validateDynmapConfiguration = (config: DynmapUrlConfig): Map<string, LiveA
|
|||||||
throw new ConfigurationError(`Dynmap sendmessage URL is missing. ${check}`);
|
throw new ConfigurationError(`Dynmap sendmessage URL is missing. ${check}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = new Map<string, LiveAtlasDynmapServerDefinition>();
|
const result = new Map<string, LiveAtlasServerDefinition>();
|
||||||
result.set('dynmap', {
|
result.set('dynmap', {
|
||||||
id: 'dynmap',
|
id: 'dynmap',
|
||||||
label: 'dynmap',
|
label: 'dynmap',
|
||||||
|
Loading…
Reference in New Issue
Block a user