Change snooper/crash report brand handling. fmlbranding now loads another string!

This commit is contained in:
Christian 2013-03-30 12:12:54 -04:00
parent 1bfb87a701
commit 41cd50d4c0
2 changed files with 39 additions and 7 deletions

View File

@ -5,7 +5,7 @@
* are made available under the terms of the GNU Lesser Public License v2.1 * are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* *
* Contributors: * Contributors:
* cpw - implementation * cpw - implementation
*/ */
@ -38,6 +38,7 @@ import net.minecraft.world.World;
import net.minecraft.world.storage.SaveHandler; import net.minecraft.world.storage.SaveHandler;
import net.minecraft.world.storage.WorldInfo; import net.minecraft.world.storage.WorldInfo;
import com.google.common.base.Joiner;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
@ -244,12 +245,9 @@ public class FMLCommonHandler
{ {
brd.addAll(sidedDelegate.getAdditionalBrandingInformation()); brd.addAll(sidedDelegate.getAdditionalBrandingInformation());
} }
try { if (Loader.instance().getFMLBrandingProperties().containsKey("fmlbranding"))
Properties props=new Properties(); {
props.load(getClass().getClassLoader().getResourceAsStream("fmlbranding.properties")); brd.add(Loader.instance().getFMLBrandingProperties().get("fmlbranding"));
brd.add(props.getProperty("fmlbranding"));
} catch (Exception ex) {
// Ignore - no branding file found
} }
int tModCount = Loader.instance().getModList().size(); int tModCount = Loader.instance().getModList().size();
int aModCount = Loader.instance().getActiveModList().size(); int aModCount = Loader.instance().getActiveModList().size();
@ -469,4 +467,20 @@ public class FMLCommonHandler
{ {
Loader.instance().serverStopped(); Loader.instance().serverStopped();
} }
public String getModName()
{
List<String> modNames = Lists.newArrayListWithExpectedSize(3);
modNames.add("fml");
if (!noForge)
{
modNames.add("forge");
}
if (Loader.instance().getFMLBrandingProperties().containsKey("snooperbranding"))
{
modNames.add(Loader.instance().getFMLBrandingProperties().get("snooperbranding"));
}
return Joiner.on(',').join(modNames);
}
} }

View File

@ -152,6 +152,7 @@ public class Loader
private static File minecraftDir; private static File minecraftDir;
private static List<String> injectedContainers; private static List<String> injectedContainers;
private File loggingProperties; private File loggingProperties;
private ImmutableMap<String, String> fmlBrandingProperties;
public static Loader instance() public static Loader instance()
{ {
@ -821,4 +822,21 @@ public class Loader
return true; return true;
} }
public Map<String,String> getFMLBrandingProperties()
{
if (fmlBrandingProperties == null)
{
Properties loaded = new Properties();
try
{
loaded.load(getClass().getClassLoader().getResourceAsStream("fmlbranding.properties"));
}
catch (IOException e)
{
// File not found - ignore
}
fmlBrandingProperties = Maps.fromProperties(loaded);
}
return fmlBrandingProperties;
}
} }