1
0
Fork 0
聪聪 2017-07-04 15:29:14 +08:00
commit 34b83733e5
13 changed files with 432 additions and 29 deletions

View File

@ -1,13 +1,13 @@
**[Join KCauldron's Discord!](https://discord.gg/0nuu0DLm3WJq1Z23)**
# KCauldron
### KCauldron - continuation of Cauldron minecraft server
[![Donate][donate_img]][donate_url][![Download KCauldron][download_img]][download_url]
**[加入KCauldronX交流群!](https://jq.qq.com/?_wv=1027&k=4BEK1SI)**
# KCauldronX
### KCauldronX - continuation of KCauldron minecraft server
![Donate][donate_img] [![Download KCauldronX][download_img]][download_url]
## Building KCauldron
## Building KCauldronX
* Ensure you are using Java JDK 8u101 or higher.
* Checkout project
* You can use IDE or clone from console:
`git clone https://gitlab.prok.pw/KCauldron/KCauldron.git`
`git clone https://git.xjboss.net/KC-RELOADED/KCauldronX.git`
* Init submodules
* Since this project is merger of two other we need both.
`git submodule update --init --recursive`
@ -32,13 +32,12 @@ If you're once checkout source - you not need to do it again
* Remove all unnecessary plugins and mods
* Reset all configs to default
If bug present - mod compatibility issue
* If you're using beta-release of KCauldron - check on latest stable
* All versions situated [there](https://repo.prok.pw/pw/prok/KCauldron/?C=M&O=D)
* If bug still present - KCauldron issue
* If you're using beta-release of KCauldronX - check on latest stable
* All versions situated [there](https://ci.xjboss.net/job/KCauldronX/)
* If bug still present - KCauldronX issue
* Make sure that similar issue not exists already
* Please fill [issue form](https://gitlab.prok.pw/Prototik/KCauldron/issues/new) else
* Please fill [issue form](https://git.xjboss.net/KC-RELOADED/KCauldronX/issues/new) else
[donate_url]: https://prok.pw/donate.html
[donate_img]: https://prok.pw/donate.png
[download_url]: https://prok.pw/downloads.html#pw.prok:KCauldron
[download_url]: https://ci.xjboss.net/job/KCauldronX/
[download_img]: https://prok.pw/download.png

View File

@ -54,11 +54,10 @@ minecraft {
mainClass = 'cpw.mods.fml.relauncher.ServerLaunchWrapper'
tweakClass = 'cpw.mods.fml.common.launcher.FMLTweaker'
installerVersion = "1.4"
srgExtra "PK: org/bukkit/craftbukkit org/bukkit/craftbukkit/v1_7_R4"
}
group = 'pw.prok'
ext.buildInfoCached = null;
def buildInfo(String key) {
@ -105,7 +104,7 @@ version = "${mcVersion}-${forgeVersion}.${revision}"
if (project.hasProperty('officialBuild')) println "Updated KCauldron version: ${version}"
launch4j {
jreMinVersion = '1.6.0'
jreMinVersion = '1.7.0'
}
configurations {

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,6 @@
#Fri Jun 30 19:05:28 CST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-bin.zip

160
gradlew vendored Executable file
View File

@ -0,0 +1,160 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

90
gradlew.bat vendored Normal file
View File

@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@ -1,10 +1,21 @@
--- ../src-base/minecraft/net/minecraft/server/dedicated/DedicatedServer.java
+++ ../src-work/minecraft/net/minecraft/server/dedicated/DedicatedServer.java
@@ -34,9 +34,19 @@
@@ -1,6 +1,7 @@
package net.minecraft.server.dedicated;
import cpw.mods.fml.common.FMLCommonHandler;
+import cpw.mods.fml.common.gameevent.PlayerEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.io.BufferedReader;
@@ -34,9 +35,23 @@
import net.minecraft.world.World;
import net.minecraft.world.WorldSettings;
import net.minecraft.world.WorldType;
+import net.minecraft.world.chunk.storage.AnvilSaveConverter;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.common.util.FakePlayer;
+import net.minecraftforge.event.ForgeEventFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -14,13 +25,14 @@
+
+import org.bukkit.craftbukkit.LoggerOutputStream;
+import org.bukkit.craftbukkit.SpigotTimings; // Spigot
+import org.bukkit.event.player.PlayerLoginEvent;
+import org.bukkit.event.server.ServerCommandEvent;
+// CraftBukkit end
+
@SideOnly(Side.SERVER)
public class DedicatedServer extends MinecraftServer implements IServer
{
@@ -44,7 +54,7 @@
@@ -44,7 +59,7 @@
public final List pendingCommandList = Collections.synchronizedList(new ArrayList());
private RConThreadQuery theRConThreadQuery;
private RConThreadMain theRConThreadMain;
@ -29,7 +41,7 @@
private ServerEula field_154332_n;
private boolean canSpawnStructures;
private WorldSettings.GameType gameType;
@@ -52,10 +62,13 @@
@@ -52,10 +67,13 @@
public static boolean allowPlayerLogins = false;
private static final String __OBFID = "CL_00001784";
@ -46,7 +58,7 @@
{
private static final String __OBFID = "CL_00001787";
{
@@ -82,31 +95,77 @@
@@ -82,31 +100,77 @@
};
}
@ -131,7 +143,7 @@
field_155771_h.info("Starting minecraft server version 1.7.10");
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L)
@@ -117,7 +176,7 @@
@@ -117,7 +181,7 @@
FMLCommonHandler.instance().onServerStart(this);
field_155771_h.info("Loading properties");
@ -140,7 +152,7 @@
this.field_154332_n = new ServerEula(new File("eula.txt"));
if (!this.field_154332_n.func_154346_a())
@@ -172,6 +231,18 @@
@@ -172,6 +236,18 @@
this.setServerPort(this.settings.getIntProperty("server-port", 25565));
}
@ -159,7 +171,7 @@
field_155771_h.info("Generating keypair");
this.setKeyPair(CryptManager.createNewKeyPair());
field_155771_h.info("Starting Minecraft server on " + (this.getServerHostname().length() == 0 ? "*" : this.getServerHostname()) + ":" + this.getServerPort());
@@ -180,7 +251,7 @@
@@ -180,7 +256,7 @@
{
this.func_147137_ag().addLanEndpoint(inetaddress, this.getServerPort());
}
@ -168,7 +180,7 @@
{
field_155771_h.warn("**** FAILED TO BIND TO PORT!");
field_155771_h.warn("The exception was: {}", new Object[] {ioexception.toString()});
@@ -196,10 +267,17 @@
@@ -196,10 +272,17 @@
field_155771_h.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
}
@ -188,7 +200,7 @@
if (!PreYggdrasilConverter.func_152714_a(this.settings))
{
@@ -208,7 +286,8 @@
@@ -208,7 +291,8 @@
else
{
FMLCommonHandler.instance().onServerStarted();
@ -198,7 +210,7 @@
long j = System.nanoTime();
if (this.getFolderName() == null)
@@ -274,11 +353,30 @@
@@ -274,11 +358,36 @@
this.theRConThreadMain.startThread();
}
@ -213,7 +225,13 @@
+ this.settings.saveProperties();
+ }
+ // CraftBukkit end
+
+ // KCauldronX start
+ for(FakePlayer fp:FakePlayer.fakePlayers){
+ fp.callBukkitLoginEvent();
+ }
+ FakePlayer.fakePlayers=null;
+ FakePlayer.BukkitInited=true;
+ // KCauldronX end
return FMLCommonHandler.instance().handleServerStarting(this);
}
}
@ -229,7 +247,7 @@
public boolean canStructuresSpawn()
{
return this.canSpawnStructures;
@@ -364,11 +462,19 @@
@@ -364,11 +473,19 @@
public void executePendingCommands()
{

View File

@ -12,7 +12,7 @@
import net.minecraft.world.WorldManager;
import net.minecraft.world.WorldServer;
import net.minecraft.world.WorldServerMulti;
@@ -78,7 +80,7 @@
@@ -78,10 +80,10 @@
this.initialWorldChunkLoad();
}
@ -20,7 +20,11 @@
+ protected boolean startServer() throws java.net.UnknownHostException // Cauldron
{
logger.info("Starting integrated minecraft server version 1.7.10");
this.setOnlineMode(true);
- this.setOnlineMode(true);
+ this.setOnlineMode(false);
this.setCanSpawnAnimals(true);
this.setCanSpawnNPCs(true);
this.setAllowPvp(true);
@@ -103,7 +105,15 @@
{
logger.info("Saving and pausing game...");

View File

@ -0,0 +1,75 @@
--- ../src-base/minecraft/net/minecraftforge/common/util/FakePlayer.java
+++ ../src-work/minecraft/net/minecraftforge/common/util/FakePlayer.java
@@ -3,9 +3,12 @@
import com.mojang.authlib.GameProfile;
import cpw.mods.fml.common.FMLCommonHandler;
+import cpw.mods.fml.common.FMLLog;
+import cpw.mods.fml.common.gameevent.PlayerEvent;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.play.client.C15PacketClientSettings;
+import net.minecraft.server.MinecraftServer;
import net.minecraft.server.management.ItemInWorldManager;
import net.minecraft.stats.StatBase;
import net.minecraft.util.ChunkCoordinates;
@@ -13,15 +16,58 @@
import net.minecraft.util.IChatComponent;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
+import net.minecraftforge.cauldron.configuration.CauldronConfig;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.ForgeEventFactory;
+import org.apache.logging.log4j.LogManager;
+import org.bukkit.Bukkit;
+import org.bukkit.craftbukkit.scheduler.CraftTask;
+import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
+import org.bukkit.event.player.PlayerLoginEvent;
+import org.bukkit.event.player.PlayerPreLoginEvent;
+import java.net.InetAddress;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.concurrent.ConcurrentSkipListSet;
+
//Preliminary, simple Fake Player class
public class FakePlayer extends EntityPlayerMP
{
+ static public ArrayList<FakePlayer> fakePlayers=new ArrayList();
+ static public boolean BukkitInited=false;
public FakePlayer(WorldServer world, GameProfile name)
{
super(FMLCommonHandler.instance().getMinecraftServerInstance(), world, name, new ItemInWorldManager(world));
+ //KCauldronX Start
+ if(MinecraftServer.cauldronConfig.fakePlayerLogin.getValue()) {
+ if (!BukkitInited) {
+ fakePlayers.add(this);
+ } else {
+ callBukkitLoginEvent();
+ }
+ }
+ //KCauldronX End
}
-
+ public void callBukkitLoginEvent(){
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ AsyncPlayerPreLoginEvent prelogin2 = new AsyncPlayerPreLoginEvent(getCommandSenderName(), InetAddress.getLoopbackAddress(), getUniqueID());
+ Bukkit.getPluginManager().callEvent(prelogin2);
+ MinecraftServer.getServer().processQueue.add(new Runnable() {
+ @Override
+ public void run() {
+ PlayerPreLoginEvent prelogin1 = new PlayerPreLoginEvent(getCommandSenderName(), InetAddress.getLoopbackAddress(), getUniqueID());
+ Bukkit.getPluginManager().callEvent(prelogin1);
+ PlayerLoginEvent login = new PlayerLoginEvent(getBukkitEntity(), "localhost", InetAddress.getLoopbackAddress());
+ Bukkit.getPluginManager().callEvent(login);
+ FMLLog.info("%s","[KCauldronX] Fakeplayer "+getCommandSenderName()+" ("+getUniqueID()+") joined server");
+ }
+ });
+ }
+ }).start();
+ }
@Override public boolean canCommandSenderUseCommand(int i, String s){ return false; }
@Override public ChunkCoordinates getPlayerCoordinates()
{

BIN
src/main/java/java.zip Normal file

Binary file not shown.

View File

@ -0,0 +1,17 @@
package kcauldronx.events;
import net.minecraft.inventory.IInventory;
import org.bukkit.craftbukkit.inventory.CraftInventory;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.event.inventory.InventoryMoveItemEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
/**
* Created by xjboss on 2017/7/3.
*/
public class ModInventoryMoveEvent extends InventoryMoveItemEvent {
public ModInventoryMoveEvent(IInventory sourceInventory, net.minecraft.item.ItemStack itemStack, IInventory destinationInventory, boolean didSourceInitiate) {
super(new CraftInventory(sourceInventory), CraftItemStack.asCraftMirror(itemStack), new CraftInventory(destinationInventory), didSourceInitiate);
}
}

View File

@ -0,0 +1,18 @@
package kcauldronx.events;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import org.bukkit.craftbukkit.inventory.CraftInventory;
import org.bukkit.craftbukkit.inventory.CraftInventoryPlayer;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.event.inventory.InventoryMoveItemEvent;
import org.bukkit.inventory.Inventory;
/**
* Created by xjboss on 2017/7/3.
*/
public class ModInventoryMoveFromPlayerEvent extends InventoryMoveItemEvent {
public ModInventoryMoveFromPlayerEvent(InventoryPlayer sourceInventory, net.minecraft.item.ItemStack itemStack, IInventory destinationInventory, boolean didSourceInitiate) {
super(new CraftInventoryPlayer(sourceInventory), CraftItemStack.asCraftMirror(itemStack),new CraftInventory(destinationInventory) , didSourceInitiate);
}
}

View File

@ -0,0 +1,17 @@
package kcauldronx.events;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import org.bukkit.craftbukkit.inventory.CraftInventory;
import org.bukkit.craftbukkit.inventory.CraftInventoryPlayer;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.event.inventory.InventoryMoveItemEvent;
/**
* Created by xjboss on 2017/7/3.
*/
public class ModInventoryMoveToPlayerEvent extends InventoryMoveItemEvent {
public ModInventoryMoveToPlayerEvent(IInventory sourceInventory, net.minecraft.item.ItemStack itemStack, InventoryPlayer destinationInventory, boolean didSourceInitiate) {
super(new CraftInventory(sourceInventory), CraftItemStack.asCraftMirror(itemStack), new CraftInventoryPlayer((InventoryPlayer)destinationInventory), didSourceInitiate);
}
}