SkillAgentSearch skills...

OpenSectors

Powerful and easy to use sector system for Minecraft *OUTDATED*

Install / Use

/learn @SocketByte/OpenSectors
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

OpenSectors version Build Status

This project is outdated!

Please head to MinecraftServerNetwork for the updated and maintained version.

Old documentation

OpenSectors allows you to split your world into different servers using Kryonet and other networking solutions. This plugin splits your world into few pieces and each piece is different server. Everything is properly synchronized so it feels like it is one server. It allows you to have more players playing on one world, because it is actually working on few servers, so nothing will stop you from having 3000+ players on a single world!

It also supports basic authentication systems like checking password during the sector connection. That way people who want to connect using their own software to your server and do something bad to it, can't do it!

This presentation will be quite long, so here you have quick links to everything.

Features

  • Basic time synchronization over all the servers
  • Going through sector border and "teleporting" between sectors
  • Super basic chat system
  • Simple, but powerful API
  • Performance (Kryonet / Kryo instead of Redis)
  • Configuration (with JSON support)
  • Security
  • Advanced logging systems
  • ActionBar support
  • Built-in fast MySQL connection and API (using HikariCP)
  • Possibilities

Upcoming features

  • Create a border (from MC1.8) on each sector
  • More informations in PacketPlayerInfo
  • More default packets to use
  • Multiple center sectors to improve performance (sector channel system)
  • Better time/weather system

How it works / installation?

The project actually contains two projects - linker and system. Both are really important for everything to work.

You put OpenSectorLinker on each of your sectors, and OpenSectorSystem on your BungeeCord (or one of it's forks) server.

Both contain useful configurations, and you should check them!

Remember, you want to unlock port 23904 and 23905 (or other you specify in configuration) because they're used to send data over the sector network.

Do I need redis or something similar?

No! Absolutely not. It's main advantage over it's competitors is - no additional libraries or unconventional databases needed. It's just... plug & play.

You just need a MySQL server which is pretty standard today.

How do I use it with my other plugins?

You need to rewrite them or ask developers to do it for you. There's no way to make this differently. 70% of plugins need to be synchronized over the sector network to work properly.

Fortunatelly, OpenSectors provide super easy API which makes this task much easier for end-user.

You can edit existing plugins to make them work with OpenSectors which will require minimal Java and networking knowledge.

But! I can edit or write plugins which will support OpenSectors for you! You need to contact me directly though.

Configuration

Configuration is pretty simple. The main problem is to provide valid coordinates for your sectors. You can use ready to use configuration below, or create your own. Unfortunatelly, OpenSectors don't provide ANY of location scaling systems or similar currently.

Linker configuration

   server-id: 0
   proxy-address: "127.0.0.1"
   proxy-port-tcp: 23904
   proxy-port-udp: 23905
   proxy-connection-timeout: 5000
   bufferSize: 8192 # Buffer size, increase it to send larger packets
   kryonet-logging: NONE
   auth-password: "CHANGE_THIS_TO_YOUR_PASSWORD___IT_NEEDS_TO_BE_SECURE!"
   # Messages
   sector-welcome-message:
     - ''
     - '  &aWelcome on sector &7%name%&a (id: &7%id%&a)'
     - ''
   sector-break-message: '&cYou can not destroy blocks that close to the sector border!'
   sector-place-message: '&cYou can not build blocks that close to the sector border!'
   sector-ignite-message: '&cYou can not ignite blocks that close to the sector border!'
   sector-bucket-message: '&cYou can not pour out water/lava that close to the sector border!'
   sector-border-close: '&2&lSector border: &f&l%distance%'

System configuration

{
  "password": "CHANGE_THIS_TO_YOUR_PASSWORD___IT_NEEDS_TO_BE_SECURE!",
  "sectors": 5,
  "portTCP": 23904,
  "portUDP": 23905,
  "bufferSize": 8192,
  "bukkitTimeFrequency": 500,
  "bukkitTimeIncremental": 10,
  "border": 3000,
  "defaultChatFormat": "&7{PLAYER}&8: &f{MESSAGE}",
  "sqlController": {
    "host": "localhost",
    "port": 3306,
    "user": "root",
    "password": "",
    "database": "opensectors",
    "useDefaultSql": true
  },
  "serverControllers": [
    {
      "id": 0,
      "offset": 0,
      "port": 25566,
      "name": "center",
      "minX": -250.0,
      "minZ": -250.0,
      "maxX": 250.0,
      "maxZ": 250.0
    },
    {
      "id": 1,
      "offset": 2,
      "port": 25567,
      "name": "n",
      "minX": -250.0,
      "minZ": -2000.0,
      "maxX": 2000.0,
      "maxZ": -250.0
    },
    {
      "id": 2,
      "offset": 3,
      "port": 25568,
      "name": "s",
      "minX": -2000.0,
      "minZ": 250.0,
      "maxX": 250.0,
      "maxZ": 2000.0
    },
    {
      "id": 3,
      "offset": 4,
      "port": 25569,
      "name": "e",
      "minX": 250.0,
      "minZ": -250.0,
      "maxX": 2000.0,
      "maxZ": 2000.0
    },
    {
      "id": 4,
      "offset": 5,
      "port": 25570,
      "name": "w",
      "minX": -2000.0,
      "minZ": -2000.0,
      "maxX": -250.0,
      "maxZ": 250.0
    }
  ]
}

BungeeCord configuration

servers:
  center:
    motd: OpenSectors
    address: localhost:25566
    restricted: false
  n:
    motd: North Sector
    address: localhost:25567
    restricted: false
  s:
    motd: South Sector
    address: localhost:25568
    restricted: false
  w:
    motd: West Sector
    address: localhost:25569
    restricted: false
  e:
    motd: East Sector
    address: localhost:25570
    restricted: false

API

Yes, that's what you wanted, don't ya? :D

API is fairly easy, and with Javadocs/code on github it's even easier. But I will tell you how to do basic things using OpenSectors API system. API will be definitely richer in the future, remember that!

Linker

Add this code to your maven dependencies.

    <repositories>
        <repository>
            <id>socketbyte-repo</id>
            <url>http://repo.socketbyte.pl/repository/nexus-releases</url>
        </repository>
    </repositories>
    
    <dependencies>
        <dependency>
            <groupId>pl.socketbyte</groupId>
            <artifactId>OpenSectorLinker</artifactId>
            <version>1.2</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

And of course Spigot/Bukkit engine too!

System

or this code when you make plugin for system:

    <repositories>
        <repository>
            <id>socketbyte-repo</id>
            <url>http://repo.socketbyte.pl/repository/nexus-releases</url>
        </repository>
    </repositories>
    
    <dependencies>
        <dependency>
            <groupId>pl.socketbyte</groupId>
            <artifactId>OpenSectorSystem</artifactId>
            <version>1.4</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

There is few types of API calls you can make. Firstly, I would want you to know about packet catching and sending. It is very important in the long term. You want to send a lot of packets and data, and catch it!

This part of the API (packet sending/catching) is also working on system side!

You can register your own Packet extended classes easily, and send them over the network (and/or catch them in the listener) It is fairly easy, look;

PacketExtender<PacketExampleTest> packetExtender = SectorAPI.createPacketExtender(PacketExampleTest.class);
packetExtender.setPacketAdapter((connection, packet) ->
        System.out.println("Received PacketExampleTest from the proxy server."));

In order this to work, you need to register this class on system plugin too.

SectorAPI.register(PacketExampleTest.class);

or just create PacketExtender like above.

What is PacketExampleTest? It's a class, which extend Packet class.

public class PacketExampleTest extends Packet {

    private String test;

    public PacketExampleTest() {

    }

    public String getTest() {
        return test;
    }

    public void setTest(String test) {
        this.test = test;
    }

}

Remember, it needs to be absolutely the same on both sides. Congratulations! Now you can send it using:

PacketExampleTest exampleTest = new PacketExampleTest();
exampleTest.setTest("Hello, World!");
SectorAPI.sendTCP(exampleTest);

You can also send UDP packets.

SectorAPI.sendUDP(exampleTest);

You can also register something like pub/sub in Redis. What do I mean? You can register specific channels and send custom payload packet which contain some data. It is less convinient than using PacketExtender but it can be better sometimes.

SectorAPI.registerPayloadChannel("TEST_CHANNEL", (connection, packet) -> {
    System.out.println("Received PacketCustomPayload (TEST_CHANNEL) as a LINKER.");
    System.out.println(packet);
});

You can do the same on the system side. (You don't need to register anything!) Now you can send something, like

PacketCustomPayload customPayload = new PacketCustomPayload();
customPayload.setChannel("TEST_CHANNEL")

Related Skills

View on GitHub
GitHub Stars29
CategoryDevelopment
Updated1mo ago
Forks6

Languages

Java

Security Score

80/100

Audited on Feb 21, 2026

No findings