mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-11 23:04:52 +09:00
Remove extra whitespace, use more consistent spacing, add missing semicolons, using dangling commas, break up long lines, consistent multiline operator placement, add missing JSDoc strings and so on.
66 lines
1.9 KiB
TypeScript
66 lines
1.9 KiB
TypeScript
import * as lib from "@clusterio/lib";
|
|
import * as messages from "./messages";
|
|
|
|
class ControllerConfigGroup extends lib.PluginConfigGroup { }
|
|
ControllerConfigGroup.defaultAccess = ["controller", "host", "control"];
|
|
ControllerConfigGroup.groupName = "inventory_sync";
|
|
ControllerConfigGroup.define({
|
|
name: "autosave_interval",
|
|
title: "Autosave Interval",
|
|
description: "Interval the player data is autosaved at in seconds.",
|
|
type: "number",
|
|
initial_value: 600, // 10 minutes
|
|
});
|
|
ControllerConfigGroup.define({
|
|
name: "player_lock_timeout",
|
|
title: "Player Lock Timeout",
|
|
description:
|
|
"Time in seconds before the lock on a player inventory expires after an instance stops or is disconnected",
|
|
type: "number",
|
|
initial_value: 60,
|
|
});
|
|
ControllerConfigGroup.finalize();
|
|
|
|
class InstanceConfigGroup extends lib.PluginConfigGroup { }
|
|
InstanceConfigGroup.defaultAccess = ["controller", "host", "control"];
|
|
InstanceConfigGroup.groupName = "inventory_sync";
|
|
InstanceConfigGroup.define({
|
|
name: "rcon_chunk_size",
|
|
title: "Rcon inventory chunk size",
|
|
description: "Divide inventories into multiple chunks before sending with rcon to prevent blocking the pipe",
|
|
type: "number",
|
|
initial_value: 1000,
|
|
});
|
|
InstanceConfigGroup.finalize();
|
|
|
|
lib.definePermission({
|
|
name: "inventory_sync.inventory.view",
|
|
title: "View player inventories",
|
|
description: "View player inventories",
|
|
grantByDefault: true,
|
|
});
|
|
|
|
const info: lib.PluginDeclaration = {
|
|
name: "inventory_sync",
|
|
title: "Inventory sync",
|
|
description: "Synchronizes players inventories between instances",
|
|
|
|
instanceEntrypoint: "dist/plugin/instance",
|
|
InstanceConfigGroup,
|
|
|
|
controllerEntrypoint: "dist/plugin/controller",
|
|
ControllerConfigGroup,
|
|
|
|
messages: [
|
|
messages.AcquireRequest,
|
|
messages.ReleaseRequest,
|
|
messages.UploadRequest,
|
|
messages.DownloadRequest,
|
|
messages.DatabaseStatsRequest,
|
|
],
|
|
webEntrypoint: "./web",
|
|
routes: ["/inventory"],
|
|
};
|
|
|
|
export default info;
|