Advertisement
Maxqia

ViaBackwards Semi-Working Sponge

Oct 3rd, 2016
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 4.31 KB | None | 0 0
  1. diff --git a/pom.xml b/pom.xml
  2. index fce78d7..e60c431 100644
  3. --- a/pom.xml
  4. +++ b/pom.xml
  5. @@ -32,6 +32,10 @@
  6.              <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
  7.          </repository>
  8.          <repository>
  9. +            <id>sponge</id>
  10. +            <url>http://repo.spongepowered.org/maven</url>
  11. +        </repository>
  12. +        <repository>
  13.              <id>viaversion-repo</id>
  14.              <url>https://repo.viaversion.com/</url>
  15.          </repository>
  16. @@ -45,6 +49,12 @@
  17.              <scope>provided</scope>
  18.          </dependency>
  19.          <dependency>
  20. +            <groupId>org.spongepowered</groupId>
  21. +            <artifactId>spongeapi</artifactId>
  22. +            <version>5.0.0-20161003.050154-143</version>
  23. +            <scope>provided</scope>
  24. +        </dependency>
  25. +        <dependency>
  26.              <groupId>us.myles</groupId>
  27.              <artifactId>viaversion</artifactId>
  28.              <version>1.0.0-ALPHA-modules</version>
  29. diff --git a/src/main/java/nl/matsv/viabackwards/SpongePlugin.java b/src/main/java/nl/matsv/viabackwards/SpongePlugin.java
  30. new file mode 100644
  31. index 0000000..55c1196
  32. --- /dev/null
  33. +++ b/src/main/java/nl/matsv/viabackwards/SpongePlugin.java
  34. @@ -0,0 +1,39 @@
  35. +/*
  36. + *
  37. + *     Copyright (C) 2016 Maxqia
  38. + *
  39. + *     This program is free software: you can redistribute it and/or modify
  40. + *     it under the terms of the GNU General Public License as published by
  41. + *     the Free Software Foundation, either version 3 of the License, or
  42. + *     (at your option) any later version.
  43. + *
  44. + *     This program is distributed in the hope that it will be useful,
  45. + *     but WITHOUT ANY WARRANTY; without even the implied warranty of
  46. + *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  47. + *     GNU General Public License for more details.
  48. + *
  49. + *     You should have received a copy of the GNU General Public License
  50. + *     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  51. + */
  52. +
  53. +package nl.matsv.viabackwards;
  54. +
  55. +import nl.matsv.viabackwards.protocol.protocol1_9_4to1_10.Protocol1_9To1_10;
  56. +import org.spongepowered.api.event.Listener;
  57. +import org.spongepowered.api.event.game.state.GameAboutToStartServerEvent;
  58. +import org.spongepowered.api.event.game.state.GameLoadCompleteEvent;
  59. +import org.spongepowered.api.plugin.Plugin;
  60. +import us.myles.ViaVersion.api.protocol.ProtocolRegistry;
  61. +import us.myles.ViaVersion.api.protocol.ProtocolVersion;
  62. +
  63. +import java.util.Collections;
  64. +
  65. +@Plugin(id = "xviabackwards", name = "ViaBackwards", version = "1.0.2-DEV")
  66. +public class SpongePlugin {
  67. +    @Listener
  68. +    public void onServerStart(GameLoadCompleteEvent event) {
  69. +        System.out.println("Registering Protocol!");
  70. +        // Register the protocol
  71. +        ProtocolRegistry.registerProtocol(new Protocol1_9To1_10(), Collections.singletonList(ProtocolVersion.v1_9_3.getId()), ProtocolVersion.v1_10.getId());
  72. +    }
  73. +}
  74. diff --git a/src/main/java/nl/matsv/viabackwards/api/rewriters/EntityRewriter.java b/src/main/java/nl/matsv/viabackwards/api/rewriters/EntityRewriter.java
  75. index 18b4b8b..b5b5668 100644
  76. --- a/src/main/java/nl/matsv/viabackwards/api/rewriters/EntityRewriter.java
  77. +++ b/src/main/java/nl/matsv/viabackwards/api/rewriters/EntityRewriter.java
  78. @@ -24,7 +24,7 @@ import nl.matsv.viabackwards.api.MetaRewriter;
  79.  import nl.matsv.viabackwards.api.exceptions.RemovedValueException;
  80.  import nl.matsv.viabackwards.api.storage.EntityTracker;
  81.  import nl.matsv.viabackwards.api.storage.EntityType;
  82. -import org.bukkit.Bukkit;
  83. +import us.myles.ViaVersion.api.Via;
  84.  import us.myles.ViaVersion.api.ViaVersion;
  85.  import us.myles.ViaVersion.api.data.UserConnection;
  86.  import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
  87. @@ -112,7 +112,7 @@ public abstract class EntityRewriter<T extends BackwardsProtocol> extends Rewrit
  88.              } catch (RemovedValueException ignored) {
  89.              } catch (Exception e) {
  90.                  if (ViaVersion.getInstance().isDebug()) {
  91. -                    Logger log = Bukkit.getPluginManager().getPlugin("ViaBackwards").getLogger();
  92. +                    Logger log = Via.getPlatform().getLogger();
  93.                      log.warning("Unable to handle metadata " + md);
  94.                      log.warning("Full metadata list " + metaData);
  95.                      e.printStackTrace();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement