Compare commits

..

No commits in common. "master" and "patch-tools" have entirely different histories.

19 changed files with 292 additions and 3531 deletions

2
.gitignore vendored
View File

@ -1,4 +1,4 @@
PandaCord-Proxy
Travertine-Proxy
# intellij
*.iml

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "Waterfall"]
path = Waterfall
url = https://github.com/PaperMC/Waterfall.git

View File

@ -1,34 +1,33 @@
Contributing to PandaCord
Contributing to Travertine
==========================
This file explains how to deal with patch based projects, using the provided scripts.
This documentation is based on Waterfalls CONTRIBUTING.md
WaterfallMC has a very lenient policy towards PRs, but would prefer that you try and adhere to the following guidelines.
## Understanding Patches
Patches to PandaCord are very simple, but center around the directory 'PandaCord-Proxy'
Patches to Travertine are very simple, but center around the directory 'Travertine-Proxy'
Assuming you already have forked the repository:
1. Pull the latest changes from the main repository
2. Type `./pandacord p` in git bash to apply the changes from upstream
3. cd into `PandaCord-Proxy` for proxy changes
2. Type `./travertine p` in git bash to apply the changes from upstream
3. cd into `Travertine-Proxy` for proxy changes
This directory is not a git repository in the traditional sense:
- Every single commit in PandaCord-Proxy is a patch.
- 'origin/master' points to a directory similar to PandaCord-Proxy but for PandaCord
- Typing `git status` should show that we are 10 or 11 commits ahead of master, meaning we have 10 or 11 patches that PandaCord, Waterfall, and Bungeecord don't
- If it says something like `212 commits ahead, 207 commits behind`, then type `git fetch` to update PandaCord
- Every single commit in Travertine-Proxy is a patch.
- 'origin/master' points to a directory similar to Travertine-Proxy but for Travertine
- Typing `git status` should show that we are 10 or 11 commits ahead of master, meaning we have 10 or 11 patches that Travertine, Waterfall, and Bungeecord don't
- If it says something like `212 commits ahead, 207 commits behind`, then type `git fetch` to update Travertine
## Adding Patches
Adding patches to PandaCord is very simple:
Adding patches to Travertine is very simple:
1. Modify `PandaCord-Proxy` with the appropriate changes
1. Modify `Travertine-Proxy` with the appropriate changes
2. Type `git add .` to add your changes
3. Run `git commit` with the desired patch message
4. Run `./pandacord rb` in the main directory to convert your commit into a new patch
4. Run `./travertine rb` in the main directory to convert your commit into a new patch
5. PR your patches back to this repository
Your commit will be converted into a patch that you can then PR into PandaCord
Your commit will be converted into a patch that you can then PR into Travertine
## Modifying Patches
Modifying previous patches is a bit more complex:
@ -48,7 +47,7 @@ This method works by temporarily resetting HEAD to the desired commit to edit us
- **MAKE SURE TO ADD `--amend`** or else a new patch will be created.
- You can also modify the commit message here.
7. Type `git rebase --continue` to finish rebasing.
8. Type `./pandacord rb` in the main directory.
8. Type `./travertine rb` in the main directory.
- This will modify the appropriate patches based on your commits.
9. PR your modifications back to this project.
@ -59,6 +58,43 @@ If you are simply editing a more recent commit or your change is small, simply m
2. Make a temporary commit. You don't need to make a message for this.
3. Type `git rebase -i upstream/upstream`, move (cut) your temporary commit and move it under the line of the patch you wish to modify.
4. Change the `pick` with `f` (fixup) or `s` (squash) if you need to edit the commit message
5. Type `./pandacord rb` in the main directory.
5. Type `./travertine rb` in the main directory.
- This will modify the appropriate patches based on your commits.
6. PR your modifications to github
## 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 Travertine, 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-Travertine files should be marked
- Multi line changes start with `// Travertine start` and end with `// Travertine end`
- You can put a messages with a change if it isn't obvious, like this: `// Travertine 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 `// Travertine start` and use `/* Multi line message here */` for the message itself
- Single line changes should have `// Travertine` or `// Travertine - reason`
- For example:
````java
return getConfig().getNotStupid(); // Travertine - was return getConfig().getStupid();
// Travertine start
// con.disconnect( bungee.getTranslation( "lost_connection" ) );
ServerInfo def = con.updateAndGetNextServer( server.getInfo() );
ServerKickEvent event = bungee.getPluginManager().callEvent( new ServerKickEvent( con, server.getInfo(), TextComponent.fromLegacyText( bungee.getTranslation( "lost_connection" ) ), def, ServerKickEvent.State.CONNECTED, ServerKickEvent.Cause.LOST_CONNECTION ) );
if ( event.isCancelled() && event.getCancelServer() != null )
{
server.setObsolete( true );
con.connectNow( event.getCancelServer() );
}
else
{
con.disconnect0( event.getKickReasonComponent() );
}
// Travertine end
````
- We generally follow usual java style, or what is programmed into most IDEs and formatters by default
- This is also known as oracle style
- It is fine to go over 80 lines as long as it doesn't hurt readability
- There are exceptions, especially in Bungeecord-related files
- When in doubt, use the same style as the surrounding code

21
LICENSE.txt Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2015-2019 Waterfall Team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

@ -1 +0,0 @@
Subproject commit 7e6af4cef64d5d377a6ffd00a534379e6efa94cf

View File

@ -1,413 +0,0 @@
From 5bd6939857a7272ad7c338e202a7196010121aa8 Mon Sep 17 00:00:00 2001
From: Marc Baloup <marc.baloup@laposte.net>
Date: Sat, 1 Oct 2016 23:26:27 +0200
Subject: [PATCH] Change projet configuration and POM for Pandacube
diff --git a/api/pom.xml b/api/pom.xml
index 0680a5a5..1d46bfb4 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -4,13 +4,12 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>io.github.waterfallmc</groupId>
+ <groupId>fr.pandacube.pandacord</groupId>
<artifactId>waterfall-parent</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
- <groupId>io.github.waterfallmc</groupId>
<artifactId>waterfall-api</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<packaging>jar</packaging>
@@ -20,25 +19,25 @@
<dependencies>
<dependency>
- <groupId>io.github.waterfallmc</groupId>
+ <groupId>fr.pandacube.pandacord</groupId>
<artifactId>waterfall-chat</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>io.github.waterfallmc</groupId>
+ <groupId>fr.pandacube.pandacord</groupId>
<artifactId>waterfall-config</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>io.github.waterfallmc</groupId>
+ <groupId>fr.pandacube.pandacord</groupId>
<artifactId>waterfall-event</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>io.github.waterfallmc</groupId>
+ <groupId>fr.pandacube.pandacord</groupId>
<artifactId>waterfall-protocol</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
diff --git a/bootstrap/pom.xml b/bootstrap/pom.xml
index 7a9e8258..0efba9cd 100644
--- a/bootstrap/pom.xml
+++ b/bootstrap/pom.xml
@@ -4,13 +4,12 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>io.github.waterfallmc</groupId>
+ <groupId>fr.pandacube.pandacord</groupId>
<artifactId>waterfall-parent</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
- <groupId>io.github.waterfallmc</groupId>
<artifactId>waterfall-bootstrap</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<packaging>jar</packaging>
@@ -29,7 +28,7 @@
<dependencies>
<dependency>
- <groupId>io.github.waterfallmc</groupId>
+ <groupId>fr.pandacube.pandacord</groupId>
<artifactId>waterfall-proxy</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
diff --git a/chat/pom.xml b/chat/pom.xml
index cfa0e16e..dbe64d6d 100644
--- a/chat/pom.xml
+++ b/chat/pom.xml
@@ -4,13 +4,12 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>io.github.waterfallmc</groupId>
+ <groupId>fr.pandacube.pandacord</groupId>
<artifactId>waterfall-parent</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
- <groupId>io.github.waterfallmc</groupId>
<artifactId>waterfall-chat</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<packaging>jar</packaging>
diff --git a/config/pom.xml b/config/pom.xml
index 67e2500f..212c7371 100644
--- a/config/pom.xml
+++ b/config/pom.xml
@@ -4,13 +4,12 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>io.github.waterfallmc</groupId>
+ <groupId>fr.pandacube.pandacord</groupId>
<artifactId>waterfall-parent</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
- <groupId>io.github.waterfallmc</groupId>
<artifactId>waterfall-config</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<packaging>jar</packaging>
diff --git a/event/pom.xml b/event/pom.xml
index 563783e9..4263081e 100644
--- a/event/pom.xml
+++ b/event/pom.xml
@@ -4,13 +4,12 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>io.github.waterfallmc</groupId>
+ <groupId>fr.pandacube.pandacord</groupId>
<artifactId>waterfall-parent</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
- <groupId>io.github.waterfallmc</groupId>
<artifactId>waterfall-event</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<packaging>jar</packaging>
diff --git a/log/pom.xml b/log/pom.xml
index 3663d6d9..f1e8ace8 100644
--- a/log/pom.xml
+++ b/log/pom.xml
@@ -4,13 +4,12 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>io.github.waterfallmc</groupId>
+ <groupId>fr.pandacube.pandacord</groupId>
<artifactId>waterfall-parent</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
- <groupId>io.github.waterfallmc</groupId>
<artifactId>waterfall-log</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<packaging>jar</packaging>
@@ -26,7 +25,7 @@
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>io.github.waterfallmc</groupId>
+ <groupId>fr.pandacube.pandacord</groupId>
<artifactId>waterfall-chat</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
diff --git a/log4j/pom.xml b/log4j/pom.xml
index 7ec6e530..87c200d2 100644
--- a/log4j/pom.xml
+++ b/log4j/pom.xml
@@ -3,13 +3,12 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>io.github.waterfallmc</groupId>
+ <groupId>fr.pandacube.pandacord</groupId>
<artifactId>waterfall-parent</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
- <groupId>io.github.waterfallmc</groupId>
<artifactId>waterfall-log4j</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<packaging>jar</packaging>
diff --git a/native/pom.xml b/native/pom.xml
index 652a869d..2f87f4c2 100644
--- a/native/pom.xml
+++ b/native/pom.xml
@@ -4,13 +4,12 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>io.github.waterfallmc</groupId>
+ <groupId>fr.pandacube.pandacord</groupId>
<artifactId>waterfall-parent</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
- <groupId>io.github.waterfallmc</groupId>
<artifactId>waterfall-native</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<packaging>jar</packaging>
diff --git a/pom.xml b/pom.xml
index 8d86e36c..5b701203 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,14 +3,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>io.github.waterfallmc</groupId>
- <artifactId>waterfall-super</artifactId>
- <version>dev-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <groupId>io.github.waterfallmc</groupId>
+ <groupId>fr.pandacube.pandacord</groupId>
<artifactId>waterfall-parent</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<packaging>pom</packaging>
@@ -129,7 +122,7 @@
<artifactId>scriptus</artifactId>
<version>0.4.1</version>
<configuration>
- <format>git:${project.name}:${project.version}:%s:${build.number}</format>
+ <format>git:PandaCord:${project.version}:%s:${build.number}</format>
</configuration>
<executions>
<execution>
@@ -201,6 +194,62 @@
</configuration>
</plugin>
</plugins>
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse
+ m2e settings only. It has no influence on the Maven build itself. -->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>net.md-5</groupId>
+ <artifactId>scriptus</artifactId>
+ <versionRange>[0.3.1,)</versionRange>
+ <goals>
+ <goal>describe</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <execute>
+ <runOnIncremental>false</runOnIncremental>
+ </execute>
+ </action>
+ </pluginExecution>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <versionRange>[1.0.0,)</versionRange>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore />
+ </action>
+ </pluginExecution>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <versionRange>[3.0.0,)</versionRange>
+ <goals><goal>check</goal></goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore></ignore>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
</build>
<profiles>
diff --git a/protocol/pom.xml b/protocol/pom.xml
index dbc0a3ab..dd16e74e 100644
--- a/protocol/pom.xml
+++ b/protocol/pom.xml
@@ -4,13 +4,12 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>io.github.waterfallmc</groupId>
+ <groupId>fr.pandacube.pandacord</groupId>
<artifactId>waterfall-parent</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
- <groupId>io.github.waterfallmc</groupId>
<artifactId>waterfall-protocol</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<packaging>jar</packaging>
@@ -41,7 +40,7 @@
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>io.github.waterfallmc</groupId>
+ <groupId>fr.pandacube.pandacord</groupId>
<artifactId>waterfall-chat</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
diff --git a/proxy/pom.xml b/proxy/pom.xml
index c3a2eeb6..fe3a2197 100644
--- a/proxy/pom.xml
+++ b/proxy/pom.xml
@@ -4,13 +4,12 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>io.github.waterfallmc</groupId>
+ <groupId>fr.pandacube.pandacord</groupId>
<artifactId>waterfall-parent</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
- <groupId>io.github.waterfallmc</groupId>
<artifactId>waterfall-proxy</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<packaging>jar</packaging>
@@ -64,31 +63,31 @@
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>io.github.waterfallmc</groupId>
+ <groupId>fr.pandacube.pandacord</groupId>
<artifactId>waterfall-api</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>io.github.waterfallmc</groupId>
+ <groupId>fr.pandacube.pandacord</groupId>
<artifactId>waterfall-log4j</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>io.github.waterfallmc</groupId>
+ <groupId>fr.pandacube.pandacord</groupId>
<artifactId>waterfall-native</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>io.github.waterfallmc</groupId>
+ <groupId>fr.pandacube.pandacord</groupId>
<artifactId>waterfall-protocol</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>io.github.waterfallmc</groupId>
+ <groupId>fr.pandacube.pandacord</groupId>
<artifactId>waterfall-query</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
diff --git a/query/pom.xml b/query/pom.xml
index dea7d85f..55baf2e0 100644
--- a/query/pom.xml
+++ b/query/pom.xml
@@ -4,13 +4,12 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>io.github.waterfallmc</groupId>
+ <groupId>fr.pandacube.pandacord</groupId>
<artifactId>waterfall-parent</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
- <groupId>io.github.waterfallmc</groupId>
<artifactId>waterfall-query</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<packaging>jar</packaging>
@@ -26,7 +25,7 @@
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>io.github.waterfallmc</groupId>
+ <groupId>fr.pandacube.pandacord</groupId>
<artifactId>waterfall-api</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
--
2.32.0.windows.2

View File

@ -1,150 +0,0 @@
From dbb2441936118788203dc43a4c4582ee71e017c8 Mon Sep 17 00:00:00 2001
From: Marc Baloup <marc.baloup@laposte.net>
Date: Sun, 2 Oct 2016 07:54:16 +0200
Subject: [PATCH] Multi-session with same Minecraft account with specific
permission
Players with permission bungeecord.multiple_connect can have multiples
connections with the same Minecraft account. To manage UUID and Name conflict,
an increment value is appended to the player name, and the uuid used is the
offline one. So be carefull: Spigot servers and plugins will considers 2
players from the same account like if they were 2 different MC account.
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
index 0f1716c0..b07d2e06 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
@@ -110,6 +110,17 @@ public class InitialHandler extends PacketHandler implements PendingConnection
@Getter
private String extraDataInHandshake = "";
+ @Getter
+ private boolean duplication = false;
+
+ @Getter
+ private String realName = null;
+
+ @Getter
+ private UUID realId = null;
+
+ private String gameName = null;
+
@Override
public boolean shouldHandle(PacketWrapper packet) throws Exception
{
@@ -364,6 +375,8 @@ public class InitialHandler extends PacketHandler implements PendingConnection
{
Preconditions.checkState( thisState == State.USERNAME, "Not expecting USERNAME" );
this.loginRequest = loginRequest;
+ this.realName = loginRequest.getData();
+ this.gameName = this.realName;
if ( getName().contains( " " ) )
{
@@ -378,9 +391,21 @@ public class InitialHandler extends PacketHandler implements PendingConnection
return;
}
+ ProxiedPlayer existingPlayer = bungee.getPlayer( getName() );
+
+ duplication = ( existingPlayer != null && existingPlayer.hasPermission( "bungeecord.multiple_connect" ) );
+
+ if ( duplication )
+ {
+ gameName = generateDuplicatedName( realName );
+ this.loginRequest.setData( gameName ); // gameName transmitted to Spigot server
+ }
+
+ offlineId = UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + gameName ).getBytes( Charsets.UTF_8 ) );
+
// If offline mode and they are already on, don't allow connect
// We can just check by UUID here as names are based on UUID
- if ( !isOnlineMode() && bungee.getPlayer( getUniqueId() ) != null )
+ if ( !isOnlineMode() && bungee.getPlayer( offlineId ) != null && !duplication )
{
disconnect( bungee.getTranslation( "already_connected_proxy" ) );
return;
@@ -435,7 +460,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
BungeeCipher encrypt = EncryptionUtil.getCipher( true, sharedKey );
ch.addBefore( PipelineUtils.FRAME_PREPENDER, PipelineUtils.ENCRYPT_HANDLER, new CipherEncoder( encrypt ) );
- String encName = URLEncoder.encode( InitialHandler.this.getName(), "UTF-8" );
+ String encName = URLEncoder.encode( InitialHandler.this.realName, "UTF-8" );
MessageDigest sha = MessageDigest.getInstance( "SHA-1" );
for ( byte[] bit : new byte[][]
@@ -461,8 +486,10 @@ public class InitialHandler extends PacketHandler implements PendingConnection
if ( obj != null && obj.getId() != null )
{
loginProfile = obj;
- name = obj.getName();
- uniqueId = Util.getUUID( obj.getId() );
+ realName = obj.getName();
+ realId = Util.getUUID( obj.getId() );
+ if ( !duplication )
+ uniqueId = realId;
finish();
return;
}
@@ -470,7 +497,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
} else
{
disconnect( bungee.getTranslation( "mojang_fail" ) );
- bungee.getLogger().log( Level.SEVERE, "Error authenticating " + getName() + " with minecraft.net", error );
+ bungee.getLogger().log( Level.SEVERE, "Error authenticating " + realName + " with minecraft.net", error );
}
}
};
@@ -480,6 +507,12 @@ public class InitialHandler extends PacketHandler implements PendingConnection
private void finish()
{
+
+ if ( uniqueId == null )
+ {
+ uniqueId = offlineId;
+ }
+
if ( isOnlineMode() )
{
// Check for multiple connections
@@ -510,12 +543,6 @@ public class InitialHandler extends PacketHandler implements PendingConnection
}
- offlineId = UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + getName() ).getBytes( Charsets.UTF_8 ) );
- if ( uniqueId == null )
- {
- uniqueId = offlineId;
- }
-
Callback<LoginEvent> complete = new Callback<LoginEvent>()
{
@Override
@@ -615,7 +642,22 @@ public class InitialHandler extends PacketHandler implements PendingConnection
@Override
public String getName()
{
- return ( name != null ) ? name : ( loginRequest == null ) ? null : loginRequest.getData();
+ return gameName;
+ }
+
+ private String generateDuplicatedName(String original)
+ {
+ String newName;
+ int i = 0;
+ do
+ {
+ i++;
+ String strCount = Integer.toString( i );
+ if ( original.length() > 16 - strCount.length() )
+ original = original.substring( 0, 16 - strCount.length() );
+ newName = original + i;
+ } while ( bungee.getPlayer( newName ) != null );
+ return newName;
}
@Override
--
2.32.0.windows.2

View File

@ -1,43 +0,0 @@
From e814af4ff1a9b377eb2642d4d317407072f373de Mon Sep 17 00:00:00 2001
From: Marc Baloup <marc.baloup@laposte.net>
Date: Tue, 29 Oct 2019 23:43:32 +0100
Subject: [PATCH] Inproved proxy and server branding (displayed in F3)
diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
index cffe7a8d..51207270 100644
--- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
+++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
@@ -51,6 +51,7 @@ import java.util.logging.Logger;
import lombok.Getter;
import lombok.Setter;
import lombok.Synchronized;
+import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.Favicon;
import net.md_5.bungee.api.ProxyServer;
@@ -533,7 +534,7 @@ public class BungeeCord extends ProxyServer
@Override
public String getName()
{
- return "Waterfall";
+ return ChatColor.YELLOW + "[[" + ChatColor.GREEN + ChatColor.BOLD + "Pandacube" + ChatColor.YELLOW + "]]" + ChatColor.RESET;
}
@Override
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
index 9e180c30..72538ddb 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
@@ -293,7 +293,7 @@ public class DownstreamBridge extends PacketHandler
Preconditions.checkState( !serverBrand.contains( bungee.getName() ), "Cannot connect proxy to itself!" );
brand = ByteBufAllocator.DEFAULT.heapBuffer();
- DefinedPacket.writeString( bungee.getName() + " <- " + serverBrand, brand ); // Waterfall
+ DefinedPacket.writeString( bungee.getName() + " <- " + server.getInfo().getName() + " (" + serverBrand + ")", brand ); // Waterfall
pluginMessage.setData( brand );
brand.release();
// changes in the packet are ignored so we need to send it manually
--
2.32.0.windows.2

View File

@ -1,194 +0,0 @@
From 999d7c782e22b1b1ac3bd614e8120c4b9d6d64cb Mon Sep 17 00:00:00 2001
From: Marc Baloup <marc.baloup@laposte.net>
Date: Sun, 21 Jun 2020 21:49:31 +0200
Subject: [PATCH] new event TabCompleteRequestEvent and deprecate
TabCompleteEvent
diff --git a/api/src/main/java/net/md_5/bungee/api/event/TabCompleteEvent.java b/api/src/main/java/net/md_5/bungee/api/event/TabCompleteEvent.java
index 2fcd8616..63031f7b 100644
--- a/api/src/main/java/net/md_5/bungee/api/event/TabCompleteEvent.java
+++ b/api/src/main/java/net/md_5/bungee/api/event/TabCompleteEvent.java
@@ -9,7 +9,9 @@ import net.md_5.bungee.api.plugin.Cancellable;
/**
* Event called when a player uses tab completion.
+ * @deprecated please use {@link TabCompleteRequestEvent} to support 1.13+ suggestions.
*/
+@Deprecated
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
diff --git a/api/src/main/java/net/md_5/bungee/api/event/TabCompleteRequestEvent.java b/api/src/main/java/net/md_5/bungee/api/event/TabCompleteRequestEvent.java
new file mode 100644
index 00000000..0093ae69
--- /dev/null
+++ b/api/src/main/java/net/md_5/bungee/api/event/TabCompleteRequestEvent.java
@@ -0,0 +1,85 @@
+package net.md_5.bungee.api.event;
+
+import com.google.common.base.Preconditions;
+import com.mojang.brigadier.context.StringRange;
+import com.mojang.brigadier.suggestion.Suggestions;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+import net.md_5.bungee.api.connection.Connection;
+import net.md_5.bungee.api.connection.ProxiedPlayer;
+import net.md_5.bungee.api.plugin.Cancellable;
+import net.md_5.bungee.protocol.ProtocolConstants;
+
+/**
+ * Event called when a player uses tab completion.
+ */
+@Data
+@ToString(callSuper = true)
+@EqualsAndHashCode(callSuper = true)
+public class TabCompleteRequestEvent extends TargetedEvent implements Cancellable
+{
+
+ /**
+ * Cancelled state.
+ */
+ private boolean cancelled;
+ /**
+ * The message the player has already entered.
+ */
+ private final String cursor;
+ /**
+ * Range corresponding to the last word of {@link #getCursor()}.
+ * If you want your suggestions to be compatible with 1.12 and older
+ * clients, you need to {@link #setSuggestions(Suggestions)} with
+ * a range equals to this one.
+ * For 1.13 and newer clients, any other range that cover any part of
+ * {@link #getCursor()} is fine.<br>
+ * To check if the client supports custom ranges, use
+ * {@link #supportsCustomRange()}.
+ */
+ private final StringRange legacyCompatibleRange;
+ /**
+ * The suggestions that will be sent to the client. If this list is empty,
+ * the request will be forwarded to the server.
+ */
+ private Suggestions suggestions;
+
+ public TabCompleteRequestEvent(Connection sender, Connection receiver, String cursor, StringRange legacyCompatibleRange, Suggestions suggestions)
+ {
+ super( sender, receiver );
+ this.cursor = cursor;
+ this.legacyCompatibleRange = legacyCompatibleRange;
+ this.suggestions = suggestions;
+ }
+
+ /**
+ * Sets the suggestions that will be sent to the client.
+ * If this list is empty, the request will be forwarded to the server.
+ * @param suggestions the new Suggestions. Cannot be null.
+ * @throws IllegalArgumentException if the client is on 1.12 or lower and
+ * {@code suggestions.getRange()} is not equals to {@link #legacyCompatibleRange}.
+ */
+ public void setSuggestions(Suggestions suggestions)
+ {
+ Preconditions.checkNotNull( suggestions );
+ Preconditions.checkArgument( supportsCustomRange() || legacyCompatibleRange.equals( suggestions.getRange() ),
+ "Clients on 1.12 or lower versions don't support the provided range for tab-completion: " + suggestions.getRange()
+ + ". Please use TabCompleteRequestEvent.getLegacyCompatibleRange() for legacy clients." );
+ this.suggestions = suggestions;
+ }
+
+ /**
+ * Convenient method to tell if the client supports custom range for
+ * suggestions.
+ * If the client is on 1.13 or above, this methods returns true, and any
+ * range can be used for {@link #setSuggestions(Suggestions)}. Otherwise,
+ * it returns false and the defined range must be equals to
+ * {@link #legacyCompatibleRange}.
+ * @return true if the client is on 1.13 or newer version, false otherwise.
+ */
+ public boolean supportsCustomRange()
+ {
+ return ( (ProxiedPlayer) getSender() ).getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_13;
+ }
+}
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java
index d93d8851..bbb1ae91 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java
@@ -6,7 +6,6 @@ import com.mojang.brigadier.suggestion.Suggestion;
import com.mojang.brigadier.suggestion.Suggestions;
import io.netty.channel.Channel;
import java.util.ArrayList;
-import java.util.LinkedList;
import java.util.List;
import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.ServerConnection.KeepAliveData;
@@ -19,6 +18,7 @@ import net.md_5.bungee.api.event.PlayerDisconnectEvent;
import net.md_5.bungee.api.event.PluginMessageEvent;
import net.md_5.bungee.api.event.SettingsChangedEvent;
import net.md_5.bungee.api.event.TabCompleteEvent;
+import net.md_5.bungee.api.event.TabCompleteRequestEvent;
import net.md_5.bungee.entitymap.EntityMap;
import net.md_5.bungee.forge.ForgeConstants;
import net.md_5.bungee.netty.ChannelWrapper;
@@ -200,32 +200,42 @@ public class UpstreamBridge extends PacketHandler
TabCompleteEvent tabCompleteEvent = new TabCompleteEvent( con, con.getServer(), tabComplete.getCursor(), suggestions );
bungee.getPluginManager().callEvent( tabCompleteEvent );
- if ( tabCompleteEvent.isCancelled() )
+ List<String> legacyResults = tabCompleteEvent.getSuggestions();
+
+ int start = tabComplete.getCursor().lastIndexOf( ' ' ) + 1;
+ int end = tabComplete.getCursor().length();
+ StringRange lastArgumentRange = StringRange.between( start, end );
+
+ List<Suggestion> brigadier = new ArrayList<>( legacyResults.size() );
+ for ( String s : legacyResults )
+ {
+ brigadier.add( new Suggestion( lastArgumentRange, s ) );
+ }
+
+ TabCompleteRequestEvent tabCompleteRequestEvent = new TabCompleteRequestEvent( con, con.getServer(), tabComplete.getCursor(), lastArgumentRange, new Suggestions( lastArgumentRange, brigadier ) );
+ tabCompleteRequestEvent.setCancelled( tabCompleteEvent.isCancelled() );
+ bungee.getPluginManager().callEvent( tabCompleteRequestEvent );
+
+ if ( tabCompleteRequestEvent.isCancelled() )
{
throw CancelSendSignal.INSTANCE;
}
- List<String> results = tabCompleteEvent.getSuggestions();
- if ( !results.isEmpty() )
+ Suggestions brigadierResults = tabCompleteRequestEvent.getSuggestions();
+
+ if ( !brigadierResults.isEmpty() )
{
- // Unclear how to handle 1.13 commands at this point. Because we don't inject into the command packets we are unlikely to get this far unless
- // Bungee plugins are adding results for commands they don't own anyway
if ( con.getPendingConnection().getVersion() < ProtocolConstants.MINECRAFT_1_13 )
{
+ List<String> results = new ArrayList<>( brigadierResults.getList().size() );
+ for ( Suggestion s : brigadierResults.getList() )
+ {
+ results.add( s.getText() );
+ }
con.unsafe().sendPacket( new TabCompleteResponse( results ) );
} else
{
- int start = tabComplete.getCursor().lastIndexOf( ' ' ) + 1;
- int end = tabComplete.getCursor().length();
- StringRange range = StringRange.between( start, end );
-
- List<Suggestion> brigadier = new LinkedList<>();
- for ( String s : results )
- {
- brigadier.add( new Suggestion( range, s ) );
- }
-
- con.unsafe().sendPacket( new TabCompleteResponse( tabComplete.getTransactionId(), new Suggestions( range, brigadier ) ) );
+ con.unsafe().sendPacket( new TabCompleteResponse( tabComplete.getTransactionId(), brigadierResults ) );
}
throw CancelSendSignal.INSTANCE;
}
--
2.32.0.windows.2

View File

@ -1,28 +0,0 @@
#!/usr/bin/env bash
case "$1" in
"rb" | "rbp" | "rebuild")
scripts/rebuildPatches.sh
;;
"p" | "patch")
scripts/build.sh
;;
"m" | "up" | "merge")
scripts/mergeUpstream.sh
;;
"e" | "edit")
scripts/edit.sh
;;
*)
echo "PandaCord build tool command. This provides a variety of commands to control the PandaCord"
echo "build. View below for details of the available commands."
echo ""
echo "Commands:"
echo " * rb, rbp, rebuild | Rebuilds the patches"
echo " * p, patch | Applies all the patches to BungeeCord / Waterfall"
echo " * m, up, merge | Utility to aid in merging upstream"
echo " * e, edit | Runs git rebase -i for PandaCord, allowing patches to be easily modified"
;;
esac

25
pom.xml Normal file
View File

@ -0,0 +1,25 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.waterfallmc</groupId>
<artifactId>travertine-super</artifactId>
<version>dev-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Travertine-Super</name>
<description>Super project for Travertine.</description>
<url>https://github.com/WaterfallMC/Travertine</url>
<modules>
<module>Travertine-Proxy</module>
</modules>
<build>
<defaultGoal>clean install</defaultGoal>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

View File

@ -67,7 +67,7 @@ applyPatch BungeeCord Waterfall-Proxy HEAD
popd
basedir=$(dirname "$basedir")
# Apply pandacord patches
applyPatch Waterfall/Waterfall-Proxy PandaCord-Proxy HEAD
# Apply travertine patches
applyPatch Waterfall/Waterfall-Proxy Travertine-Proxy HEAD
enableCommitSigningIfNeeded

View File

@ -1,3 +1,7 @@
#!/usr/bin/env bash
git submodule update --recursive --init && ./scripts/applyPatches.sh
if [ "$1" == "--jar" ]; then
pushd Travertine-Proxy
mvn clean package
fi

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
pushd PandaCord-Proxy
pushd Travertine-Proxy
git rebase --interactive upstream/upstream
popd

View File

@ -3,6 +3,7 @@
(
PS1="$"
basedir="$(cd "$1" && pwd -P)"
workdir="$basedir/work"
echo "Rebuilding patch files from current fork state..."
git config core.safecrlf false
@ -56,5 +57,5 @@ function savePatches {
echo " Patches saved for $what to $what_name-Patches/"
}
savePatches "Waterfall/Waterfall-Proxy" "PandaCord-Proxy"
savePatches "Waterfall/Waterfall-Proxy" "Travertine-Proxy"
)

149
scripts/wigglePatch.py Normal file
View File

@ -0,0 +1,149 @@
#!/usr/bin/env python3
from subprocess import run, PIPE, CalledProcessError
from argparse import ArgumentParser
import os
from os import path
from sys import stderr, stdout
import re
from enum import Enum, unique
@unique
class FileStatus(Enum):
UNTRACKED = '?'
UNMODIFIED = ' '
MODIFIED = 'M'
ADDED = 'A'
DELETED = 'D'
RENAMED = 'R'
COPIED = 'C'
UNMERGED = 'U'
IGNORED = '!'
class GitRepository:
def __init__(self, directory):
if not path.isdir(directory):
if not path.exists(directory):
raise ValueError("Repository doesn't exist:", directory)
else:
raise ValueError("Repository isn't a valid directory:", directory)
elif not path.isdir(path.join(directory, ".git")):
raise ValueError("Directory isn't a git repository:", directory)
self.directory = directory
def status(self):
status_lines = run(
["git", "status", "--porcelain"],
check=True, stdout=PIPE, universal_newlines=True,
cwd=self.directory
).stdout
status = dict()
for line in status_lines.splitlines():
old_status = FileStatus(line[0])
new_status = FileStatus(line[1])
file_name = line[3:]
status[file_name] = (old_status, new_status)
return status
def is_clean(self):
try:
return len(self.status()) == 0
except CalledProcessError:
return False
def is_automatically_merging(self):
return path.exists(path.join(self.directory, ".git", "rebase-apply", "applying"))
def wiggle_patch(self, patch):
assert self.is_clean()
# By default, wiggle won't create files the patch needs, and just fails
for created_file in patch.created_files:
# mkdir -p $(dirname created_file)
os.makedirs(path.join(self.directory, path.dirname(created_file)), exist_ok=True)
# touch created_file
with open(path.join(self.directory, created_file), 'a'):
pass
result = run(["wiggle", "-rp", path.relpath(patch.file, start=self.directory)],
stderr=stderr, cwd=self.directory)
for file_name, (old_status, new_status) in self.status().items():
if new_status == FileStatus.UNTRACKED and old_status == FileStatus.UNTRACKED \
and file_name.endswith(".porig"):
# Remove wiggle's automatically created backup files
# They're completely unessicary since the entire repo is version-controlled
os.remove(path.join(self.directory, file_name))
if result.returncode == 1:
return False # There were unresolved conflicts
else:
# Check for an unexpected error
# Since conflicts were already checked for, this will only raise for unexpected errors
result.check_returncode()
return True # Successfully wiggled
def __str__(self):
return path.basename(self.directory)
class PatchFile:
def __init__(self, file):
if not path.isfile(file):
if not path.exists(file):
raise ValueError("Patch file doesn't exist:", file)
else:
raise ValueError("Patch isn't a file:", file)
self.file = file
try:
summary = run(["git", "apply", "--summary", file],
check=True, stdout=PIPE, universal_newlines=True).stdout
except CalledProcessError:
raise ValueError("Invalid patch file:", file)
summary_pattern = re.compile(r"\s*(create) mode \d+ (\S+)")
created_files = list()
for line in summary.splitlines():
match = summary_pattern.match(line)
if not match:
raise NotImplementedError("Don't know how to parse summary line: {}".format(line))
(action, target_file) = match.groups()
if action == "create":
created_files.append(target_file)
self.created_files = tuple(created_files) # Immutable copy
def __str__(self):
return path.basename(self.file)
parser = ArgumentParser(description="Wiggle the patch into the specified git repository")
parser.add_argument("repo", help="The git repository to apply the patch to", type=GitRepository)
parser.add_argument("patch", help="The patch to apply to the repository", type=PatchFile)
parser.add_argument("--git-am", "--am", "-a", action="store_true",
help="If an automatic merge is in progress, continue it after wiggling")
args = parser.parse_args()
repository, patch = args.repo, args.patch
if not repository.is_clean():
print(repository, "isn't a clean repo!")
exit(1)
was_automatically_merging = False
if args.git_am and repository.is_automatically_merging():
print("Automatic merge in progress, will continue applying if successful")
was_automatically_merging = True
if not repository.wiggle_patch(patch):
print("Unresolved conflicts found while wiggling!", file=stderr)
print("Manual intervention is required to fix the conflicts!", file=stderr)
exit(2)
if args.git_am and was_automatically_merging:
assert repository.is_automatically_merging()
try:
print("Adding changed files to index")
run(["git", "add", "."], stdout=stdout, stderr=stderr, check=True,
cwd=repository.directory)
print("Continuing automatic merge after successful wiggle")
run(["git", "am", "--continue"], stdout=stdout, stderr=stderr, check=True,
cwd=repository.directory)
except CalledProcessError as e:
print("Failed to continue automatic merge!", file=stderr)
exit(3)
else:
print("Successfully Wiggled", patch, "into", repository)

35
travertine Executable file
View File

@ -0,0 +1,35 @@
#!/usr/bin/env bash
case "$1" in
"rb" | "rbp" | "rebuild")
scripts/rebuildPatches.sh
;;
"p" | "patch")
scripts/build.sh
;;
"m" | "up" | "merge")
scripts/mergeUpstream.sh
;;
"b" | "build")
scripts/build.sh --jar
;;
"e" | "edit")
scripts/edit.sh
;;
"w" | "wiggle")
scripts/wigglePatch.py
;;
*)
echo "Travertine build tool command. This provides a variety of commands to control the Travertine"
echo "build. View below for details of the available commands."
echo ""
echo "Commands:"
echo " * rb, rbp, rebuild | Rebuilds the patches"
echo " * p, patch | Applies all the patches to BungeeCord"
echo " * m, up, merge | Utility to aid in merging upstream"
echo " * b, build | Builds the project"
echo " | The bootstrap artifact can be found in Travertine-Proxy/bootstrap/target/"
echo " * e, edit | Runs git rebase -i for Waterfall, allowing patches to be easily modified"
echo " * w, wiggle | Helps to apply patches that fail to using default Git."
;;
esac