1
0
forked from xjboss/KCauldronX
KCauldronX/patches/cpw/mods/fml/common/FMLCommonHandler.java.patch

68 lines
2.5 KiB
Diff
Raw Normal View History

2015-03-22 17:38:04 +00:00
--- ../src-base/minecraft/cpw/mods/fml/common/FMLCommonHandler.java
+++ ../src-work/minecraft/cpw/mods/fml/common/FMLCommonHandler.java
@@ -37,6 +37,10 @@
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Logger;
+import org.bukkit.Bukkit;
+import org.bukkit.craftbukkit.CraftWorld;
+import org.bukkit.entity.Player;
+import org.bukkit.event.player.PlayerChangedWorldEvent;
import com.google.common.base.Joiner;
import com.google.common.base.Strings;
2015-05-31 11:21:26 +00:00
@@ -282,6 +286,7 @@
{
Loader.instance().serverStarted();
sidedDelegate.allowLogins();
+ kcauldron.updater.KVersionRetriever.init(MinecraftServer.getServer());
}
public void handleServerStopping()
@@ -385,10 +390,11 @@
2015-03-22 17:38:04 +00:00
{
return;
}
- if (handlerSet.contains(handler))
+ if (handlerSet.contains(handler) || worldInfo.getDimension() != 0) // Cauldron - Only check FML data in main world
{
return;
}
+ // Cauldron - logic below should only be run for overworld as Forge/Vanilla only use 1 SaveHandler
handlerSet.add(handler);
handlerToCheck = new WeakReference<SaveHandler>(handler); // for confirmBackupLevelDatUse
Map<String,NBTBase> additionalProperties = Maps.newHashMap();
2015-05-31 11:21:26 +00:00
@@ -496,7 +502,13 @@
2015-03-22 17:38:04 +00:00
public String getModName()
{
- List<String> modNames = Lists.newArrayListWithExpectedSize(3);
+ // Cauldron start
+ List<String> modNames = Lists.newArrayListWithExpectedSize(6);
2015-05-17 04:58:43 +00:00
+ modNames.add("kcauldron");
2015-03-22 17:38:04 +00:00
+ modNames.add("cauldron");
+ modNames.add("craftbukkit");
+ modNames.add("mcpc");
+ // Cauldron end
modNames.add("fml");
if (!noForge)
{
2015-05-31 11:21:26 +00:00
@@ -540,8 +552,17 @@
2015-03-22 17:38:04 +00:00
bus().post(new InputEvent.KeyInputEvent());
}
+ // Cauldron start - wrapper to notify plugins for mods that bypass ServerConfigurationManager
public void firePlayerChangedDimensionEvent(EntityPlayer player, int fromDim, int toDim)
{
+ this.firePlayerChangedDimensionEvent(player, fromDim, toDim, player.worldObj.getWorld());
+ }
+
+ public void firePlayerChangedDimensionEvent(EntityPlayer player, int fromDim, int toDim, CraftWorld fromWorld)
+ {
+ PlayerChangedWorldEvent event = new PlayerChangedWorldEvent((Player) player.getBukkitEntity(), fromWorld);
+ Bukkit.getServer().getPluginManager().callEvent(event);
+ // Cauldron end
bus().post(new PlayerEvent.PlayerChangedDimensionEvent(player, fromDim, toDim));
}