Skip to content

Commit a77fcd5

Browse files
committed
fix: config
1 parent 045c1c8 commit a77fcd5

File tree

4 files changed

+108
-8
lines changed

4 files changed

+108
-8
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
name: connection-bungeecord
2-
version: 1.0-SNAPSHOT
1+
name: simplecloud-connection
2+
version: 0.0.1
33
author: MrManHD
44

55
main: app.simplecloud.plugin.connection.bungeecord.BungeeCordServerConnectionPlugin
Lines changed: 102 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package app.simplecloud.plugin.connection.shared.config
22

33
import org.spongepowered.configurate.objectmapping.ConfigSerializable
4-
54
@ConfigSerializable
65
data class Config(
6+
val version: String = "1",
77
val connections: List<ConnectionConfig> = emptyList(),
88
val networkJoinTargets: TargetsConfig = TargetsConfig(
99
noTargetConnectionFoundMessage = "<color:#dc2626>Couldn't connect you to the network because no target servers are available."
@@ -12,4 +12,104 @@ data class Config(
1212
noTargetConnectionFoundMessage = "<color:#dc2626>You have been disconnected from the network since you have been kicked and no fallback server are available."
1313
),
1414
val commands: List<CommandConfig> = emptyList(),
15-
)
15+
) {
16+
companion object {
17+
fun createDefaultConfig(): Config {
18+
val defaultConnections = listOf(
19+
ConnectionConfig(
20+
name = "lobby",
21+
serverNameMatcher = MatcherConfig(
22+
operation = MatcherOperation.STARTS_WITH,
23+
value = "lobby"
24+
)
25+
),
26+
ConnectionConfig(
27+
name = "hub",
28+
serverNameMatcher = MatcherConfig(
29+
operation = MatcherOperation.STARTS_WITH,
30+
value = "hub"
31+
)
32+
),
33+
ConnectionConfig(
34+
name = "premium-lobby",
35+
serverNameMatcher = MatcherConfig(
36+
operation = MatcherOperation.STARTS_WITH,
37+
value = "premium"
38+
),
39+
rules = listOf(
40+
RulesConfig(
41+
type = RulesConfig.Type.PERMISSION,
42+
name = "simplecloud.connection.premium",
43+
value = "true",
44+
)
45+
)
46+
),
47+
ConnectionConfig(
48+
name = "vip-lobby",
49+
serverNameMatcher = MatcherConfig(
50+
operation = MatcherOperation.STARTS_WITH,
51+
value = "vip"
52+
),
53+
rules = listOf(
54+
RulesConfig(
55+
type = RulesConfig.Type.PERMISSION,
56+
name = "simplecloud.connection.vip",
57+
value = "true",
58+
)
59+
)
60+
),
61+
ConnectionConfig(
62+
name = "silent-lobby",
63+
serverNameMatcher = MatcherConfig(
64+
operation = MatcherOperation.STARTS_WITH,
65+
value = "silent"
66+
),
67+
rules = listOf(
68+
RulesConfig(
69+
type = RulesConfig.Type.PERMISSION,
70+
name = "simplecloud.connection.silent",
71+
value = "true",
72+
)
73+
)
74+
)
75+
)
76+
77+
val defaultTargetConnections = listOf(
78+
TargetConnectionConfig("lobby", 0),
79+
TargetConnectionConfig("hub", 0),
80+
TargetConnectionConfig("premium-lobby", 10),
81+
TargetConnectionConfig("vip-lobby", 20),
82+
TargetConnectionConfig("silent-lobby", 20)
83+
)
84+
85+
val networkJoinTargets = TargetsConfig(
86+
enabled = true,
87+
noTargetConnectionFoundMessage = "<color:#dc2626>Couldn't connect you to the network because\nno target servers are available.",
88+
targetConnections = defaultTargetConnections
89+
)
90+
91+
val fallbackConnectionsConfig = TargetsConfig(
92+
enabled = true,
93+
noTargetConnectionFoundMessage = "<color:#dc2626>You have been disconnected from the network\nbecause there are no fallback servers available.",
94+
targetConnections = defaultTargetConnections
95+
)
96+
97+
val defaultCommands = listOf(
98+
CommandConfig(
99+
name = "lobby",
100+
alreadyConnectedMessage = "<color:#dc2626>You are already connected to this lobby!",
101+
noTargetConnectionFound = "<color:#dc2626>Couldn't find a target server!",
102+
targetConnections = defaultTargetConnections,
103+
aliases = listOf("l", "hub", "quit", "leave")
104+
)
105+
)
106+
107+
return Config(
108+
connections = defaultConnections,
109+
networkJoinTargets = networkJoinTargets,
110+
fallbackConnectionsConfig = fallbackConnectionsConfig,
111+
commands = defaultCommands
112+
)
113+
}
114+
}
115+
}

connection-shared/src/main/kotlin/app/simplecloud/plugin/connection/shared/config/ConfigFactory.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ object ConfigFactory {
3232

3333

3434
private fun create(path: Path, loader: YamlConfigurationLoader): Config {
35-
val config = Config()
35+
val config = Config.createDefaultConfig()
3636
if (!Files.exists(path)) {
3737
path.parent?.let { Files.createDirectories(it) }
3838
Files.createFile(path)

connection-velocity/src/main/kotlin/app/simplecloud/plugin/connection/velocity/VelocityServerConnectionPlugin.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ import java.util.logging.Logger
2121
import kotlin.jvm.optionals.getOrNull
2222

2323
@Plugin(
24-
id = "connection-velocity",
25-
name = "connection-velocity",
26-
version = "1.0-SNAPSHOT",
24+
id = "simplecloud-connection",
25+
name = "simplecloud-connection",
26+
version = "0.0.1",
2727
authors = ["Fllip", "hmtill"],
2828
url = "https://github.com/theSimpleCloud/server-connection-plugin"
2929
)

0 commit comments

Comments
 (0)