- This will modify the appropriate patches based on your commits.
9. PR your modifications back to this project.
### Method 2 (sometimes easier)
If you are simply editing a more recent commit or your change is small, simply making the change at HEAD and then moving the commit after you have tested it may be easier.
This method has the benefit of being able to compile to test your change without messing with your API HEAD.
1. Make your change while at HEAD
2. Make a temporary commit. You don't need to make a message for this.
- This will modify the appropriate patches based on your commits
6. PR your modifications back to this project.
## PR Policy
We'll accept changes that make sense. You should be able to justify their existence, along with any maintenance costs that come with them. Remember, these changes will affect everyone who runs Paper, not just you and your server.
While we will fix minor formatting issues, you should stick to the guide below when making and submitting changes.
## Formatting
All modifications to non-Purpur files should be marked
- Multi line changes start with `// Purpur start` and end with `// Purpur end`
- You can put a messages with a change if it isn't obvious, like this: `// Purpur start - reason`
- Should generally be about the reason the change was made, what it was before, or what the change is
- Multi-line messages should start with `// Purpur start` and use `/* Multi line message here */` for the message itself
- Single line changes should have `// Purpur` or `// Purpur - reason`
- For example:
```java
entity.getWorld().dontbeStupid(); // Purpur - was beStupid() which is bad
- It is fine to go over 80 lines as long as it doesn't hurt readability
- There are exceptions, especially in Spigot-related files
- When in doubt, use the same style as the surrounding code
## Patch Notes
When submitting patches to Purpur, we may ask you to add notes to the patch header.
While we do not require it for all changes, you should add patch notes when the changes you're making are technical or complex.
It is very likely that your patch will remain long after we've all forgotten about the details of your PR, patch notes will help
us maintain it without having to dig back through GitHub history looking for your PR.
These notes should express the intent of your patch, as well as any pertinent technical details we should keep in mind long-term.
Ultimately, they exist to make it easier for us to maintain the patch across major version changes.
If you add a long message to your commit in the Purpur-Server/API repos, the rebuildPatches command will handle these patch
notes automatically as part of generating the patch file. Otherwise if you're careful they can be added by hand (though you should be careful when doing this, and run it through a patch and rebuild cycle once or twice).
```patch
From 02abc033533f70ef3165a97bfda3f5c2fa58633a Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sun, 15 Oct 2017 00:29:07 +0100
Subject: [PATCH] revert serverside behavior of keepalives
This patch intends to bump up the time that a client has to reply to the
server back to 30 seconds as per pre 1.12.2, which allowed clients
more than enough time to reply potentially allowing them to be less
In an effort to make future updates easier on ourselves, Purpur tries to use obfuscation helpers whenever possible. The purpose of these helpers is to make the code more readable. These helpers should be be made as easy to inline as possible by the JVM whenever possible.
An obfuscation helper to get an obfuscated field may be as simple as something like this:
```java
public final int getStuckArrows() { return this.bY(); } // Purpur - OBFHELPER
While they may not always be done in exactly the same way each time, the general goal is always to improve readability and maintainability, so use your best judgement.
## Configuration files
To use a configurable value in your patch, add a new entry in either ```PurpurConfig``` or ```PurpurWorldConfig```. Use the former if a value must remain the same throughout all worlds, or the latter if it can change between worlds. The latter is preferred whenever possible.
### PurpurConfig example:
```java
public static boolean saveEmptyScoreboardTeams = false;
Notice that the field is always public, but the setter is always private. This is important to the way the configuration generation system works. To access this value, reference it as you would any other static value:
Again, notice that the field is always public, but the setter is always private. To access this value, you'll need an instance of the ```net.minecraft.World``` object: