mirror of
https://github.com/Dreeam-qwq/Gale.git
synced 2025-12-22 08:19:31 +00:00
73 lines
3.4 KiB
Diff
73 lines
3.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
|
Date: Mon, 26 Dec 2022 00:34:43 +0100
|
|
Subject: [PATCH] Global EULA file
|
|
|
|
License: MIT (https://opensource.org/licenses/MIT)
|
|
Gale - https://galemc.org
|
|
|
|
This patch is based on the following patch:
|
|
"Global Eula file"
|
|
By: tr7zw <tr7zw@live.de>
|
|
As part of: YAPFA (https://github.com/tr7zw/YAPFA)
|
|
Licensed under: MIT (https://opensource.org/licenses/MIT)
|
|
|
|
* YAPFA copyright *
|
|
|
|
Copyright 2020 tr7zw
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
|
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/Eula.java b/src/main/java/net/minecraft/server/Eula.java
|
|
index 4f12ee62a381f87419c72f12a7c155a7b403d207..f8d6f9b165929961d23bc18a6044973405c1d633 100644
|
|
--- a/src/main/java/net/minecraft/server/Eula.java
|
|
+++ b/src/main/java/net/minecraft/server/Eula.java
|
|
@@ -17,13 +17,30 @@ public class Eula {
|
|
|
|
public Eula(Path eulaFile) {
|
|
this.file = eulaFile;
|
|
- this.agreed = SharedConstants.IS_RUNNING_IN_IDE || this.readFile();
|
|
+ this.agreed = SharedConstants.IS_RUNNING_IN_IDE || this.readGlobalFile() || this.readFile(); // Gale - YAPFA - global EULA file
|
|
}
|
|
|
|
private boolean readFile() {
|
|
+ // Gale start - YAPFA - global EULA file
|
|
+ return readFile(this.file);
|
|
+ }
|
|
+
|
|
+ private boolean readGlobalFile() {
|
|
+ try {
|
|
+ Path globalFile = Path.of(System.getProperty("user.home"), "eula.txt");
|
|
+ if (globalFile.toFile().exists()) {
|
|
+ return readFile(globalFile);
|
|
+ }
|
|
+ } catch (Throwable ignored) {
|
|
+ }
|
|
+ return false;
|
|
+ }
|
|
+
|
|
+ private boolean readFile(Path file) {
|
|
+ // Gale end - YAPFA - global EULA file
|
|
try {
|
|
boolean var3;
|
|
- try (InputStream inputStream = Files.newInputStream(this.file)) {
|
|
+ try (InputStream inputStream = Files.newInputStream(file)) { // Gale - YAPFA - global EULA file
|
|
Properties properties = new Properties();
|
|
properties.load(inputStream);
|
|
var3 = Boolean.parseBoolean(properties.getProperty("eula", "false"));
|
|
@@ -31,8 +48,10 @@ public class Eula {
|
|
|
|
return var3;
|
|
} catch (Exception var6) {
|
|
+ if (file == this.file) { // Gale - YAPFA - global EULA file
|
|
LOGGER.warn("Failed to load {}", this.file);
|
|
this.saveDefaults();
|
|
+ } // Gale - YAPFA - global EULA file
|
|
return false;
|
|
}
|
|
}
|