Restore FingerprintViolationEvent with appropriate THIS IS F*CKING DEAD DELET WARNINGS.
Also, notify in UI if using legacy JDK without capability to read out security data from mod jars. Signed-off-by: cpw <cpw+github@weeksfamily.ca>
This commit is contained in:
parent
ae160cad12
commit
80baad974e
5 changed files with 71 additions and 2 deletions
|
@ -31,6 +31,7 @@ public class FMLEnvironment
|
|||
public static final Dist dist = FMLLoader.getDist();
|
||||
public static final String naming = FMLLoader.getNaming();
|
||||
public static final boolean production = FMLLoader.isProduction() || System.getProperties().containsKey("production");
|
||||
public static final boolean secureJarsEnabled = FMLLoader.isSecureJarEnabled();
|
||||
|
||||
static void setupInteropEnvironment(IEnvironment environment) {
|
||||
environment.computePropertyIfAbsent(IEnvironment.Keys.NAMING.get(), v->naming);
|
||||
|
|
|
@ -302,4 +302,8 @@ public class FMLLoader
|
|||
public static boolean isProduction() {
|
||||
return production;
|
||||
}
|
||||
|
||||
public static boolean isSecureJarEnabled() {
|
||||
return Launcher.INSTANCE.environment().getProperty(IEnvironment.Keys.SECURED_JARS_ENABLED.get()).orElse(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,9 @@ import java.util.function.Function;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import cpw.mods.modlauncher.Environment;
|
||||
import net.minecraft.util.text.*;
|
||||
import net.minecraftforge.fml.loading.FMLEnvironment;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
@ -461,8 +463,12 @@ public class ModListScreen extends Screen
|
|||
lines.add(null);
|
||||
lines.add(selectedMod.getDescription());
|
||||
lines.add(null);
|
||||
lines.add(ForgeI18n.parseMessage("fml.menu.mods.info.signature", selectedMod.getOwningFile().getCodeSigningFingerprint().orElse(ForgeI18n.parseMessage("fml.menu.mods.info.signature.unsigned"))));
|
||||
lines.add(ForgeI18n.parseMessage("fml.menu.mods.info.trust", selectedMod.getOwningFile().getTrustData().orElse(ForgeI18n.parseMessage("fml.menu.mods.info.trust.noauthority"))));
|
||||
if (FMLEnvironment.secureJarsEnabled) {
|
||||
lines.add(ForgeI18n.parseMessage("fml.menu.mods.info.signature", selectedMod.getOwningFile().getCodeSigningFingerprint().orElse(ForgeI18n.parseMessage("fml.menu.mods.info.signature.unsigned"))));
|
||||
lines.add(ForgeI18n.parseMessage("fml.menu.mods.info.trust", selectedMod.getOwningFile().getTrustData().orElse(ForgeI18n.parseMessage("fml.menu.mods.info.trust.noauthority"))));
|
||||
} else {
|
||||
lines.add(ForgeI18n.parseMessage("fml.menu.mods.info.securejardisabled"));
|
||||
}
|
||||
|
||||
if ((vercheck.status == VersionChecker.Status.OUTDATED || vercheck.status == VersionChecker.Status.BETA_OUTDATED) && vercheck.changes.size() > 0)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2020.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.event.lifecycle;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
|
||||
/**
|
||||
* DEPRECATED WITHOUT REPLACEMENT. REMOVE FROM YOUR CODE!!!
|
||||
* IT HAS NEVER BEEN FIRED IN 1.13+ AND WILL NEVER FIRE AGAIN!!!
|
||||
* FIRE.JPG FIRE.JPG FIRE.JPG
|
||||
* DELET THIS
|
||||
*/
|
||||
@Deprecated
|
||||
public class FMLFingerprintViolationEvent extends ModLifecycleEvent
|
||||
{
|
||||
|
||||
private final boolean isDirectory;
|
||||
private final Set<String> fingerprints;
|
||||
private final File source;
|
||||
private final String expectedFingerprint;
|
||||
|
||||
public FMLFingerprintViolationEvent(boolean isDirectory, File source, ImmutableSet<String> fingerprints, String expectedFingerprint)
|
||||
{
|
||||
super(null);
|
||||
this.isDirectory = isDirectory;
|
||||
this.source = source;
|
||||
this.fingerprints = fingerprints;
|
||||
this.expectedFingerprint = expectedFingerprint;
|
||||
}
|
||||
|
||||
public boolean isDirectory() { return isDirectory; }
|
||||
public Set<String> getFingerprints() { return fingerprints; }
|
||||
public File getSource() { return source; }
|
||||
public String getExpectedFingerprint() { return expectedFingerprint; }
|
||||
}
|
|
@ -14,6 +14,7 @@
|
|||
"fml.menu.mods.info.authors":"Authors: {0}",
|
||||
"fml.menu.mods.info.displayurl":"Homepage: {0}",
|
||||
"fml.menu.mods.info.license":"License: {0}",
|
||||
"fml.menu.mods.info.securejardisabled": "Secure mod features disabled, update JDK",
|
||||
"fml.menu.mods.info.signature":"Signature: {0}",
|
||||
"fml.menu.mods.info.signature.unsigned":"UNSIGNED",
|
||||
"fml.menu.mods.info.trust": "Trust: {0}",
|
||||
|
|
Loading…
Reference in a new issue