Copy the Dedicated server's EULA checking to main() function so it can exit earlier. Closes #3659, #3661

This commit is contained in:
LexManos 2018-05-20 11:21:05 -07:00
parent 0139a7baf2
commit f492e25bc9
2 changed files with 27 additions and 10 deletions

View file

@ -1,5 +1,14 @@
--- ../src-base/minecraft/net/minecraft/entity/ai/EntityAIHarvestFarmland.java
+++ ../src-work/minecraft/net/minecraft/entity/ai/EntityAIHarvestFarmland.java
@@ -29,7 +29,7 @@
{
if (this.field_179496_a <= 0)
{
- if (!this.field_179504_c.field_70170_p.func_82736_K().func_82766_b("mobGriefing"))
+ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_179504_c.field_70170_p, this.field_179504_c))
{
return false;
}
@@ -94,6 +94,12 @@
world.func_180501_a(blockpos, Blocks.field_185773_cZ.func_176223_P(), 3);
flag = true;
@ -13,12 +22,3 @@
}
if (flag)
@@ -29,7 +29,7 @@
{
if (this.field_179496_a <= 0)
{
- if (!this.field_179504_c.field_70170_p.func_82736_K().func_82766_b("mobGriefing"))
+ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_179504_c.field_70170_p, this.field_179504_c))
{
return false;
}

View file

@ -275,7 +275,24 @@
}
public CrashReport func_71230_b(CrashReport p_71230_1_)
@@ -1598,4 +1644,9 @@
@@ -1411,6 +1457,16 @@
@SideOnly(Side.SERVER)
public static void main(String[] p_main_0_)
{
+ //Forge: Copied from DedicatedServer.init as to run as early as possible, Old code left in place intentionally.
+ //Done in good faith with permission: https://github.com/MinecraftForge/MinecraftForge/issues/3659#issuecomment-390467028
+ ServerEula eula = new ServerEula(new File("eula.txt"));
+ if (!eula.func_154346_a())
+ {
+ field_147145_h.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info.");
+ eula.func_154348_b();
+ return;
+ }
+
Bootstrap.func_151354_b();
try
@@ -1598,4 +1654,9 @@
{
return this.field_175590_aa;
}