Skip to content

PolygonMC is an extended version of the Minestom framework!

License

Notifications You must be signed in to change notification settings

aredblock/PolygonMC

 
 

Repository files navigation

PolygonMC

Your Minecraft 1.21 server software


PolygonMC is an extended version of the Minestom framework! It is intended to implement minor optimizations such as new events, the Addons and other things.


Installation


Maven ➔

<repositories>
    <!-- ... -->
    <repository>
        <id>jitpack</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>
<dependencies>
    <!-- ... -->
    <dependency>
        <groupId>com.github.aredblock</groupId>
        <artifactId>PolygonMC</artifactId>
        <version>VERSION</version>
        <exclusions>
            <exclusion>
                <groupId>org.jboss.shrinkwrap.resolver</groupId>
                <artifactId>shrinkwrap-resolver-depchain</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
</dependencies>

Gradle ➔

repositories {
    // ...
    mavenCentral()
    maven(url = "https://jitpack.io")
}
dependencies {
    //...
    implementation("com.github.aredblock:PolygonMC:VERSION")
}

Note

You can get the latest version here.

If you use the PolygonMC runtime, make sure that your runtime has implemented a current version of the api to be able to execute new addons!

Features



Command system rework ➔

A simple overhaul for a cleaner class structure.

public final class DemoCommandRegistry implements CommandRegistry {

    @RegisterCommand(alias = "demo")
    public void demoCommand(CommandInput input){
        input.getSender().sendMessage("DEMO");
    }

    @RegisterCommand(alias = "helloWorld", aliases = { "hello" })
    public void helloWorld(CommandInput input){
        input.getSender().sendMessage("Hello World!");
    }

}
// ...
MinecraftServer.getCommandManager().registerCommandRegistry(new DemoCommandRegistry());
// ...

> MainDemo.class


Event system rework ➔

A simple overhaul for a cleaner class structure.

public final class DemoEventRegistry implements ListenerRegistry {

    @EventHandler
    //or
    @RegisterListener
    public void playerSpawnEvent(PlayerSpawnEvent event){
        if(event.isFirstSpawn()){
            event.getPlayer().sendMessage("Hello World!");
        }
    }

}
// ...
MinecraftServer.getGlobalEventHandler().registerListenerRegistry(new DemoEventRegistry());
// ...

> MainDemo.class


Addons ➔

The PolygonMC Addon API loads addons into the JVM during runtime and executes them.

public final class DemoAddon implements Addon {

    @Override
    public void onInitialize() {
        MinecraftServer.LOGGER.info("DemoAddon initialized!");

        var addonManager = MinecraftServer.getAddonManager();
        addonManager.getAddonMessageManager().sendMessage("demoaddon", "HelloWorld");
        MinecraftServer.LOGGER.info(addonManager.getAddonMessageManager().popMessage("demoaddon"));
    }

    @Override
    public void onShutdown() {
        MinecraftServer.LOGGER.info("DemoAddon shutdown!");
    }
    
}

> DemoAddon.class

{
  "name": "DemoAddon",
  "entrypoint": "de.aredblock.polygonmc.addon.DemoAddon"
}

> addon.json


AddonMessaging ➔

With AddonMessaging it is possible to send simple messages in a Redis-like virtual channel. However, these are only available in the current JVM.

// ...
MinecraftServer.getAddonManager().getAddonMessageManager().sendMessage("demoaddon", "HelloWorld");
MinecraftServer.LOGGER.info(addonManager.getAddonMessageManager().popMessage("demoaddon"));
// ...

> DemoAddon.class


Regions ➔

Regions are a region between two positions. In regions, you can easily check whether a certain position is located within a region.

// ...
var spawnRegion = new Region(new Pos(-10, 30, -10), new Pos(10, 60, 10));

if(spawnRegion.isInRegion(new Pos(0,42,0))){
    //This position is located in this region.
}
// ...

> DemoAddon.class


Instance improvements ➔

This makes it possible to generate/load entire worlds within one line.

// ...
MinecraftServer.getInstanceManager().generateFlat(Block.STONE);
// ...
MinecraftServer.getInstanceManager().generateFromFile(new File("worlds/world"));
// ...

> DemoAddon.class


Schematics ➔

With the Schematic implementation in PolygonMC you can easily load WorldEdit schematics

// ...
var schematic = new Schematic(new File("demo.schem"))
        .updateOption(SchematicOption.AIRPLACEMENT, false);
schematic.paste(player.getInstance(), player.getPosition());
// ...

> DemoAddon.class


FakePlayer ➔

With the FakePlayer you can spawn "NPCs" in your world!

// ...
FakePlayer.builder()
    .skin(player.getSkin())
    .instance(player.getInstance())
    .position(location)
    .build();
// ...

> MainDemo.class


We are working on even more features...


From users for users ❤️