Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/proxy feature parity #221

Merged
merged 4 commits into from
Nov 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified docs/builds/OpenAudioMc-latest.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion plugin/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>com.craftmend.openaudiomc</groupId>
<artifactId>OpenAudioMc</artifactId>
<name>OpenAudioMc</name>
<version>6.5.7.2</version>
<version>6.5.8</version>
<description>The OpenAudioMc Java plugin and Api</description>
<url>https://craftmend.com/</url>
<build>
Expand Down
13 changes: 6 additions & 7 deletions plugin/notepad.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Changelog since release:
- Fixed webrtc
- You can now transfer addons
- Added aliases in the registry api
- Fixed voice issues
- Added admin notifications
- Automatic client checks
-
- Rewrite proxy platforms
- Rewrite command handlers
- Make all Player/Console interactions generic
- Implement "User"
- Dropped the old "OpenAudioApi"
- Drop old API
2 changes: 1 addition & 1 deletion plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.craftmend.openaudiomc</groupId>
<artifactId>OpenAudioMc</artifactId>
<version>6.5.7.2</version>
<version>6.5.8</version>
<packaging>jar</packaging>

<name>OpenAudioMc</name>
Expand Down
2 changes: 1 addition & 1 deletion plugin/protocol/static-resources/project_status.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"response": {
"versioning": {
"version_tag": "6.5.7.2",
"version_tag": "6.5.8",
"build_number": 359,
"version_importance": "&dRecommended",
"version_update_message": "This update contains some bug fixes for voicechat, and extra features to make the life of admins a bit easier"
Expand Down
2 changes: 1 addition & 1 deletion plugin/src/main/bash/data.bin
Original file line number Diff line number Diff line change
@@ -1 +1 @@
BUILD_NUM="366"
BUILD_NUM="373"
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import com.craftmend.openaudiomc.generic.commands.CommandService;
import com.craftmend.openaudiomc.generic.networking.rest.ServerEnvironment;
import com.craftmend.openaudiomc.generic.platform.interfaces.OpenAudioInvoker;
import com.craftmend.openaudiomc.generic.proxy.ProxyHostService;
import com.craftmend.openaudiomc.generic.proxy.interfaces.UserHooks;
import com.craftmend.openaudiomc.generic.resources.ResourceService;
import com.craftmend.openaudiomc.generic.service.Service;
import com.craftmend.openaudiomc.generic.service.ServiceManager;
Expand All @@ -16,7 +18,6 @@
import com.craftmend.openaudiomc.generic.migrations.MigrationWorker;
import com.craftmend.openaudiomc.generic.networking.interfaces.NetworkingService;
import com.craftmend.openaudiomc.generic.platform.Platform;
import com.craftmend.openaudiomc.generic.objects.OpenAudioApi;
import com.craftmend.openaudiomc.generic.craftmend.CraftmendService;
import com.craftmend.openaudiomc.generic.redis.RedisService;
import com.craftmend.openaudiomc.generic.platform.interfaces.TaskService;
Expand Down Expand Up @@ -54,7 +55,6 @@ public class OpenAudioMc {
/**
* Legacy and static instances (API, ENV, instance, build number and gson along with its type adapters)
*/
@Deprecated @Getter private static final OpenAudioApi api = new OpenAudioApi();
public static ServerEnvironment SERVER_ENVIRONMENT = ServerEnvironment.PRODUCTION;
@Getter private static OpenAudioMc instance;
public static final OpenAudioMcBuild BUILD = new OpenAudioMcBuild();
Expand Down Expand Up @@ -93,6 +93,7 @@ public OpenAudioMc(OpenAudioInvoker invoker) throws Exception {
// we want to use through dependency injection anyway
serviceManager.registerDependency(Configuration.class, invoker.getConfigurationProvider());
serviceManager.registerDependency(TaskService.class, invoker.getTaskProvider());
serviceManager.registerDependency(UserHooks.class, invoker.getUserHooks());

// migrate old config and data files between versions
new MigrationWorker().handleMigrations();
Expand All @@ -103,6 +104,7 @@ public OpenAudioMc(OpenAudioInvoker invoker) throws Exception {

// load core services in order
serviceManager.loadServices(
ProxyHostService.class,
MediaService.class, // processes outgoing URL's
TimeService.class, // processes remote or network timecodes and translates them for the client
ResourceService.class, // handles internal file storage/caching
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,9 @@
import com.craftmend.openaudiomc.OpenAudioMc;
import com.craftmend.openaudiomc.OpenAudioMcBuild;
import com.craftmend.openaudiomc.api.impl.event.enums.EventSupport;
import com.craftmend.openaudiomc.api.impl.event.events.StandaloneEventBroadcastEvent;
import com.craftmend.openaudiomc.api.interfaces.EventSupportFlag;
import com.craftmend.openaudiomc.bungee.OpenAudioMcBungee;
import com.craftmend.openaudiomc.bungee.modules.node.NodeManager;
import com.craftmend.openaudiomc.generic.logging.OpenAudioLogger;
import com.craftmend.openaudiomc.generic.networking.interfaces.NetworkingService;
import com.craftmend.openaudiomc.generic.node.packets.NetworkedEventPacket;
import com.craftmend.openaudiomc.generic.platform.Platform;
import com.craftmend.openaudiomc.spigot.modules.proxy.service.ProxyNetworkingService;
import com.craftmend.openaudiomc.velocity.OpenAudioMcVelocity;
import lombok.SneakyThrows;

import java.util.HashMap;
Expand Down Expand Up @@ -122,37 +115,6 @@ public <T extends AudioEvent> T fire(T event) {
}
}

if (event instanceof NetworkedAudioEvent) {
if (OpenAudioMc.getInstance().getPlatform() == Platform.SPIGOT) {
if (!OpenAudioMc.getInstance().getInvoker().isNodeServer()) {
// don't broadcast
return event;
}
}

// synchronize
NetworkedAudioEvent ne = (NetworkedAudioEvent) event;
if (ne.wasReceived) {
// don't broadcast it again
return event;
}
switch (OpenAudioMc.getInstance().getPlatform()) {
case BUNGEE:
OpenAudioMc.getService(NodeManager.class).getPacketManager().sendPacket(ne.networkedPlayer, new NetworkedEventPacket(ne));
break;
case VELOCITY:
OpenAudioMcVelocity.getInstance().getNodeManager().getPacketManager().sendPacket(ne.networkedPlayer, new NetworkedEventPacket(ne));
break;
case STANDALONE:
fire(new StandaloneEventBroadcastEvent(ne));
break;
case SPIGOT:
ProxyNetworkingService proxyNetworkingService = (ProxyNetworkingService) OpenAudioMc.getService(NetworkingService.class);
proxyNetworkingService.getPacketManager().sendPacket(ne.networkedPlayer, new NetworkedEventPacket(ne));
break;
}
}

return event;
}

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.craftmend.openaudiomc.api.interfaces;

import com.craftmend.openaudiomc.generic.hue.HueState;
import com.craftmend.openaudiomc.generic.networking.client.interfaces.PlayerContainer;
import com.craftmend.openaudiomc.generic.networking.client.objects.player.Publisher;
import com.craftmend.openaudiomc.generic.networking.client.objects.player.SerializableClient;
import com.craftmend.openaudiomc.generic.user.User;

import java.util.Map;

Expand All @@ -17,7 +17,7 @@ public interface Client {
/**
* @return Gets the basic player wrapper, wraps Bungeecord and Spigot
*/
PlayerContainer getPlayer();
User getUser();

/**
* @return Get the publisher, used to send session URL's to the client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
import com.craftmend.openaudiomc.bungee.modules.commands.BungeeCommandModule;
import com.craftmend.openaudiomc.bungee.modules.configuration.BungeeConfiguration;
import com.craftmend.openaudiomc.bungee.modules.dependency.BungeeDependencyService;
import com.craftmend.openaudiomc.bungee.modules.node.NodeManager;
import com.craftmend.openaudiomc.bungee.modules.player.PlayerManager;
import com.craftmend.openaudiomc.bungee.modules.platform.BungeeUserHooks;
import com.craftmend.openaudiomc.bungee.modules.player.listeners.PlayerConnectionListener;
import com.craftmend.openaudiomc.bungee.modules.scheduling.BungeeTaskService;
import com.craftmend.openaudiomc.generic.proxy.ProxyHostService;
import com.craftmend.openaudiomc.generic.proxy.interfaces.UserHooks;
import com.craftmend.openaudiomc.generic.state.StateService;
import com.craftmend.openaudiomc.generic.storage.interfaces.Configuration;
import com.craftmend.openaudiomc.generic.platform.interfaces.TaskService;
Expand All @@ -17,8 +19,9 @@
import com.craftmend.openaudiomc.generic.networking.interfaces.NetworkingService;
import com.craftmend.openaudiomc.generic.platform.Platform;
import com.craftmend.openaudiomc.generic.state.states.IdleState;
import com.craftmend.openaudiomc.spigot.modules.proxy.enums.ClientMode;
import com.craftmend.openaudiomc.spigot.modules.proxy.enums.OAClientMode;
import com.craftmend.openaudiomc.bungee.modules.punishments.LitebansIntegration;
import com.craftmend.openaudiomc.generic.proxy.messages.implementations.BungeeCordPacketManager;
import lombok.Getter;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.config.ListenerInfo;
Expand All @@ -45,21 +48,23 @@ public class OpenAudioMcBungee extends Plugin implements OpenAudioInvoker {

@Getter private static OpenAudioMcBungee instance;
private final Instant boot = Instant.now();
@Getter private BungeeCordPacketManager messageHandler;

@Override
public void onEnable() {
instance = this;
getProxy().getPluginManager().registerListener(this, new PlayerConnectionListener());

// setup core
try {
OpenAudioMc openAudioMc = new OpenAudioMc(this);
openAudioMc.getServiceManager().registerDependency(OpenAudioMcBungee.class, this);
this.messageHandler = new BungeeCordPacketManager(this, "openaudiomc:node");

openAudioMc.getServiceManager().loadServices(
BungeeDependencyService.class,
PlayerManager.class,
BungeeCommandModule.class,
NodeManager.class
ProxyHostService.class
);

openAudioMc.getServiceManager().getService(BungeeDependencyService.class)
Expand Down Expand Up @@ -107,7 +112,7 @@ public Class<? extends NetworkingService> getServiceClass() {
return forced;
}

return ClientMode.STAND_ALONE.getServiceClass();
return OAClientMode.STAND_ALONE.getServiceClass();
}

@Override
Expand Down Expand Up @@ -141,4 +146,9 @@ public int getServerPort() {
return -1;
}

@Override
public UserHooks getUserHooks() {
return new BungeeUserHooks();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
import com.craftmend.openaudiomc.OpenAudioMc;
import com.craftmend.openaudiomc.bungee.modules.player.objects.BungeePlayerSelector;

import com.craftmend.openaudiomc.generic.commands.CommandService;
import com.craftmend.openaudiomc.generic.commands.adapters.BungeeCommandSenderAdapter;
import com.craftmend.openaudiomc.generic.commands.helpers.CommandMiddewareExecutor;
import com.craftmend.openaudiomc.generic.commands.interfaces.CommandMiddleware;
import com.craftmend.openaudiomc.generic.commands.middleware.CatchCrashMiddleware;
import com.craftmend.openaudiomc.generic.commands.middleware.CatchLegalBindingMiddleware;
import com.craftmend.openaudiomc.generic.commands.middleware.CleanStateCheckMiddleware;
import com.craftmend.openaudiomc.generic.enviroment.MagicValue;
import com.craftmend.openaudiomc.generic.networking.interfaces.NetworkingService;
import com.craftmend.openaudiomc.generic.user.adapters.BungeeUserAdapter;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.plugin.Command;
Expand All @@ -33,7 +32,7 @@ public BungeeAudioCommand() {

@Override
public void execute(CommandSender sender, String[] args) {
if (CommandMiddewareExecutor.shouldBeCanceled(new BungeeCommandSenderAdapter(sender), null, commandMiddleware)) return;
if (CommandMiddewareExecutor.shouldBeCanceled(new BungeeUserAdapter(sender), null, commandMiddleware)) return;

if (sender instanceof ProxiedPlayer) {
ProxiedPlayer player = (ProxiedPlayer) sender;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.craftmend.openaudiomc.bungee.modules.commands.commands;

import com.craftmend.openaudiomc.OpenAudioMc;
import com.craftmend.openaudiomc.generic.commands.adapters.BungeeCommandSenderAdapter;
import com.craftmend.openaudiomc.generic.commands.helpers.CommandMiddewareExecutor;
import com.craftmend.openaudiomc.generic.commands.interfaces.CommandMiddleware;
import com.craftmend.openaudiomc.generic.commands.middleware.CatchCrashMiddleware;
import com.craftmend.openaudiomc.generic.commands.middleware.CatchLegalBindingMiddleware;
import com.craftmend.openaudiomc.generic.commands.middleware.CleanStateCheckMiddleware;
import com.craftmend.openaudiomc.generic.networking.interfaces.NetworkingService;
import com.craftmend.openaudiomc.generic.user.adapters.BungeeUserAdapter;
import com.craftmend.openaudiomc.generic.storage.enums.StorageKey;
import com.craftmend.openaudiomc.generic.networking.client.objects.player.ClientConnection;
import com.craftmend.openaudiomc.generic.platform.Platform;
Expand Down Expand Up @@ -35,7 +35,7 @@ public BungeeVolumeCommand() {
*/
@Override
public void execute(CommandSender sender, String[] args) {
if (CommandMiddewareExecutor.shouldBeCanceled(new BungeeCommandSenderAdapter(sender), null, commandMiddleware))
if (CommandMiddewareExecutor.shouldBeCanceled(new BungeeUserAdapter(sender), null, commandMiddleware))
return;

if (!(sender instanceof ProxiedPlayer)) {
Expand Down
Loading