-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 45-suggestion-add-tests
# Conflicts: # core/pom.xml
- Loading branch information
Showing
60 changed files
with
733 additions
and
369 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "maven" # See documentation for possible values | ||
directory: "/" # Location of package manifests | ||
schedule: | ||
interval: "daily" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
api/src/main/java/com/bivashy/auth/api/hook/LimboPluginHook.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.bivashy.auth.api.hook; | ||
|
||
import com.bivashy.auth.api.server.proxy.ProxyServer; | ||
|
||
public interface LimboPluginHook extends PluginHook { | ||
|
||
ProxyServer createServer(String serverName); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
.../src/main/java/me/mastercapexd/auth/bungee/hooks/nanolimbo/BungeeNanoLimboPluginHook.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package me.mastercapexd.auth.bungee.hooks.nanolimbo; | ||
|
||
import java.net.SocketAddress; | ||
import java.util.stream.IntStream; | ||
|
||
import com.bivashy.auth.api.AuthPlugin; | ||
import com.bivashy.auth.api.config.PluginConfig; | ||
import com.bivashy.auth.api.hook.LimboPluginHook; | ||
|
||
import me.mastercapexd.auth.bungee.BungeeAuthPluginBootstrap; | ||
import me.mastercapexd.auth.bungee.server.BungeeServer; | ||
import me.mastercapexd.auth.hooks.nanolimbo.NanoLimboProvider; | ||
import net.md_5.bungee.api.ProxyServer; | ||
import net.md_5.bungee.api.config.ServerInfo; | ||
import net.md_5.bungee.api.event.ServerConnectEvent; | ||
import net.md_5.bungee.api.event.ServerConnectEvent.Reason; | ||
import net.md_5.bungee.api.plugin.Listener; | ||
import net.md_5.bungee.event.EventHandler; | ||
import net.md_5.bungee.event.EventPriority; | ||
|
||
public class BungeeNanoLimboPluginHook implements LimboPluginHook, Listener { | ||
|
||
private final int[] limboPorts; | ||
private NanoLimboProvider provider; | ||
|
||
public BungeeNanoLimboPluginHook(IntStream limboPortRange) { | ||
this.limboPorts = limboPortRange.toArray(); | ||
if (!canHook()) | ||
return; | ||
this.provider = new BungeeNanoLimboProvider(ProxyServer.getInstance().getPluginManager().getPlugin("NanoLimboBungee").getClass().getClassLoader()); | ||
ProxyServer.getInstance().getPluginManager().registerListener(BungeeAuthPluginBootstrap.getInstance(), this); | ||
} | ||
|
||
@Override | ||
public com.bivashy.auth.api.server.proxy.ProxyServer createServer(String serverName) { | ||
SocketAddress address = provider.findAvailableAddress(limboPorts).orElseThrow( | ||
() -> new IllegalStateException("Cannot find available port for limbo server!")); | ||
provider.createAndStartLimbo(address); | ||
ServerInfo serverInfo = ProxyServer.getInstance().constructServerInfo(serverName, address, "", false); | ||
ProxyServer.getInstance().getConfig().getServers().put(serverInfo.getName(), serverInfo); | ||
return new BungeeServer(serverInfo); | ||
} | ||
|
||
@EventHandler(priority = EventPriority.HIGHEST) | ||
public void onServerChoose(ServerConnectEvent event) { | ||
// TODO: Implement ServerConnectEvent in the InitialServerManagement | ||
if (event.getReason() != Reason.JOIN_PROXY) | ||
return; | ||
PluginConfig config = AuthPlugin.instance().getConfig(); | ||
event.setTarget(config.findServerInfo(config.getAuthServers()).asProxyServer().as(BungeeServer.class).getServerInfo()); | ||
} | ||
|
||
@Override | ||
public boolean canHook() { | ||
return ProxyServer.getInstance().getPluginManager().getPlugin("NanoLimboBungee") != null; | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
...ee/src/main/java/me/mastercapexd/auth/bungee/hooks/nanolimbo/BungeeNanoLimboProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package me.mastercapexd.auth.bungee.hooks.nanolimbo; | ||
|
||
import me.mastercapexd.auth.hooks.nanolimbo.NanoLimboProvider; | ||
import ua.nanit.limbo.server.data.InfoForwarding; | ||
|
||
public class BungeeNanoLimboProvider implements NanoLimboProvider { | ||
|
||
private final ClassLoader classLoader; | ||
|
||
public BungeeNanoLimboProvider(ClassLoader classLoader) { | ||
this.classLoader = classLoader; | ||
} | ||
|
||
@Override | ||
public InfoForwarding createForwarding() { | ||
return FORWARDING_FACTORY.legacy(); | ||
} | ||
|
||
@Override | ||
public ClassLoader classLoader() { | ||
return classLoader; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
name: mcAuth | ||
main: me.mastercapexd.auth.bungee.BungeeAuthPluginBootstrap | ||
version: ${project.version} | ||
softDepends: [VK-API,JavaTelegramBotApi] | ||
softDepends: | ||
- VK-API | ||
- JavaTelegramBotApi | ||
- NanoLimboBungee | ||
author: bivashy, MasterCapeXD |
Oops, something went wrong.