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
79 lines
2.4 KiB
Java
79 lines
2.4 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* com.mojang.brigadier.arguments.ArgumentType
|
|
* javax.annotation.Nullable
|
|
* org.bukkit.entity.Player
|
|
*/
|
|
package de.maxhenkel.voicechat.compatibility;
|
|
|
|
import com.mojang.brigadier.arguments.ArgumentType;
|
|
import de.maxhenkel.voicechat.FallbackTranslations;
|
|
import de.maxhenkel.voicechat.Version;
|
|
import de.maxhenkel.voicechat.compatibility.BaseCompatibility;
|
|
import de.maxhenkel.voicechat.util.Key;
|
|
import javax.annotation.Nullable;
|
|
import org.bukkit.entity.Player;
|
|
|
|
public class FallbackCompatibility
|
|
extends BaseCompatibility {
|
|
public static final FallbackCompatibility INSTANCE = new FallbackCompatibility();
|
|
|
|
@Override
|
|
public void sendTranslationMessage(Player player, String key, String ... args) {
|
|
player.sendMessage(FallbackCompatibility.fallbackTranslation(key, args));
|
|
}
|
|
|
|
@Override
|
|
public void sendStatusMessage(Player player, String key, String ... args) {
|
|
this.sendTranslationMessage(player, key, args);
|
|
}
|
|
|
|
@Override
|
|
public void sendInviteMessage(Player player, Player commandSender, String groupName, String joinCommand) {
|
|
this.sendTranslationMessage(player, "message.voicechat.invite", commandSender.getName(), groupName, "");
|
|
}
|
|
|
|
@Override
|
|
public void sendIncompatibleMessage(Player player, String pluginVersion, String pluginName) {
|
|
this.sendTranslationMessage(player, "message.voicechat.incompatible_version", pluginVersion, pluginName);
|
|
}
|
|
|
|
@Override
|
|
public Key createNamespacedKey(String key) {
|
|
Version version = Version.getVersion();
|
|
if (version == null) {
|
|
return super.createNamespacedKey(key);
|
|
}
|
|
if (version.getMajor() != 1) {
|
|
return super.createNamespacedKey(key);
|
|
}
|
|
if (version.getMinor() > 12) {
|
|
return super.createNamespacedKey(key);
|
|
}
|
|
return Key.of("vc", key);
|
|
}
|
|
|
|
@Override
|
|
@Nullable
|
|
public ArgumentType<?> playerArgument() {
|
|
return null;
|
|
}
|
|
|
|
@Override
|
|
@Nullable
|
|
public ArgumentType<?> uuidArgument() {
|
|
return null;
|
|
}
|
|
|
|
public static String fallbackTranslation(String key, String ... args) {
|
|
String rawTranslation = FallbackTranslations.FALLBACK_TRANSLATIONS.get(key);
|
|
if (rawTranslation == null) {
|
|
return key;
|
|
}
|
|
return String.format(rawTranslation, args);
|
|
}
|
|
}
|
|
|