More works
This commit is contained in:
42
patches/server/0011-Add-global-eula-file-feature.patch
Normal file
42
patches/server/0011-Add-global-eula-file-feature.patch
Normal file
@@ -0,0 +1,42 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
Date: Sat, 25 Jul 2020 17:16:18 +0200
|
||||
Subject: [PATCH] Add global eula file feature
|
||||
|
||||
Original code by YatopiaMC, licensed under MIT
|
||||
You can find the original code on https://github.com/YatopiaMC/Yatopia
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Eula.java b/src/main/java/net/minecraft/server/Eula.java
|
||||
index 920a0e6540bc8b8ce34dfaf57d58c200013b7b2c..94f05d32304f8a8c2aa294318617851adc55988d 100644
|
||||
--- a/src/main/java/net/minecraft/server/Eula.java
|
||||
+++ b/src/main/java/net/minecraft/server/Eula.java
|
||||
@@ -16,12 +16,26 @@ 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 || globalEula() || this.readFile(eulaFile);
|
||||
}
|
||||
|
||||
- private boolean readFile() {
|
||||
+ // Yatopia start - global eula file
|
||||
+ private boolean globalEula() {
|
||||
+ java.io.File globalEula = new java.io.File(System.getProperty("user.home"), "eula.txt");
|
||||
+
|
||||
+ if (globalEula.exists()) {
|
||||
+ System.out.println("Loaded global eula file from " + globalEula.getAbsolutePath());
|
||||
+ return readFile(globalEula.toPath());
|
||||
+ } else {
|
||||
+ System.out.println("No global eula file found at " + globalEula.getAbsolutePath());
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Yatopia end
|
||||
+
|
||||
+ private boolean readFile(java.nio.file.Path path) {
|
||||
try {
|
||||
- InputStream inputStream = Files.newInputStream(this.file);
|
||||
+ InputStream inputStream = Files.newInputStream(path);
|
||||
|
||||
boolean var3;
|
||||
try {
|
||||
Reference in New Issue
Block a user