io.github.spair:byond-message-client

Library to send and receive messages from BYOND.

Лицензия

Лицензия

Категории

Категории

CLI Взаимодействие с пользователем
Группа

Группа

io.github.spair
Идентификатор

Идентификатор

byond-message-client
Последняя версия

Последняя версия

1.3
Дата

Дата

Тип

Тип

jar
Описание

Описание

io.github.spair:byond-message-client
Library to send and receive messages from BYOND.
Ссылка на сайт

Ссылка на сайт

https://spair.github.io/byond-message-client
Система контроля версий

Система контроля версий

https://github.com/SpaiR/byond-message-client/tree/master

Скачать byond-message-client

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/io.github.spair/byond-message-client/ -->
<dependency>
    <groupId>io.github.spair</groupId>
    <artifactId>byond-message-client</artifactId>
    <version>1.3</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.spair/byond-message-client/
implementation 'io.github.spair:byond-message-client:1.3'
// https://jarcasting.com/artifacts/io.github.spair/byond-message-client/
implementation ("io.github.spair:byond-message-client:1.3")
'io.github.spair:byond-message-client:jar:1.3'
<dependency org="io.github.spair" name="byond-message-client" rev="1.3">
  <artifact name="byond-message-client" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.spair', module='byond-message-client', version='1.3')
)
libraryDependencies += "io.github.spair" % "byond-message-client" % "1.3"
[io.github.spair/byond-message-client "1.3"]

Зависимости

provided (1)

Идентификатор библиотеки Тип Версия
org.projectlombok : lombok jar 1.18.2

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12

Модули Проекта

Данный проект не имеет модулей.

Build Status Coverage Status Javadocs License

BYOND Message Client

About

Small library for Java, which provide simple way to send messages and receive responses from BYOND server.

Installation

Maven Central JCenter

Library is deployed and provided with Maven Central and JCenter repositories.

pom.xml:

<dependency>
    <groupId>io.github.spair</groupId>
    <artifactId>byond-message-client</artifactId>
    <version>${last.version}</version>
</dependency>

build.gradle:

compile 'io.github.spair:byond-message-client:${last.version}'

Usage

There are three main classes to use:

  • ByondClient
  • ByondMessage (with ServerAddress class)
  • ByondResponse

Example:

ByondMessage message = new ByondMessage("bagil.game.tgstation13.org", 2337, "ping");
ByondResponse response = new ByondClient().sendMessage(message);

If you print response object you could see something like that:

ByondResponse(response=56.0, responseType=FLOAT_NUMBER)

Response data is an Object class, so manual class cast is needed.

Additional info:

  • On BYOND side message should be handled in World/Topic() method. Look BYOND Ref for more info.
  • If you want just to send message to BYOND and you don't care about response use sendCommand() method instead of sendMessage() or set expected response type in ByondMessage as ResponseType.NONE.
  • To control response type from BYOND set ResponseType.FLOAT_NUMBER or ResponseType.STRING in ByondMessage instance. If actual response type is different exception UnexpectedResponseException will be thrown.

Also there are some exceptions I'll recommend to handle due to significant reasons.

  1. HostUnavailableException It will be thrown if host you try to send message is currently offline. Restart moment, for example.
  2. UnexpectedResponseException Exception will be thrown while two reasons: World/Topic() doesn't return any response on your message; moment between when server already restarted, but World didn't initialized. Little chance, but you can got in this situation.

Read more in JavaDoc.

Версии библиотеки

Версия
1.3
1.2.4
1.2.3
1.2.2
1.2.1
1.2
1.1
1.0