Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-26 00:00:28 +01:00
Update unsupported software list
Dieser Commit ist enthalten in:
Ursprung
a8e475dbf0
Commit
26af09f2a4
@ -64,7 +64,7 @@ public interface ViaAPI<T> {
|
||||
* @return API version incremented with meaningful API changes
|
||||
*/
|
||||
default int apiVersion() {
|
||||
return 12;
|
||||
return 13;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -218,4 +218,12 @@ public interface ViaPlatform<T> {
|
||||
default Collection<UnsupportedSoftware> getUnsupportedSoftwareClasses() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the platform has a plugin/mod with the given name (even if disabled).
|
||||
*
|
||||
* @param name plugin or identifier
|
||||
* @return whether the platform has a plugin/mod with the given name
|
||||
*/
|
||||
boolean hasPlugin(String name);
|
||||
}
|
||||
|
@ -37,7 +37,8 @@ import com.viaversion.viaversion.bukkit.platform.BukkitViaLoader;
|
||||
import com.viaversion.viaversion.bukkit.platform.BukkitViaTask;
|
||||
import com.viaversion.viaversion.bukkit.util.NMSUtil;
|
||||
import com.viaversion.viaversion.dump.PluginInfo;
|
||||
import com.viaversion.viaversion.unsupported.UnsupportedSoftwareImpl;
|
||||
import com.viaversion.viaversion.unsupported.UnsupportedPlugin;
|
||||
import com.viaversion.viaversion.unsupported.UnsupportedServerSoftware;
|
||||
import com.viaversion.viaversion.util.GsonUtil;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -286,14 +287,22 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaPlatform<Player>
|
||||
@Override
|
||||
public final Collection<UnsupportedSoftware> getUnsupportedSoftwareClasses() {
|
||||
List<UnsupportedSoftware> list = new ArrayList<>(ViaPlatform.super.getUnsupportedSoftwareClasses());
|
||||
list.add(new UnsupportedSoftwareImpl.Builder().name("Yatopia").reason(UnsupportedSoftwareImpl.Reason.DANGEROUS_SERVER_SOFTWARE)
|
||||
list.add(new UnsupportedServerSoftware.Builder().name("Yatopia").reason(UnsupportedServerSoftware.Reason.DANGEROUS_SERVER_SOFTWARE)
|
||||
.addClassName("org.yatopiamc.yatopia.server.YatopiaConfig")
|
||||
.addClassName("net.yatopia.api.event.PlayerAttackEntityEvent")
|
||||
.addClassName("yatopiamc.org.yatopia.server.YatopiaConfig") // Only the best kind of software relocates its own classes to hide itself :tinfoilhat:
|
||||
.addMethod("org.bukkit.Server", "getLastTickTime").build());
|
||||
list.add(new UnsupportedPlugin.Builder().name("software to mess with message signing").reason(UnsupportedPlugin.Reason.SECURE_CHAT_BYPASS)
|
||||
.addPlugin("NoEncryption")
|
||||
.addPlugin("NoChatReports").build());
|
||||
return Collections.unmodifiableList(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPlugin(final String name) {
|
||||
return getServer().getPluginManager().getPlugin(name) != null;
|
||||
}
|
||||
|
||||
public boolean isLateBind() {
|
||||
return lateBind;
|
||||
}
|
||||
|
@ -205,4 +205,9 @@ public class BungeePlugin extends Plugin implements ViaPlatform<ProxiedPlayer>,
|
||||
public boolean isOldClientsAllowed() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPlugin(final String name) {
|
||||
return getProxy().getPluginManager().getPlugin(name) != null;
|
||||
}
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ public class ViaManagerImpl implements ViaManager {
|
||||
}
|
||||
}
|
||||
|
||||
private final void unsupportedSoftwareWarning() {
|
||||
private void unsupportedSoftwareWarning() {
|
||||
boolean found = false;
|
||||
for (UnsupportedSoftware software : platform.getUnsupportedSoftwareClasses()) {
|
||||
if (!software.findMatch()) {
|
||||
|
@ -0,0 +1,93 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2022 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.viaversion.unsupported;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.platform.UnsupportedSoftware;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public final class UnsupportedPlugin implements UnsupportedSoftware {
|
||||
|
||||
private final String name;
|
||||
private final List<String> identifiers;
|
||||
private final String reason;
|
||||
|
||||
public UnsupportedPlugin(final String name, final List<String> identifiers, final String reason) {
|
||||
Preconditions.checkNotNull(name);
|
||||
Preconditions.checkNotNull(reason);
|
||||
Preconditions.checkArgument(!identifiers.isEmpty());
|
||||
this.name = name;
|
||||
this.identifiers = Collections.unmodifiableList(identifiers);
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean findMatch() {
|
||||
for (final String identifier : identifiers) {
|
||||
if (Via.getPlatform().hasPlugin(identifier)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static final class Builder {
|
||||
|
||||
private final List<String> identifiers = new ArrayList<>();
|
||||
private String name;
|
||||
private String reason;
|
||||
|
||||
public Builder name(final String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder reason(final String reason) {
|
||||
this.reason = reason;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder addPlugin(final String identifier) {
|
||||
identifiers.add(identifier);
|
||||
return this;
|
||||
}
|
||||
|
||||
public UnsupportedPlugin build() {
|
||||
return new UnsupportedPlugin(name, identifiers, reason);
|
||||
}
|
||||
}
|
||||
|
||||
public static final class Reason {
|
||||
|
||||
public static final String SECURE_CHAT_BYPASS = "Instead of doing the obvious (or nothing at all), these kinds of plugins completely break chat message handling, usually then also breaking other plugins.";
|
||||
}
|
||||
}
|
@ -26,14 +26,17 @@ import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
public final class UnsupportedSoftwareImpl implements UnsupportedSoftware {
|
||||
public final class UnsupportedServerSoftware implements UnsupportedSoftware {
|
||||
|
||||
private final String name;
|
||||
private final List<String> classNames;
|
||||
private final List<UnsupportedMethods> methods;
|
||||
private final String reason;
|
||||
|
||||
public UnsupportedSoftwareImpl(String name, List<String> classNames, List<UnsupportedMethods> methods, String reason) {
|
||||
public UnsupportedServerSoftware(String name, List<String> classNames, List<UnsupportedMethods> methods, String reason) {
|
||||
Preconditions.checkNotNull(name);
|
||||
Preconditions.checkNotNull(reason);
|
||||
Preconditions.checkArgument(!classNames.isEmpty() || !methods.isEmpty());
|
||||
this.name = name;
|
||||
this.classNames = Collections.unmodifiableList(classNames);
|
||||
this.methods = Collections.unmodifiableList(methods);
|
||||
@ -51,7 +54,7 @@ public final class UnsupportedSoftwareImpl implements UnsupportedSoftware {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean findMatch() {
|
||||
public final boolean findMatch() {
|
||||
for (String className : classNames) {
|
||||
try {
|
||||
Class.forName(className);
|
||||
@ -100,9 +103,7 @@ public final class UnsupportedSoftwareImpl implements UnsupportedSoftware {
|
||||
}
|
||||
|
||||
public UnsupportedSoftware build() {
|
||||
Preconditions.checkNotNull(name);
|
||||
Preconditions.checkNotNull(reason);
|
||||
return new UnsupportedSoftwareImpl(name, classNames, methods, reason);
|
||||
return new UnsupportedServerSoftware(name, classNames, methods, reason);
|
||||
}
|
||||
}
|
||||
|
@ -137,4 +137,9 @@ public final class TestPlatform implements ViaPlatform {
|
||||
public boolean isOldClientsAllowed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPlugin(final String name) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -228,6 +228,11 @@ public class SpongePlugin implements ViaPlatform<Player> {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPlugin(final String name) {
|
||||
return game.pluginManager().plugin(name).isPresent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpongeViaAPI getApi() {
|
||||
return api;
|
||||
|
@ -239,6 +239,11 @@ public class VelocityPlugin implements ViaPlatform<Player> {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPlugin(final String name) {
|
||||
return proxy.getPluginManager().getPlugin(name).isPresent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.util.logging.Logger getLogger() {
|
||||
return logger;
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren