Skip to content

Commit

Permalink
Isoloation and Licences
Browse files Browse the repository at this point in the history
* Implement full isolation between Geyser Protocol and Reversion Protocol. This allows incompatible changes to still work
* Update licence to MIT

Squashed commit of the following:

commit 5b8ba31874912d6a2aa82e1edb7a74bb03b0ac74
Author: bundabrg <bundabrg@grieve.com.au>
Date:   Fri Sep 18 17:01:20 2020 +0800

    Clean up

commit 5e1128c
Author: bundabrg <brendan@grieve.com.au>
Date:   Fri Sep 18 12:48:18 2020 +0800

    Checkpoint

commit f2e1dab
Author: bundabrg <bundabrg@grieve.com.au>
Date:   Thu Sep 17 17:19:48 2020 +0800

    It compiles

commit e44f025
Author: bundabrg <bundabrg@grieve.com.au>
Date:   Thu Sep 17 15:59:22 2020 +0800

    Update Copyright and start work on Relocated version of Reversion

commit 46ccf28
Author: bundabrg <bundabrg@grieve.com.au>
Date:   Thu Sep 17 14:47:25 2020 +0800

    checkpoint before isolation

commit c3bae9a
Author: bundabrg <brendan@grieve.com.au>
Date:   Thu Sep 17 12:54:13 2020 +0800

    Checkpoint

commit db5e03e
Author: bundabrg <brendan@grieve.com.au>
Date:   Thu Sep 17 12:54:03 2020 +0800

    Checkpoint

commit 0df2fde
Author: bundabrg <brendan@grieve.com.au>
Date:   Sun Sep 13 23:20:06 2020 +0800

    Update Docs

commit 7229243
Author: bundabrg <brendan@grieve.com.au>
Date:   Sun Sep 13 23:01:56 2020 +0800

    Initial Support for Bedrock-v414
  • Loading branch information
bundabrg committed Sep 18, 2020
1 parent 14f0bb3 commit 7582404
Show file tree
Hide file tree
Showing 20 changed files with 1,510 additions and 436 deletions.
6 changes: 6 additions & 0 deletions .idea/copyright/MIT.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ allow any supported version to connect to any supported Geyser.
* Minecraft Bedrock v1.16.100.50 (beta)
* Minecraft Bedrock v1.16.100.52 (beta)
* Minecraft Bedrock v1.16.100.53 (beta)
* Minecraft Bedrock v1.16.100.55 (beta)

### Minecraft Education
* Minecraft Education v1.14.31
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ allow any supported version to connect to any supported Geyser.
* Minecraft Bedrock v1.16.100.50 (beta)
* Minecraft Bedrock v1.16.100.52 (beta)
* Minecraft Bedrock v1.16.100.53 (beta)
* Minecraft Bedrock v1.16.100.55 (beta)

### Minecraft Education
* Minecraft Education v1.14.31
Expand Down
63 changes: 19 additions & 44 deletions geyser-reversion/pom.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ EduSupport - Minecraft Protocol Support for MultiVersion in Geyser
~ Copyright (C) 2020 GeyserReversion Developers
~ MIT License
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~ Copyright (c) 2020 GeyserReversion Developers
~
~ 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 General Public License for more details.
~ 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:
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
~ 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.
-->

<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand All @@ -37,40 +43,9 @@
<version>1.2.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- Translators -->
<dependency>
<groupId>au.com.grieve.reversion</groupId>
<artifactId>translator-v390ee_to_v408be</artifactId>
<version>${reversion.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>au.com.grieve.reversion</groupId>
<artifactId>translator-v409be_to_v408be</artifactId>
<version>${reversion.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>au.com.grieve.reversion</groupId>
<artifactId>translator-v411be_to_v409be</artifactId>
<version>${reversion.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>au.com.grieve.reversion</groupId>
<artifactId>translator-v412be_to_v411be</artifactId>
<version>${reversion.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>au.com.grieve.reversion</groupId>
<artifactId>edition-education</artifactId>
<version>${reversion.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>au.com.grieve.reversion</groupId>
<artifactId>edition-bedrock</artifactId>
<artifactId>build-all-relocated</artifactId>
<version>${reversion.version}</version>
<scope>compile</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
/*
* EduSupport - Minecraft Protocol Support for MultiVersion in Geyser
* Copyright (C) 2020 GeyserReversion Developers
* MIT License
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* Copyright (c) 2020 GeyserReversion Developers
*
* 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 General Public License for more details.
* 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:
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* 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.
*/

package au.com.grieve.geyser.reversion;
Expand All @@ -22,13 +28,9 @@
import au.com.grieve.geyser.reversion.config.Configuration;
import au.com.grieve.geyser.reversion.editions.bedrock.BedrockEdition;
import au.com.grieve.geyser.reversion.editions.education.EducationEdition;
import au.com.grieve.geyser.reversion.translators.geyser.v408.Register_Geyser_v408;
import au.com.grieve.geyser.reversion.server.GeyserBedrockServer;
import au.com.grieve.reversion.Build;
import au.com.grieve.reversion.api.RegisteredTranslator;
import au.com.grieve.reversion.api.ReversionServer;
import au.com.grieve.reversion.translators.v390ee_to_v408be.Register_v390ee_to_v408be;
import au.com.grieve.reversion.translators.v409be_to_v408be.Register_v409be_to_v408be;
import au.com.grieve.reversion.translators.v411be_to_v409be.Register_v411be_to_v409be;
import au.com.grieve.reversion.translators.v412be_to_v411be.Register_v412be_to_v411be;
import lombok.Getter;
import org.geysermc.connector.GeyserConnector;
import org.geysermc.connector.event.annotations.GeyserEventHandler;
Expand Down Expand Up @@ -67,6 +69,8 @@ public class GeyserReversionExtension extends GeyserExtension {
private final Map<String, Edition> registeredEditions = new HashMap<>();
private final List<RegisteredTranslator> registeredTranslators = new ArrayList<>();

private GeyserBedrockServer server;

private Configuration config;

public GeyserReversionExtension(ExtensionManager extensionManager, ExtensionClassLoader extensionClassLoader) {
Expand All @@ -90,13 +94,9 @@ private void registerEditions() {
* Register built-in translators
*/
private void registerTranslators() {
registerTranslator(Register_v409be_to_v408be.TRANSLATOR);
registerTranslator(Register_v411be_to_v409be.TRANSLATOR);
registerTranslator(Register_v390ee_to_v408be.TRANSLATOR);
registerTranslator(Register_v412be_to_v411be.TRANSLATOR);

// Add Geyser Translators
registerTranslator(Register_Geyser_v408.TRANSLATOR);
for (RegisteredTranslator translator : Build.TRANSLATORS) {
registerTranslator(translator);
}
}


Expand Down Expand Up @@ -139,7 +139,7 @@ private void loadConfig() {
/**
* Replace Geyser BedrockServer with one provided by an edition
*/
@GeyserEventHandler(priority = EventHandler.PRIORITY.HIGH)
@GeyserEventHandler(priority = EventHandler.PRIORITY.LOW)
public void onGeyserStart(GeyserStartEvent event) {
Edition edition = registeredEditions.get(config.getEdition());

Expand All @@ -148,24 +148,27 @@ public void onGeyserStart(GeyserStartEvent event) {
return;
}

server = new GeyserBedrockServer(GeyserConnector.getInstance().getBedrockServer());

InetSocketAddress address = GeyserConnector.getInstance().getBedrockServer().getBindAddress();

// Create a new server on the same address/port as the default server
server.registerServer(edition.createReversionServer(address), true);

try {
Field bedrockServer = GeyserConnector.class.getDeclaredField("bedrockServer");
bedrockServer.setAccessible(true);

ReversionServer server = edition.createReversionServer(GeyserConnector.getInstance().getBedrockServer().getBindAddress());

GeyserConnector.getInstance().getBedrockServer().close();
bedrockServer.set(GeyserConnector.getInstance(), server);
// bedrockServer.set(GeyserConnector.getInstance(), server);

} catch (NoSuchFieldException | IllegalAccessException e) {
getLogger().error(String.format("Unable to set Edition '%s'. Extension disabled.", config.getEdition()), e);
} catch (NoSuchFieldException e) {
getLogger().error(String.format("Unable to enable Edition '%s'. Extension disabled.", config.getEdition()), e);
}

// Give the old BedrockServer time to close down
// Give the old BedrockServer time to close down then bind our default server
GeyserConnector.getInstance().getGeneralThreadPool().schedule(() -> {
GeyserConnector.getInstance().getBedrockServer().bind().whenComplete((avoid, throwable) -> {
server.bind().whenComplete((avoid, throwable) -> {
if (throwable != null) {
getLogger().severe(LanguageUtils.getLocaleStringLog("geyser.core.fail", address.getAddress().toString(), address.getPort()));
throwable.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
/*
* EduSupport - Minecraft Protocol Support for MultiVersion in Geyser
* Copyright (C) 2020 GeyserReversion Developers
* MIT License
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* Copyright (c) 2020 GeyserReversion Developers
*
* 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 General Public License for more details.
* 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:
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* 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.
*/

package au.com.grieve.geyser.reversion.api;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
/*
* EduSupport - Minecraft Protocol Support for MultiVersion in Geyser
* Copyright (C) 2020 GeyserReversion Developers
* MIT License
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* Copyright (c) 2020 GeyserReversion Developers
*
* 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 General Public License for more details.
* 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:
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* 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.
*/

package au.com.grieve.geyser.reversion.config;
Expand Down
Loading

0 comments on commit 7582404

Please sign in to comment.