переход на groovy конфигурацию
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
Ядро сервера.
|
||||
|
||||
Пример настройки можно посмотреть в файле `sample-config.xml`.
|
||||
Пример настройки можно посмотреть в файле [`sample-config.groovy`](./sample-config.groovy).
|
||||
|
||||
## Spring beans
|
||||
|
||||
@@ -14,8 +14,10 @@
|
||||
|
||||
**Bean example:**
|
||||
|
||||
```xml
|
||||
<bean class="mc.core.CoreEventListener"/>
|
||||
```groovy
|
||||
beans {
|
||||
coreEventListener(mc.core.CoreEventListener)
|
||||
}
|
||||
```
|
||||
|
||||
#### ConfigFromSpring
|
||||
@@ -31,12 +33,14 @@
|
||||
|
||||
**Bean example:**
|
||||
|
||||
```xml
|
||||
<bean id="config" class="mc.core.embedded.ConfigFromSpring">
|
||||
<property name="descriptionServer" value="MC Core"/>
|
||||
<property name="maxPlayers" value="100"/>
|
||||
<property name="favicon" value="icon.png"/>
|
||||
</bean>
|
||||
```groovy
|
||||
beans {
|
||||
config(mc.core.embedded.ConfigFromSpring) {
|
||||
descriptionServer = 'MC Core - LIMBO'
|
||||
maxPlayers = 1
|
||||
favicon = 'icon.png'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### GameLoop
|
||||
@@ -47,11 +51,13 @@
|
||||
* `gameTimer` - бин, управляющий ходом времени
|
||||
* `percentWarnLowTps` - порог "низкого" значения TPS, в процентах
|
||||
|
||||
```xml
|
||||
<bean id="gameLoop" class="mc.core.GameLoop">
|
||||
<property name="gameTimer" ref="timeProcessor"/>
|
||||
<property name="percentWarnLowTps" value="15"/>
|
||||
</bean>
|
||||
```groovy
|
||||
beans {
|
||||
gameLoop(mc.core.GameLoop) {
|
||||
gameTimer = ref('timeProcessor')
|
||||
percentWarnLowTps = 15
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### SimpleChatProcessor
|
||||
@@ -62,8 +68,10 @@
|
||||
|
||||
**Bean example:**
|
||||
|
||||
```xml
|
||||
<bean id="chatProcessor" class="mc.core.chat.SimpleChatProcessor" />
|
||||
```groovy
|
||||
beans {
|
||||
chatProcessor(mc.core.chat.SimpleChatProcessor)
|
||||
}
|
||||
```
|
||||
|
||||
### Время
|
||||
@@ -79,10 +87,12 @@
|
||||
|
||||
**Bean example:**
|
||||
|
||||
```xml
|
||||
<bean id="idleTime" class="mc.core.time.IdleTime">
|
||||
<property name="gameTime" value="1000"/>
|
||||
</bean>
|
||||
```groovy
|
||||
beans {
|
||||
timeProcessor(mc.core.time.IdleTime) {
|
||||
gameTime = 1000
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### TimePerTick
|
||||
@@ -96,10 +106,12 @@
|
||||
|
||||
**Bean example:**
|
||||
|
||||
```xml
|
||||
<bean id="timePerTick" class="mc.core.time.TimePerTick">
|
||||
<property name="startGameTime" value="1000"/>
|
||||
</bean>
|
||||
```groovy
|
||||
beans {
|
||||
timeProcessor(mc.core.time.TimePerTick) {
|
||||
startGameTime = 1000
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### RealTime
|
||||
@@ -110,6 +122,8 @@
|
||||
|
||||
**Bean example:**
|
||||
|
||||
```xml
|
||||
<bean id="realTime" class="mc.core.time.RealTime"/>
|
||||
```groovy
|
||||
beans {
|
||||
timeProcessor(mc.core.time.RealTime)
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user