Archived
0

обновление README

This commit is contained in:
2019-01-30 00:08:07 +03:00
parent 03944e2900
commit 5bf1ac1b84
10 changed files with 249 additions and 29 deletions

35
README.MD Normal file
View File

@@ -0,0 +1,35 @@
# MC-CORE
![version: v0.2](https://img.shields.io/badge/version-v0.2-000.svg?style=flat)
![codename: LIMBO](https://img.shields.io/badge/codename-LIMBO-B00.svg?style=flat)
Модульный **Minecraft** сервер.
## Модули
* **Core** - ядро сервера
* **Proto 1.12.2** - описание протокола версии [1.12.2 (340)](https://wiki.vg/index.php?title=Protocol&oldid=14204)
* **Proto 1.12.2 Netty** - реализация протокола на сетевом движке [Netty.IO](https://netty.io/)
* **H2 Player manager** - хранение данных игроков в [H2 Database](http://www.h2database.com/)
* **Simple world** - реализация простго генератора плоского (flat) мира
* **Anvil loader** - загрузчик "ванильных" (vanilla, ["Anvil"](https://minecraft.gamepedia.com/Anvil_file_format)) карт Minecraft
## Сборка
```
gradle jar
```
Так же можно собрать все необходимые библиотеки в "кучу":
```
gradle copyDep
```
Или сразу развернув сервер где надо:
```
gradle deploy -Ddeploy=path/to/folder -DcreateRunScript=true
```
`createRunScript` - указание этого параметра создаст скрипт-запускатор

5
anvil-loader/README.MD Normal file
View File

@@ -0,0 +1,5 @@
# Anvil loader
Загрузчик "ванильных" (vanilla, ["Anvil"](https://minecraft.gamepedia.com/Anvil_file_format)) карт Minecraft.
Пример настройки можно посмотреть в файле `sample-config.xml`

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<context:annotation-config />
<bean id="spawnLocation" class="mc.core.EntityLocation">
<constructor-arg index="0" type="double" value="8"/>
<constructor-arg index="1" type="double" value="64"/>
<constructor-arg index="2" type="double" value="8"/>
<constructor-arg index="3" type="float" value="0"/>
<constructor-arg index="4" type="float" value="0"/>
</bean>
<!-- В качестве хранилища, используется модуль Simple world -->
<bean id="simpleWorld" class="mc.world.simple.SimpleWorld">
<property name="spawn" ref="spawnLocation"/>
<property name="chunkProvider">
<bean class="mc.world.anvil.AnvilChunkProvider">
<constructor-arg index="0" type="java.lang.String" value="path/to/minecraft/maps/New world"/>
</bean>
</property>
</bean>
</beans>

View File

@@ -1,42 +1,100 @@
# Core # Core
Ядро сервера Ядро сервера.
Пример настройки можно посмотреть в файле `sample-config.xml`.
## Spring beans ## Spring beans
### ConfigFromSpring ### Разное
Implements: `mc.core.Config` #### CoreEventListener
Bean: Стандартный обработчик системных событий.
**Bean example:**
```xml
<bean class="mc.core.CoreEventListener"/>
```
#### ConfigFromSpring
Настройка параметров сервера через конфигурацию "спринга".
Имеются следующие настройки:
* `descriptionServer` - описание сервера (aka "Motd")
* `favicon` - файл с иконкой сервера
* `maxPlayers` - максимальная вместимость сервера
**Implements:** `mc.core.Config`
**Bean example:**
```xml ```xml
<bean id="config" class="mc.core.embedded.ConfigFromSpring"> <bean id="config" class="mc.core.embedded.ConfigFromSpring">
<property name="descriptionServer" value="MC Core"/> <property name="descriptionServer" value="MC Core"/>
<property name="maxPlayers" value="100"/> <property name="maxPlayers" value="100"/>
<property name="faviconBase64" value="icon.png"/> <property name="favicon" value="icon.png"/>
</bean> </bean>
``` ```
### IdleTime #### GameLoop
Implements: `mc.core.time.TimeProcessor` **Bean example:**
Bean: Доступные параметры:
* `gameTimer` - бин, управляющий ходом времени
* `percentWarnLowTps` - порог "низкого" значения TPS, в процентах
```xml
<bean id="gameLoop" class="mc.core.GameLoop">
<property name="gameTimer" ref="timeProcessor"/>
<property name="percentWarnLowTps" value="15"/>
</bean>
```
#### SimpleChatProcessor
Простой обработчик чата.
**Implements:** `mc.core.chat.ChatProcessor`
**Bean example:**
```xml
<bean id="chatProcessor" class="mc.core.chat.SimpleChatProcessor" />
```
### Время
#### IdleTime
Игровое время суток застывает на указанной отметке.
Доступные параметры:
* `gameTime` - отметка времени (long)
**Implements:** `mc.core.time.TimeProcessor`
**Bean example:**
```xml ```xml
<bean id="idleTime" class="mc.core.time.IdleTime"> <bean id="idleTime" class="mc.core.time.IdleTime">
<constructor-arg index="0" type="long" value="1000"/> <property name="gameTime" value="1000"/>
</bean> </bean>
``` ```
в качестве параметра конструктора указывается стартовое время. #### TimePerTick
### TimePerTick Игровое время суток соответствует игровым тикам (20 tps)
Implements: `mc.core.time.TimeProcessor` Доступные параметры:
* `startGameTime` - стартовое время (long)
Bean: **Implements:** `mc.core.time.TimeProcessor`
**Bean example:**
```xml ```xml
<bean id="timePerTick" class="mc.core.time.TimePerTick"> <bean id="timePerTick" class="mc.core.time.TimePerTick">
@@ -44,26 +102,14 @@ Bean:
</bean> </bean>
``` ```
в качестве параметра указывается стартовое время. #### RealTime
### RealTime Игровое время суток соответствует реальному времени
Implements: `mc.core.time.TimeProcessor` **Implements:** `mc.core.time.TimeProcessor`
Bean: **Bean example:**
```xml ```xml
<bean id="realTime" class="mc.core.time.RealTime"/> <bean id="realTime" class="mc.core.time.RealTime"/>
``` ```
### GameLoop
Bean:
```xml
<bean id="gameLoop" class="mc.core.GameLoop">
<property name="gameTimer" ref="timeProcessor"/>
</bean>
```
`gameTimer` - бин, управляющий ходом времени

28
core/sample-config.xml Normal file
View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<context:annotation-config />
<bean id="config" class="mc.core.embedded.ConfigFromSpring">
<property name="descriptionServer" value="MC Core - LIMBO"/>
<property name="maxPlayers" value="1"/>
</bean>
<bean id="timer" class="mc.core.time.IdleTime">
<constructor-arg index="0" type="long" value="1000"/>
</bean>
<bean class="mc.core.CoreEventListener"/>
<bean id="gameLoop" class="mc.core.GameLoop">
<property name="gameTimer" ref="timer"/>
<property name="percentWarnLowTps" value="15"/>
</bean>
<bean id="chatProcessor" class="mc.core.chat.SimpleChatProcessor" />
</beans>

View File

@@ -0,0 +1,5 @@
# H2 Player manager
Хранилище данных игроков на базе [H2 Database](http://www.h2database.com/).
Пример настройки можно посмотреть в файле `sample-config.xml`

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/data/jpa
http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">
<context:annotation-config />
<context:component-scan base-package="mc.core.h2db"/>
<jpa:repositories base-package="mc.core.h2db.repository"/>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.h2.Driver"/>
<property name="url" value="jdbc:h2:mem:test;DB_CLOSE_DELAY=-1"/>
<property name="username" value="sa"/>
<property name="password" value="s3cReT"/>
</bean>
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="persistenceProviderClass" value="org.hibernate.jpa.HibernatePersistenceProvider"/>
<property name="packagesToScan" value="mc.core.h2db.entity"/>
<property name="jpaProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.H2Dialect</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
</beans>

3
proto_1.12.2/README.MD Normal file
View File

@@ -0,0 +1,3 @@
# Protocol 1.12.2
Описание протокола версии [1.12.2 (340)](https://wiki.vg/index.php?title=Protocol&oldid=14204)

View File

@@ -0,0 +1,7 @@
# Protocol 1.12.2: Netty impl.
Реализация протокола на сетевом движке [Netty.IO](https://netty.io/).
Пример настройки можно посмотреть в файле `sample-config.xml`

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<context:annotation-config />
<context:component-scan base-package="mc.core.network.proto_1_12_2.netty" />
<!-- Для логирования сетевых пакетов, можно добавить нижезакомментированный бин -->
<!-- <bean id="pipeline.log" class="io.netty.handler.logging.LoggingHandler" scope="prototype"/> -->
<bean id="pipeline.decoder" class="mc.core.network.proto_1_12_2.netty.PacketDecoder" scope="prototype"/>
<bean id="pipeline.postencoder" class="mc.core.network.proto_1_12_2.netty.PacketPostEncoder" scope="prototype"/>
<bean id="pipeline.encoder" class="mc.core.network.proto_1_12_2.netty.PacketEncoder" scope="prototype"/>
<bean id="pipeline.handler" class="mc.core.network.proto_1_12_2.netty.PacketHandler" scope="prototype"/>
<bean id="server" class="mc.core.network.proto_1_12_2.netty.NettyServer">
<property name="host" value="127.0.0.1"/>
<property name="port" value="25565"/>
<property name="workerGroupCount" value="2"/>
</bean>
</beans>