first commit
Build AsminVoicechat / prepare-release (push) Successful in 14s
Build AsminVoicechat / build-and-test (17) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (18) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (19) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (20) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (21) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (22) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (23) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (24) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (25) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (26) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (27-ea) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (16) (push) Canceled after 38s
Build AsminVoicechat / prepare-release (push) Successful in 14s
Build AsminVoicechat / build-and-test (17) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (18) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (19) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (20) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (21) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (22) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (23) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (24) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (25) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (26) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (27-ea) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (16) (push) Canceled after 38s
This commit is contained in:
commit
bbccd4a815
454 files changed
+45050
No files matched your search
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.mojang.brigadier.arguments.ArgumentType
|
||||
* com.mojang.brigadier.arguments.StringArgumentType
|
||||
* com.mojang.brigadier.builder.ArgumentBuilder
|
||||
* com.mojang.brigadier.builder.LiteralArgumentBuilder
|
||||
* com.mojang.brigadier.builder.RequiredArgumentBuilder
|
||||
* com.mojang.brigadier.suggestion.SuggestionProvider
|
||||
*/
|
||||
package de.maxhenkel.voicechat.integration.commodore;
|
||||
|
||||
import com.mojang.brigadier.arguments.ArgumentType;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.builder.ArgumentBuilder;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import com.mojang.brigadier.builder.RequiredArgumentBuilder;
|
||||
import com.mojang.brigadier.suggestion.SuggestionProvider;
|
||||
import de.maxhenkel.voicechat.Voicechat;
|
||||
import de.maxhenkel.voicechat.commodore.Commodore;
|
||||
import de.maxhenkel.voicechat.integration.commodore.GroupNameSuggestionProvider;
|
||||
import de.maxhenkel.voicechat.integration.commodore.MissingArgumentTypeException;
|
||||
|
||||
public class CommodoreCommands {
|
||||
public static void registerCompletions(Commodore commodore) throws MissingArgumentTypeException {
|
||||
ArgumentType<?> playerArgument = CommodoreCommands.playerArgument();
|
||||
ArgumentType<?> uuidArgument = CommodoreCommands.uuidArgument();
|
||||
if (playerArgument == null || uuidArgument == null) {
|
||||
throw new MissingArgumentTypeException("Could not acquire argument types");
|
||||
}
|
||||
LiteralArgumentBuilder literalBuilder = (LiteralArgumentBuilder)((LiteralArgumentBuilder)((LiteralArgumentBuilder)((LiteralArgumentBuilder)((LiteralArgumentBuilder)((LiteralArgumentBuilder)((LiteralArgumentBuilder)((LiteralArgumentBuilder)LiteralArgumentBuilder.literal((String)"voicechat").then((ArgumentBuilder)LiteralArgumentBuilder.literal((String)"help"))).then(LiteralArgumentBuilder.literal((String)"test").then((ArgumentBuilder)RequiredArgumentBuilder.argument((String)"target", playerArgument)))).then(LiteralArgumentBuilder.literal((String)"invite").then((ArgumentBuilder)RequiredArgumentBuilder.argument((String)"target", playerArgument)))).then(LiteralArgumentBuilder.literal((String)"join").then((ArgumentBuilder)RequiredArgumentBuilder.argument((String)"group_id", uuidArgument)))).then(LiteralArgumentBuilder.literal((String)"join").then(RequiredArgumentBuilder.argument((String)"group_id", uuidArgument).then((ArgumentBuilder)RequiredArgumentBuilder.argument((String)"password", (ArgumentType)StringArgumentType.string()))))).then(LiteralArgumentBuilder.literal((String)"join").then((ArgumentBuilder)RequiredArgumentBuilder.argument((String)"group_name", (ArgumentType)StringArgumentType.string()).suggests((SuggestionProvider)GroupNameSuggestionProvider.INSTANCE)))).then(LiteralArgumentBuilder.literal((String)"join").then(RequiredArgumentBuilder.argument((String)"group_name", (ArgumentType)StringArgumentType.string()).suggests((SuggestionProvider)GroupNameSuggestionProvider.INSTANCE).then((ArgumentBuilder)RequiredArgumentBuilder.argument((String)"password", (ArgumentType)StringArgumentType.string()))))).then((ArgumentBuilder)LiteralArgumentBuilder.literal((String)"leave"));
|
||||
commodore.register(literalBuilder);
|
||||
}
|
||||
|
||||
private static ArgumentType<?> playerArgument() {
|
||||
return Voicechat.compatibility.playerArgument();
|
||||
}
|
||||
|
||||
private static ArgumentType<?> uuidArgument() {
|
||||
return Voicechat.compatibility.uuidArgument();
|
||||
}
|
||||
}
|
||||
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* com.mojang.brigadier.context.CommandContext
|
||||
* com.mojang.brigadier.suggestion.SuggestionProvider
|
||||
* com.mojang.brigadier.suggestion.Suggestions
|
||||
* com.mojang.brigadier.suggestion.SuggestionsBuilder
|
||||
*/
|
||||
package de.maxhenkel.voicechat.integration.commodore;
|
||||
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.suggestion.SuggestionProvider;
|
||||
import com.mojang.brigadier.suggestion.Suggestions;
|
||||
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
|
||||
import de.maxhenkel.voicechat.Voicechat;
|
||||
import de.maxhenkel.voicechat.voice.server.Group;
|
||||
import de.maxhenkel.voicechat.voice.server.Server;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class GroupNameSuggestionProvider
|
||||
implements SuggestionProvider<Object> {
|
||||
public static final GroupNameSuggestionProvider INSTANCE = new GroupNameSuggestionProvider();
|
||||
|
||||
public CompletableFuture<Suggestions> getSuggestions(CommandContext<Object> context, SuggestionsBuilder builder) {
|
||||
Server server = Voicechat.SERVER.getServer();
|
||||
if (server == null) {
|
||||
return builder.buildFuture();
|
||||
}
|
||||
server.getGroupManager().getGroups().values().stream().map(Group::getName).distinct().map(s -> {
|
||||
if (s.contains(" ")) {
|
||||
return String.format("\"%s\"", s);
|
||||
}
|
||||
return s;
|
||||
}).forEach(arg_0 -> ((SuggestionsBuilder)builder).suggest(arg_0));
|
||||
return builder.buildFuture();
|
||||
}
|
||||
}
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package de.maxhenkel.voicechat.integration.commodore;
|
||||
|
||||
public class MissingArgumentTypeException
|
||||
extends Exception {
|
||||
public MissingArgumentTypeException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.annotation.Nullable
|
||||
* me.clip.placeholderapi.expansion.PlaceholderExpansion
|
||||
* org.bukkit.entity.Player
|
||||
*/
|
||||
package de.maxhenkel.voicechat.integration.placeholderapi;
|
||||
|
||||
import de.maxhenkel.voicechat.Voicechat;
|
||||
import de.maxhenkel.voicechat.voice.common.PlayerState;
|
||||
import de.maxhenkel.voicechat.voice.server.Server;
|
||||
import javax.annotation.Nullable;
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class VoicechatExpansion
|
||||
extends PlaceholderExpansion {
|
||||
public String getIdentifier() {
|
||||
return "voicechat";
|
||||
}
|
||||
|
||||
public String getAuthor() {
|
||||
return String.join((CharSequence)", ", Voicechat.INSTANCE.getDescription().getAuthors());
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return Voicechat.INSTANCE.getDescription().getVersion();
|
||||
}
|
||||
|
||||
public boolean persist() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String onPlaceholderRequest(Player player, String params) {
|
||||
if (player == null) {
|
||||
return super.onPlaceholderRequest(player, params);
|
||||
}
|
||||
if (params.equalsIgnoreCase("installed")) {
|
||||
return Voicechat.SERVER.isCompatible(player) ? Voicechat.TRANSLATIONS.placeholderVoicechatInstalled.get() : "";
|
||||
}
|
||||
if (params.equalsIgnoreCase("not_installed")) {
|
||||
return !Voicechat.SERVER.isCompatible(player) ? Voicechat.TRANSLATIONS.placeholderVoicechatNotInstalled.get() : "";
|
||||
}
|
||||
if (params.equalsIgnoreCase("disabled")) {
|
||||
Server server = Voicechat.SERVER.getServer();
|
||||
if (server == null) {
|
||||
return "";
|
||||
}
|
||||
PlayerState state = server.getPlayerStateManager().getState(player.getUniqueId());
|
||||
if (state == null) {
|
||||
return "";
|
||||
}
|
||||
if (!state.isDisabled()) {
|
||||
return "";
|
||||
}
|
||||
return Voicechat.TRANSLATIONS.placeholderVoicechatDisabled.get();
|
||||
}
|
||||
return super.onPlaceholderRequest(player, params);
|
||||
}
|
||||
}
|
||||
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.annotation.Nullable
|
||||
*/
|
||||
package de.maxhenkel.voicechat.integration.viaversion;
|
||||
|
||||
import de.maxhenkel.voicechat.Voicechat;
|
||||
import de.maxhenkel.voicechat.util.Key;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ViaVersionCompatibility {
|
||||
public static void register() throws Exception {
|
||||
Class<?> protocol113to1122 = ViaVersionCompatibility.getClass("com.viaversion.viaversion.protocols.protocol1_13to1_12_2.Protocol1_13To1_12_2");
|
||||
if (protocol113to1122 != null) {
|
||||
ViaVersionCompatibility.registerPackets(protocol113to1122);
|
||||
return;
|
||||
}
|
||||
Class<?> protocol1122to113 = ViaVersionCompatibility.getClass("com.viaversion.viaversion.protocols.v1_12_2to1_13.Protocol1_12_2To1_13");
|
||||
if (protocol1122to113 != null) {
|
||||
ViaVersionCompatibility.registerPackets(protocol1122to113);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerPackets(Class<?> protocolClass) throws Exception {
|
||||
Field mappingsField = protocolClass.getDeclaredField("MAPPINGS");
|
||||
Object mappings = mappingsField.get(null);
|
||||
Method getChannelMappings = mappings.getClass().getDeclaredMethod("getChannelMappings", new Class[0]);
|
||||
Object mappingMap = getChannelMappings.invoke(mappings, new Object[0]);
|
||||
Method put = mappingMap.getClass().getDeclaredMethod("put", Object.class, Object.class);
|
||||
for (String id : Voicechat.netManager.getPackets()) {
|
||||
Key key = Key.parse(id);
|
||||
put.invoke(mappingMap, String.format("%s:%s", "vc", key.getValue()), String.format("%s:%s", "voicechat", key.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static Class<?> getClass(String name) {
|
||||
try {
|
||||
return Class.forName(name);
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user