NOTE: This repository is no longer maintained, development has moved to PGMDev/PGM.
ProjectAres is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
A copy of the GNU Affero General Public License is included in the file LICENSE.txt, and can also be found at https://www.gnu.org/licenses/agpl-3.0.en.html
The AGPL license is quite restrictive, please make sure you understand it. If you run a modified version of this software as a network service, anyone who can use that service must also have access to the modified source code.
These plugins were converted from an internal project to open source in a rush, so they are not yet well adapted for third party use. Improving this adaptation is a top development priority, specifically:
- Eliminating dependencies on external plugins (e.g. raven-minecraft)
- Allowing network features to be fully disabled
- Expanding standalone functionality
- Map author username lookup through Mojang API
- Documentation for third-parties (e.g. "how do I run this thing??")
You may find some help on the PGM Discord, in these channels:
#help Help with running a ProjectAres server
#contributing Discussion about contributing to ProjectAres
Please keep in mind that this help is provided by volunteers and other users, out of the kindness of their golden hearts, and not as an obligation to you.
To build everything, just run
mvn clean package.
This should download all dependencies from our repository and create several .jar files in the
target directories of each module.
If the build fails, please report it in Discord.
You can also download builds from our Jenkins server.
Appropriate SportBukkit settings are provided in
bukkit.yml.sample in this folder.
Of particular interest are these:
settings.bungeecord: trueThis is required in order to connect through Bungee
settings.legacy-knockback: trueEmulate knockback mechanics from older versions of Minecraft
settings.water-pushes-tnt: falseDisable water pushing TNT, a newer Minecraft feature that we don't use.
On any PGM or Lobby server, these external plugins can/must be loaded:
As well as these plugins from this repo:
- api-bukkit (built at
- commons-bukkit (built at
For a PGM server, you also need:
- PGM (built at
For tournament support on PGM, you also need:
- Tourney (built at
And for a Lobby server, you just need:
- Lobby (built at
For a Bungee proxy, you just need these two:
- api-bungee (built at
- commons-bungee (built at
UtilUtility code library (not a plugin) used by everything
coreUtils independent of Bukkit or Bungee
apiData models and services, not related to Minecraft
minecraftCode specific to Minecraft, including standalone service implementations
ocnHybrid plugin implementing OCN's HTTP and AMQP services
CommonsFunctionality common to all servers e.g. friends, nicknames, etc.
coreCode that is common to Bukkit and Bungee plugins
PGMPrimary Bukkit plugin on match servers
LobbyMain Bukkit plugin on lobby servers
TourneyBukkit plugin that extends PGM with tournament-related functionality
Direct dependencies between the Bukkit plugins:
The API plugin is used by all the other plugins to interact with the data model. It is split into interface and implementation layers, allowing different backends to be used. There is a built-in default backend that implements minimal functionality for running a standalone server. The api-ocn plugin is the backend implementation for the former Overcast Network.
- Use your judgment always. Any rule can be broken with a good reason. Don't follow a rule without understanding its purpose.
- Write code for readability above all else. Always think about how another developer would work with your code.
- Avoid repetitive code. Factor out the repetition, if there is a reasonable way to do so.
- We have a lot of legacy code lying around. Be careful not to build on obsolete systems or use outdated conventions.
- For basic things like tab size and bracket placement, just match the existing code.
- Use whatever layout you feel makes the code most readable, even if that differs from case to case.
- You can use concise formats in places where it helps readability (e.g. single-line getters).
- Try to write code that is obvious enough so that it doesn't need to be explained with comments.
- In places where a reader might be confused or miss something important, use comments to fill them in.
- Don't put redundant or obvious things in comments or javadocs.
- Ensure your IDE is not inserting any generated comments.
- Strongly prefer
null, generally speaking.
- Use empty collections as nil values for collections.
@Nullablewherever nulls are allowed. Place it before the type, if possible.
- Don't use
@Nonnull. Assume anything (in our own code) without
@Nullableis never null.
checkNotNullon constructor arguments for manually created objects. Don't check
@Injected values, they cannot be null.
- Strongly prefer
- Design classes to do one thing only. If a class provides multiple services, break them down into seperate public interfaces and keep the class private.
finalfields, and create immutable data types, wherever possible.
- Don't create unnecessary getters and setters, only what is actually used.
- No mutable static fields, collections, or any other static state (there are a few exceptions, such as caches and
- Getters don't have to start with
get, but they can if you think it's important.
- We use Guice everywhere. You will need to understand it thoroughly.
- Follow the Guice best practices (especially that one).
- We sometimes use the term "manifest" in place of "module", to avoid confusion with PGM modules.
- We make good use of SportBukkit's built-in Guice support:
- Each plugin has its own private environment in which most of its bindings live.
- Each plugin instance is bound to
org.bukkit.plugin.Plugininside its private module.
- Anything that indirectly depends on
Pluginwill need to be bound in some plugin's private module.
- If other plugins need access to that thing, it needs to be exposed.
- Avoid depending on
Plugindirectly. There are specific bindings for most Bukkit service types (e.g.
Configuration) and several interfaces of our own that wrap small parts of the Bukkit API (e.g.
- If you really need a
Plugin, always inject the base interface, never a specific plugin's class. This makes it easy to move things between plugins.
@Singletonbound in a private environment (e.g. a plugin's private environment) will only be unique within that environment, not the entire process, so be careful not to accidentally duplicate a singleton in multiple private environments.
- Detect errors as early as possible, ideally at server startup. This applies to both user errors and internal assertions.
- Only catch specific exceptions that you are expecting and can handle thoroughly. Don't hide exceptions that other handlers need to know about.
- Avoid catching common exceptions like
IllegalArgumentException, because it's hard to be certain where they come from. If you need to catch them, keep the code inside the
tryblock as small as possible.
- Don't catch all exceptions or try to handle internal errors for no particular reason. We have a nice framework for dealing with unhandled exceptions at the top-level.
- If you need to implement a general exception handler, inject a
tc.oc.commons.core.exception.ExceptionHandlerand pass it the exceptions.
- Ensure that all errors are seen by a human who knows how to fix them:
- Pure user errors only need to be sent to the user who provided the bad input
- Map errors can be sent to builders in-game (and in Sentry too, on production servers) using the
- Any unexpected exception on any server must notify developers somehow i.e. through the
LoggingExceptionHandleror some system logger. You can tell the user about the error so they know what's going on, but don't expect them to deal with it.
- Avoid concurrency. It's hard, and we don't have a general solution for doing it safely.
- A Bukkit server has a single "main thread" where most game logic runs, and multiple background threads for I/O and serialization.
AsyncEvents) and scheduled tasks (except async tasks) run on the main thread.
- Our own plugins use background thread pools for API operations, which use HTTP and AMQP.
- Never block the main thread on API calls, or any other I/O operation. Use
FutureCallbacks to handle API results.
- Don't use the Bukkit API, or any of our own APIs, from a background thread, unless it is explicitly allowed by the API.
SyncExecutorto get back on the main thread from a background thread.
- A Bungee server is entirely multi-threaded. Handlers for a specific event run in sequence, but seperate events and tasks can run concurrently. This is one of the reasons we avoid doing things in Bungee.
- All in-game text must be localized.
- To add a text string to the game, put the english template in one of the
.propertiesfiles in Commons.
- Use a
TranslatableComponentto display the localized message. However, it must pass through the
ComponentRenderContextbefore being sent to the player. That will apply the server-side translations.
- Any changes to the templates must be sent to Crowdin before volunteers can start translating them.
This is done with the Crowdin integration tool by running
crowdin-cli upload sourcesin the Commons folder. This should be done after the new code is deployed to production.
- We use Git, with a typical feature branch workflow
- Trivial changes and emergency fixes can be merged straight to the master branch
- Any significant change requires a PR, and code review by at least one other developer. This applies indiscriminately to all developers. Everyone should have their code reviewed, and anyone can review anyone else's code.
- Once a change has been merged to master, it should be deployed ASAP so that problems can be found. Deploying several old changes at once just makes it harder to trace bugs to their source.
- Without automated tests, we rely heavily on user reports and Sentry alerts to discover regressions. Developers should be around for at least a few hours after their change is deployed, in case something breaks.