use of com.velocitypowered.api.plugin.PluginContainer in project Geyser by GeyserMC.
the class GeyserVelocityConfiguration method loadFloodgate.
public void loadFloodgate(GeyserVelocityPlugin plugin, ProxyServer proxyServer, File dataFolder) {
Optional<PluginContainer> floodgate = proxyServer.getPluginManager().getPlugin("floodgate");
Path floodgateDataPath = floodgate.isPresent() ? Paths.get("plugins/floodgate/") : null;
floodgateKeyPath = FloodgateKeyLoader.getKeyPath(this, floodgateDataPath, dataFolder.toPath(), plugin.getGeyserLogger());
}
use of com.velocitypowered.api.plugin.PluginContainer in project ViaVersion by ViaVersion.
the class VelocityPlugin method getDump.
@Override
public JsonObject getDump() {
JsonObject extra = new JsonObject();
List<PluginInfo> plugins = new ArrayList<>();
for (PluginContainer p : PROXY.getPluginManager().getPlugins()) {
plugins.add(new PluginInfo(true, p.getDescription().getName().orElse(p.getDescription().getId()), p.getDescription().getVersion().orElse("Unknown Version"), p.getInstance().isPresent() ? p.getInstance().get().getClass().getCanonicalName() : "Unknown", p.getDescription().getAuthors()));
}
extra.add("plugins", GsonUtil.getGson().toJsonTree(plugins));
extra.add("servers", GsonUtil.getGson().toJsonTree(ProtocolDetectorService.getDetectedIds()));
return extra;
}
use of com.velocitypowered.api.plugin.PluginContainer in project LibertyBans by A248.
the class VelocityCulpritFinderTest method findCulprit.
@Test
public void findCulprit(@Mock ProxyServer server, @Mock PluginManager pluginManager, @Mock PluginContainer pluginString, @Mock PluginContainer pluginOwnClass) {
class OwnClass {
}
{
when(server.getPluginManager()).thenReturn(pluginManager);
when(pluginManager.getPlugins()).thenReturn(List.of(pluginString, pluginOwnClass));
when(pluginString.getInstance()).thenAnswer((i) -> Optional.of("a".concat("b")));
setDescription(pluginString, "JDK", "0");
when(pluginOwnClass.getInstance()).thenAnswer((i) -> Optional.of(new OwnClass()));
setDescription(pluginOwnClass, "Self", "1");
}
CulpritFinder culpritFinder = new VelocityCulpritFinder(server);
assertEquals("JDK 0", culpritFinder.findCulprit(List.class));
assertEquals("Self 1", culpritFinder.findCulprit(getClass()));
}
Aggregations