Make Raven plugin optional
This commit is contained in:
parent
416fb60b51
commit
00ef5aadf7
|
@ -1,41 +1,24 @@
|
||||||
package tc.oc.api.bukkit;
|
package tc.oc.api.bukkit;
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import com.google.inject.Provides;
|
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.Plugin;
|
import tc.oc.api.ApiManifest;
|
||||||
import tc.oc.api.bukkit.friends.OnlineFriends;
|
import tc.oc.api.bukkit.friends.OnlineFriends;
|
||||||
import tc.oc.api.bukkit.users.BukkitUserStore;
|
import tc.oc.api.bukkit.users.BukkitUserStore;
|
||||||
import tc.oc.api.bukkit.users.Users;
|
import tc.oc.api.bukkit.users.Users;
|
||||||
import tc.oc.api.ApiManifest;
|
|
||||||
import tc.oc.api.minecraft.MinecraftApiManifest;
|
import tc.oc.api.minecraft.MinecraftApiManifest;
|
||||||
import tc.oc.api.minecraft.users.UserStore;
|
import tc.oc.api.minecraft.users.UserStore;
|
||||||
import tc.oc.bukkit.logging.RavenPlugin;
|
|
||||||
import tc.oc.commons.bukkit.inject.BukkitPluginManifest;
|
import tc.oc.commons.bukkit.inject.BukkitPluginManifest;
|
||||||
import tc.oc.commons.core.inject.HybridManifest;
|
import tc.oc.commons.core.inject.HybridManifest;
|
||||||
import tc.oc.commons.core.inject.Manifest;
|
|
||||||
import tc.oc.commons.core.plugin.PluginResolver;
|
|
||||||
import tc.oc.minecraft.logging.BetterRaven;
|
|
||||||
|
|
||||||
public final class BukkitApiManifest extends HybridManifest {
|
public final class BukkitApiManifest extends HybridManifest {
|
||||||
|
|
||||||
private static class Public extends Manifest {
|
|
||||||
@Provides
|
|
||||||
Optional<BetterRaven> betterRaven(PluginResolver<Plugin> resolver) {
|
|
||||||
return Optional.ofNullable(resolver.getPlugin(RavenPlugin.class)).map(RavenPlugin::getRaven);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
install(new ApiManifest());
|
install(new ApiManifest());
|
||||||
install(new MinecraftApiManifest());
|
install(new MinecraftApiManifest());
|
||||||
install(new BukkitPluginManifest());
|
install(new BukkitPluginManifest());
|
||||||
|
|
||||||
publicBinder().install(new Public());
|
|
||||||
|
|
||||||
bindAndExpose(UserStore.class).to(BukkitUserStore.class);
|
bindAndExpose(UserStore.class).to(BukkitUserStore.class);
|
||||||
bindAndExpose(BukkitUserStore.class);
|
bindAndExpose(BukkitUserStore.class);
|
||||||
|
|
||||||
|
|
|
@ -3,4 +3,4 @@ main: tc.oc.api.bukkit.BukkitApiManifest
|
||||||
version: ${project.version}-${git.commit.id.abbrev}
|
version: ${project.version}-${git.commit.id.abbrev}
|
||||||
author: Overcast Network
|
author: Overcast Network
|
||||||
isolate: true
|
isolate: true
|
||||||
depend: [Raven]
|
softdepend: [Raven]
|
||||||
|
|
|
@ -1,39 +1,22 @@
|
||||||
package tc.oc.api.bungee;
|
package tc.oc.api.bungee;
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import com.google.inject.Provides;
|
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
import net.md_5.bungee.api.plugin.Plugin;
|
|
||||||
import tc.oc.api.ApiManifest;
|
import tc.oc.api.ApiManifest;
|
||||||
import tc.oc.api.bungee.users.BungeeUserStore;
|
import tc.oc.api.bungee.users.BungeeUserStore;
|
||||||
import tc.oc.api.minecraft.MinecraftApiManifest;
|
import tc.oc.api.minecraft.MinecraftApiManifest;
|
||||||
import tc.oc.api.minecraft.users.UserStore;
|
import tc.oc.api.minecraft.users.UserStore;
|
||||||
import tc.oc.bungee.logging.RavenPlugin;
|
|
||||||
import tc.oc.commons.bungee.inject.BungeePluginManifest;
|
import tc.oc.commons.bungee.inject.BungeePluginManifest;
|
||||||
import tc.oc.commons.core.inject.HybridManifest;
|
import tc.oc.commons.core.inject.HybridManifest;
|
||||||
import tc.oc.commons.core.inject.Manifest;
|
|
||||||
import tc.oc.commons.core.plugin.PluginResolver;
|
|
||||||
import tc.oc.minecraft.logging.BetterRaven;
|
|
||||||
|
|
||||||
public final class BungeeApiManifest extends HybridManifest {
|
public final class BungeeApiManifest extends HybridManifest {
|
||||||
|
|
||||||
public static class Public extends Manifest {
|
|
||||||
@Provides
|
|
||||||
Optional<BetterRaven> betterRaven(PluginResolver<Plugin> resolver) {
|
|
||||||
return Optional.ofNullable(resolver.getPlugin(RavenPlugin.class)).map(RavenPlugin::getRaven);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
install(new ApiManifest());
|
install(new ApiManifest());
|
||||||
install(new MinecraftApiManifest());
|
install(new MinecraftApiManifest());
|
||||||
install(new BungeePluginManifest());
|
install(new BungeePluginManifest());
|
||||||
|
|
||||||
publicBinder().install(new Public());
|
|
||||||
|
|
||||||
bindAndExpose(UserStore.class).to(BungeeUserStore.class);
|
bindAndExpose(UserStore.class).to(BungeeUserStore.class);
|
||||||
bindAndExpose(BungeeUserStore.class);
|
bindAndExpose(BungeeUserStore.class);
|
||||||
|
|
||||||
|
|
|
@ -2,4 +2,4 @@ name: API
|
||||||
main: tc.oc.api.bungee.BungeeApiManifest
|
main: tc.oc.api.bungee.BungeeApiManifest
|
||||||
version: ${project.version}-${git.commit.id.abbrev}
|
version: ${project.version}-${git.commit.id.abbrev}
|
||||||
author: Overcast Network
|
author: Overcast Network
|
||||||
depends: [Raven]
|
softdepends: [Raven]
|
||||||
|
|
|
@ -16,6 +16,7 @@ import tc.oc.api.minecraft.users.MinecraftUsersManifest;
|
||||||
import tc.oc.commons.core.inject.HybridManifest;
|
import tc.oc.commons.core.inject.HybridManifest;
|
||||||
import tc.oc.commons.core.inject.Manifest;
|
import tc.oc.commons.core.inject.Manifest;
|
||||||
import tc.oc.debug.LeakDetectorManifest;
|
import tc.oc.debug.LeakDetectorManifest;
|
||||||
|
import tc.oc.minecraft.logging.RavenApiModule;
|
||||||
|
|
||||||
public final class MinecraftApiManifest extends HybridManifest {
|
public final class MinecraftApiManifest extends HybridManifest {
|
||||||
|
|
||||||
|
@ -37,6 +38,8 @@ public final class MinecraftApiManifest extends HybridManifest {
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
publicBinder().install(new Public());
|
publicBinder().install(new Public());
|
||||||
|
|
||||||
|
install(new RavenApiModule());
|
||||||
|
|
||||||
install(new LeakDetectorManifest());
|
install(new LeakDetectorManifest());
|
||||||
install(new MinecraftLoggingManifest());
|
install(new MinecraftLoggingManifest());
|
||||||
install(new MinecraftModelsManifest());
|
install(new MinecraftModelsManifest());
|
||||||
|
|
|
@ -2,4 +2,4 @@ name: ${plugin.prefix}
|
||||||
main: ${plugin.mainClass}
|
main: ${plugin.mainClass}
|
||||||
version: ${project.version}-${git.commit.id.abbrev}
|
version: ${project.version}-${git.commit.id.abbrev}
|
||||||
author: Overcast Network
|
author: Overcast Network
|
||||||
depends: [API, Raven]
|
depends: [API]
|
||||||
|
|
30
README.md
30
README.md
|
@ -69,21 +69,29 @@ Of particular interest are these:
|
||||||
* `settings.legacy-knockback: true` Emulate knockback mechanics from older versions of Minecraft
|
* `settings.legacy-knockback: true` Emulate knockback mechanics from older versions of Minecraft
|
||||||
* `settings.water-pushes-tnt: false` Disable water pushing TNT, a newer Minecraft feature that we don't use.
|
* `settings.water-pushes-tnt: false` Disable water pushing TNT, a newer Minecraft feature that we don't use.
|
||||||
|
|
||||||
These plugins are required for any SportBukkit server:
|
On any PGM or Lobby server, these external plugins can/must be loaded:
|
||||||
|
|
||||||
* raven-bukkit
|
* [bukkit-settings](https://github.com/OvercastNetwork/BukkitSettings) (required)
|
||||||
* bukkit-settings
|
* [Channels](https://github.com/OvercastNetwork/Channels) (required)
|
||||||
* api-bukkit
|
* [raven-bukkit](https://github.com/OvercastNetwork/raven-minecraft) (optional)
|
||||||
* commons-bukkit
|
* [ChatModerator](https://github.com/OvercastNetwork/ChatModerator) (optional)
|
||||||
* Channels
|
|
||||||
* chatmoderator (optional)
|
|
||||||
|
|
||||||
For a PGM server, you also need these:
|
As well as these plugins from this repo:
|
||||||
|
|
||||||
* PGM
|
* api-bukkit (built at `API/bukkit/target/api-bukkit-#-SNAPSHOT.jar`)
|
||||||
* Tourney (optional)
|
* commons-bukkit (built at `Commons/bukkit/target/commons-bukkit-#-SNAPSHOT.jar`)
|
||||||
|
|
||||||
For a Lobby server, you just need the Lobby plugin.
|
For a PGM server, you also need:
|
||||||
|
|
||||||
|
* PGM (built at `PGM/target/PGM-#-SNAPSHOT.jar`)
|
||||||
|
|
||||||
|
For tournament support on PGM, you also need:
|
||||||
|
|
||||||
|
* Tourney (built at `Tourney/target/Tourney-#-SNAPSHOT.jar`)
|
||||||
|
|
||||||
|
And for a Lobby server, you just need:
|
||||||
|
|
||||||
|
* Lobby (built at `Lobby/target/Lobby-1.11-SNAPSHOT.jar`)
|
||||||
|
|
||||||
|
|
||||||
# Contents
|
# Contents
|
||||||
|
|
|
@ -7,9 +7,7 @@ import javax.inject.Named;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
import com.google.inject.assistedinject.FactoryModuleBuilder;
|
import com.google.inject.assistedinject.FactoryModuleBuilder;
|
||||||
import org.bukkit.Server;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import tc.oc.bukkit.BukkitVersionInspector;
|
|
||||||
import tc.oc.commons.bukkit.bossbar.BossBarFactory;
|
import tc.oc.commons.bukkit.bossbar.BossBarFactory;
|
||||||
import tc.oc.commons.bukkit.bossbar.BossBarFactoryImpl;
|
import tc.oc.commons.bukkit.bossbar.BossBarFactoryImpl;
|
||||||
import tc.oc.commons.bukkit.chat.BukkitAudiences;
|
import tc.oc.commons.bukkit.chat.BukkitAudiences;
|
||||||
|
@ -19,9 +17,8 @@ import tc.oc.commons.bukkit.permissions.BukkitPermissionRegistry;
|
||||||
import tc.oc.commons.bukkit.permissions.PermissionRegistry;
|
import tc.oc.commons.bukkit.permissions.PermissionRegistry;
|
||||||
import tc.oc.commons.core.inject.SingletonManifest;
|
import tc.oc.commons.core.inject.SingletonManifest;
|
||||||
import tc.oc.commons.core.logging.Loggers;
|
import tc.oc.commons.core.logging.Loggers;
|
||||||
import tc.oc.commons.core.server.MinecraftServerManifest;
|
|
||||||
import tc.oc.commons.core.plugin.PluginResolver;
|
import tc.oc.commons.core.plugin.PluginResolver;
|
||||||
import tc.oc.minecraft.VersionInspector;
|
import tc.oc.commons.core.server.MinecraftServerManifest;
|
||||||
|
|
||||||
public class BukkitServerManifest extends SingletonManifest {
|
public class BukkitServerManifest extends SingletonManifest {
|
||||||
|
|
||||||
|
@ -40,10 +37,6 @@ public class BukkitServerManifest extends SingletonManifest {
|
||||||
bind(BossBarFactory.class).to(BossBarFactoryImpl.class);
|
bind(BossBarFactory.class).to(BossBarFactoryImpl.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides VersionInspector versionInspector(Server server) {
|
|
||||||
return new BukkitVersionInspector(server);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides @Named("serverRoot")
|
@Provides @Named("serverRoot")
|
||||||
File serverRootFile() {
|
File serverRootFile() {
|
||||||
return new File(".").getAbsoluteFile();
|
return new File(".").getAbsoluteFile();
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
package tc.oc.commons.bungee.inject;
|
package tc.oc.commons.bungee.inject;
|
||||||
|
|
||||||
import com.google.inject.Provides;
|
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
import net.md_5.bungee.api.CommandSender;
|
import net.md_5.bungee.api.CommandSender;
|
||||||
import net.md_5.bungee.api.plugin.Plugin;
|
|
||||||
import tc.oc.bungee.configuration.YamlConfigurationLoader;
|
|
||||||
import tc.oc.commons.bungee.commands.BungeeCommandRegistry;
|
import tc.oc.commons.bungee.commands.BungeeCommandRegistry;
|
||||||
import tc.oc.commons.bungee.scheduler.BungeeSchedulerManifest;
|
import tc.oc.commons.bungee.scheduler.BungeeSchedulerManifest;
|
||||||
import tc.oc.commons.core.commands.CommandRegistry;
|
import tc.oc.commons.core.commands.CommandRegistry;
|
||||||
|
@ -12,7 +9,6 @@ import tc.oc.commons.core.commands.CommandRegistryImpl;
|
||||||
import tc.oc.commons.core.inject.HybridManifest;
|
import tc.oc.commons.core.inject.HybridManifest;
|
||||||
import tc.oc.commons.core.plugin.MinecraftPluginManifest;
|
import tc.oc.commons.core.plugin.MinecraftPluginManifest;
|
||||||
import tc.oc.commons.core.plugin.PluginFacetManifest;
|
import tc.oc.commons.core.plugin.PluginFacetManifest;
|
||||||
import tc.oc.commons.core.plugin.PluginScoped;
|
|
||||||
|
|
||||||
public class BungeePluginManifest extends HybridManifest {
|
public class BungeePluginManifest extends HybridManifest {
|
||||||
|
|
||||||
|
@ -25,12 +21,5 @@ public class BungeePluginManifest extends HybridManifest {
|
||||||
|
|
||||||
bind(CommandRegistry.class).to(BungeeCommandRegistry.class);
|
bind(CommandRegistry.class).to(BungeeCommandRegistry.class);
|
||||||
bind(new TypeLiteral<CommandRegistryImpl<CommandSender>>(){}).to(BungeeCommandRegistry.class);
|
bind(new TypeLiteral<CommandRegistryImpl<CommandSender>>(){}).to(BungeeCommandRegistry.class);
|
||||||
|
|
||||||
bind(tc.oc.minecraft.api.configuration.Configuration.class).to(net.md_5.bungee.config.Configuration.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides @PluginScoped
|
|
||||||
net.md_5.bungee.config.Configuration configuration(Plugin plugin) {
|
|
||||||
return new YamlConfigurationLoader(plugin).loadConfig();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,14 @@
|
||||||
package tc.oc.commons.bungee.inject;
|
package tc.oc.commons.bungee.inject;
|
||||||
|
|
||||||
import com.google.inject.Provides;
|
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
|
||||||
import net.md_5.bungee.api.plugin.Plugin;
|
import net.md_5.bungee.api.plugin.Plugin;
|
||||||
import tc.oc.bungee.BungeeVersionInspector;
|
|
||||||
import tc.oc.commons.bungee.chat.BungeeAudiences;
|
import tc.oc.commons.bungee.chat.BungeeAudiences;
|
||||||
import tc.oc.commons.bungee.logging.BungeeLoggerFactory;
|
import tc.oc.commons.bungee.logging.BungeeLoggerFactory;
|
||||||
import tc.oc.commons.bungee.plugin.BungeePluginResolver;
|
import tc.oc.commons.bungee.plugin.BungeePluginResolver;
|
||||||
import tc.oc.commons.core.inject.SingletonManifest;
|
import tc.oc.commons.core.inject.SingletonManifest;
|
||||||
import tc.oc.commons.core.logging.Loggers;
|
import tc.oc.commons.core.logging.Loggers;
|
||||||
import tc.oc.commons.core.server.MinecraftServerManifest;
|
|
||||||
import tc.oc.commons.core.plugin.PluginResolver;
|
import tc.oc.commons.core.plugin.PluginResolver;
|
||||||
import tc.oc.minecraft.VersionInspector;
|
import tc.oc.commons.core.server.MinecraftServerManifest;
|
||||||
|
|
||||||
public class BungeeServerManifest extends SingletonManifest {
|
public class BungeeServerManifest extends SingletonManifest {
|
||||||
@Override
|
@Override
|
||||||
|
@ -24,9 +20,4 @@ public class BungeeServerManifest extends SingletonManifest {
|
||||||
bind(tc.oc.commons.core.chat.Audiences.class).to(tc.oc.commons.bungee.chat.Audiences.class);
|
bind(tc.oc.commons.core.chat.Audiences.class).to(tc.oc.commons.bungee.chat.Audiences.class);
|
||||||
bind(tc.oc.commons.bungee.chat.Audiences.class).to(BungeeAudiences.class);
|
bind(tc.oc.commons.bungee.chat.Audiences.class).to(BungeeAudiences.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
|
||||||
VersionInspector versionInspector(ProxyServer server) {
|
|
||||||
return new BungeeVersionInspector(server);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,10 +190,7 @@
|
||||||
<include>org.ocpsoft.prettytime:prettytime</include>
|
<include>org.ocpsoft.prettytime:prettytime</include>
|
||||||
<include>org.javassist:javassist</include>
|
<include>org.javassist:javassist</include>
|
||||||
<include>cglib:cglib</include>
|
<include>cglib:cglib</include>
|
||||||
|
<include>tc.oc:raven-minecraft-core</include>
|
||||||
<!-- Raven depends on this and does not shade it, so we have to -->
|
|
||||||
<include>com.fasterxml.jackson.core:jackson-core</include>
|
|
||||||
|
|
||||||
<include>com.sk89q:command-framework-core</include>
|
<include>com.sk89q:command-framework-core</include>
|
||||||
</includes>
|
</includes>
|
||||||
</artifactSet>
|
</artifactSet>
|
||||||
|
|
Loading…
Reference in New Issue