Skip to content

Commit

Permalink
Merged MCPC+ changes to PluginClassLoader from MinecraftPortCentral/M…
Browse files Browse the repository at this point in the history
…CPC-Plus.

Changes include:

agaricus:
    Disable inheritance remapping for now to improve performance

    The inheritance traversal was bypassing the plugin classloader cache;
    will need to be reworked. Disabling it measurably improves memory
    usage and startup time. This change will cause some NMS plugins to not
    be completely remapped, however, most plugins should be unaffected
    (and they were not completely remapped by SrgTools either).

    Reopens keepcalm#87 NMS: Inheritance remapping missing
    But should help with keepcalm#97 consumes fill all ram with bukkit plugins

agaricus:
    Cache jar mappings

    For each mapping setting, a JarMapping will be stored in a dictionary
    keyed by the flags. Avoids re-loading mapped files for each plugin.

For full logs, see MinecraftPortCentral/Cauldron@46f8821 onward to now.
  • Loading branch information
keepcalm committed Jan 27, 2013
1 parent daab196 commit 7913386
Show file tree
Hide file tree
Showing 7 changed files with 1,078 additions and 517 deletions.
10 changes: 10 additions & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value>&lt;project&gt;/.externalToolBuilders/BukkitForge ant builder.launch</value>
</dictionary>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
Expand Down
55 changes: 0 additions & 55 deletions src/org/bukkit/craftbukkit/CraftLogHandler.java

This file was deleted.

44 changes: 22 additions & 22 deletions src/org/bukkit/craftbukkit/CraftServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public class CraftServer implements Server {
private static CraftServer instance;
private MinecraftServer theServer;
private ServerConfigurationManager configMan;
public YamlConfiguration bukkitConfig;
public YamlConfiguration configuration;
private Yaml yaml = new Yaml(new SafeConstructor());
private CraftScheduler scheduler = new CraftScheduler();
private Logger theLogger;
Expand Down Expand Up @@ -175,17 +175,17 @@ public CraftServer(MinecraftServer server) {
this.pluginManager = new SimplePluginManager(this, commandMap);

//pluginManager = new SimplePluginManager(this, commandMap);
bukkitConfig = new YamlConfiguration();
configuration = new YamlConfiguration();
YamlConfiguration yml = new YamlConfiguration();
try {
yml.load(getClass().getClassLoader().getResourceAsStream("configurations/bukkit.yml"));
if (!new File("bukkit.yml").exists()) {
new File("bukkit.yml").createNewFile();
yml.save("bukkit.yml");
}
bukkitConfig.load("bukkit.yml");
bukkitConfig.addDefaults(yml);
bukkitConfig.save("bukkit.yml");
configuration.load("bukkit.yml");
configuration.addDefaults(yml);
configuration.save("bukkit.yml");

}
catch (Exception e) {
Expand Down Expand Up @@ -431,19 +431,19 @@ public File getUpdateFolderFile() {
@Override
public long getConnectionThrottle() {

return this.bukkitConfig.getInt("settings.connection-throttle");
return this.configuration.getInt("settings.connection-throttle");
}

@Override
public int getTicksPerAnimalSpawns() {

return this.bukkitConfig.getInt("ticks-per.animal-spawns");
return this.configuration.getInt("ticks-per.animal-spawns");
}

@Override
public int getTicksPerMonsterSpawns() {

return this.bukkitConfig.getInt("ticks-per.animal-spawn");
return this.configuration.getInt("ticks-per.animal-spawn");
}

@Override
Expand Down Expand Up @@ -626,7 +626,7 @@ public World createWorld(WorldCreator creator) {
}

private ChunkGenerator getGenerator(int dimID) {
ConfigurationSection section = bukkitConfig.getConfigurationSection("worlds");
ConfigurationSection section = configuration.getConfigurationSection("worlds");
ChunkGenerator result = null;

if (section != null) {
Expand Down Expand Up @@ -753,7 +753,7 @@ public MapView createMap(World world) {

@Override
public void reload() {
bukkitConfig = YamlConfiguration.loadConfiguration(new File("bukkit.yml"));
configuration = YamlConfiguration.loadConfiguration(new File("bukkit.yml"));
//

if (theServer instanceof DedicatedServer) {
Expand All @@ -773,10 +773,10 @@ public void reload() {
theServer.setAllowPvp(config.getBooleanProperty("pvp", theServer.isPVPEnabled()));
theServer.setAllowFlight(config.getBooleanProperty("allow-flight", theServer.isFlightAllowed()));
theServer.setMOTD(config.getProperty("motd", theServer.getMOTD()));*/
monsterSpawn = bukkitConfig.getInt("spawn-limits.monsters");
animalSpawn = bukkitConfig.getInt("spawn-limits.animals");
waterAnimalSpawn = bukkitConfig.getInt("spawn-limits.water-animals");
warningState = WarningState.value(bukkitConfig.getString("settings.deprecated-verbose"));
monsterSpawn = configuration.getInt("spawn-limits.monsters");
animalSpawn = configuration.getInt("spawn-limits.animals");
waterAnimalSpawn = configuration.getInt("spawn-limits.water-animals");
warningState = WarningState.value(configuration.getString("settings.deprecated-verbose"));
// = bukkitConfig.getInt("ticks-per.autosave");

for (WorldServer world : theServer.worldServers) {
Expand Down Expand Up @@ -900,8 +900,8 @@ private void loadPlugin(Plugin plugin) {
}
@SuppressWarnings("finally")
public void loadCustomPermissions() {
theLogger.info("Going to load perms file: " + bukkitConfig.getString("settings.permissions-file", "permissions.yml"));
File file = new File(bukkitConfig.getString("settings.permissions-file", "permissions.yml"));
theLogger.info("Going to load perms file: " + configuration.getString("settings.permissions-file", "permissions.yml"));
File file = new File(configuration.getString("settings.permissions-file", "permissions.yml"));
FileInputStream stream;

try {
Expand Down Expand Up @@ -986,11 +986,11 @@ public boolean dispatchCommand(CommandSender sender, String commandLine)
@Override
public void configureDbConfig(ServerConfig config) {
DataSourceConfig ds = new DataSourceConfig();
ds.setDriver(bukkitConfig.getString("database.driver"));
ds.setUrl(bukkitConfig.getString("database.url"));
ds.setUsername(bukkitConfig.getString("database.username"));
ds.setPassword(bukkitConfig.getString("database.password"));
ds.setIsolationLevel(TransactionIsolation.getLevel(bukkitConfig.getString("database.isolation")));
ds.setDriver(configuration.getString("database.driver"));
ds.setUrl(configuration.getString("database.url"));
ds.setUsername(configuration.getString("database.username"));
ds.setPassword(configuration.getString("database.password"));
ds.setIsolationLevel(TransactionIsolation.getLevel(configuration.getString("database.isolation")));

if (ds.getDriver().contains("sqlite")) {
config.setDatabasePlatform(new SQLitePlatform());
Expand Down Expand Up @@ -1097,7 +1097,7 @@ public void resetRecipes() {
@Override
public Map<String, String[]> getCommandAliases() {

ConfigurationSection section = bukkitConfig.getConfigurationSection("aliases");
ConfigurationSection section = configuration.getConfigurationSection("aliases");
Map<String, String[]> result = new LinkedHashMap<String, String[]>();

if (section != null) {
Expand Down
Loading

0 comments on commit 7913386

Please sign in to comment.