Better boot logging and performance.
Improved boot logs to get more specific performance numbers, and eliminated some non-essential boot steps to improve performance.
This commit is contained in:
parent
57cd709981
commit
23e1803a81
|
|
@ -94,26 +94,12 @@ public abstract class DataStore
|
||||||
{
|
{
|
||||||
GriefPrevention.AddLogEntry(this.claims.size() + " total claims loaded.");
|
GriefPrevention.AddLogEntry(this.claims.size() + " total claims loaded.");
|
||||||
|
|
||||||
//make a list of players who own claims
|
|
||||||
Vector<UUID> playerNames = new Vector<UUID>();
|
|
||||||
for(int i = 0; i < this.claims.size(); i++)
|
|
||||||
{
|
|
||||||
Claim claim = this.claims.get(i);
|
|
||||||
|
|
||||||
//ignore admin claims
|
|
||||||
if(claim.isAdminClaim()) continue;
|
|
||||||
|
|
||||||
if(!playerNames.contains(claim.ownerID))
|
|
||||||
playerNames.add(claim.ownerID);
|
|
||||||
}
|
|
||||||
|
|
||||||
GriefPrevention.AddLogEntry(playerNames.size() + " players have staked claims.");
|
|
||||||
|
|
||||||
//load up all the messages from messages.yml
|
//load up all the messages from messages.yml
|
||||||
this.loadMessages();
|
this.loadMessages();
|
||||||
|
GriefPrevention.AddLogEntry("Customizable messages loaded.");
|
||||||
|
|
||||||
//if converting up from an earlier schema version, write all claims back to storage using the latest format
|
//if converting up from an earlier schema version, write all claims back to storage using the latest format
|
||||||
if(this.getSchemaVersion() < this.latestSchemaVersion)
|
if(this.getSchemaVersion() < latestSchemaVersion)
|
||||||
{
|
{
|
||||||
GriefPrevention.AddLogEntry("Please wait. Updating data format.");
|
GriefPrevention.AddLogEntry("Please wait. Updating data format.");
|
||||||
|
|
||||||
|
|
@ -121,13 +107,12 @@ public abstract class DataStore
|
||||||
{
|
{
|
||||||
this.saveClaim(claim);
|
this.saveClaim(claim);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GriefPrevention.AddLogEntry("Update finished.");
|
||||||
}
|
}
|
||||||
|
|
||||||
//collect garbage, since lots of stuff was loaded into memory and then tossed out
|
|
||||||
System.gc();
|
|
||||||
|
|
||||||
//make a note of the data store schema version
|
//make a note of the data store schema version
|
||||||
this.setSchemaVersion(this.latestSchemaVersion);
|
this.setSchemaVersion(latestSchemaVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
//removes cached player data from memory
|
//removes cached player data from memory
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,7 @@ public class GriefPrevention extends JavaPlugin
|
||||||
//initializes well... everything
|
//initializes well... everything
|
||||||
public void onEnable()
|
public void onEnable()
|
||||||
{
|
{
|
||||||
AddLogEntry("Grief Prevention enabled.");
|
AddLogEntry("Grief Prevention boot start.");
|
||||||
|
|
||||||
instance = this;
|
instance = this;
|
||||||
|
|
||||||
|
|
@ -660,6 +660,8 @@ public class GriefPrevention extends JavaPlugin
|
||||||
this.config_pvp_blockedCommands.add(commands[i].trim());
|
this.config_pvp_blockedCommands.add(commands[i].trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AddLogEntry("Finished loading configuration.");
|
||||||
|
|
||||||
//when datastore initializes, it loads player and claim data, and posts some stats to the log
|
//when datastore initializes, it loads player and claim data, and posts some stats to the log
|
||||||
if(databaseUrl.length() > 0)
|
if(databaseUrl.length() > 0)
|
||||||
{
|
{
|
||||||
|
|
@ -713,6 +715,9 @@ public class GriefPrevention extends JavaPlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String dataMode = (this.dataStore instanceof FlatFileDataStore)?"(File Mode)":"(Database Mode)";
|
||||||
|
AddLogEntry("Finished loading data " + dataMode + ".");
|
||||||
|
|
||||||
//unless claim block accrual is disabled, start the recurring per 5 minute event to give claim blocks to online players
|
//unless claim block accrual is disabled, start the recurring per 5 minute event to give claim blocks to online players
|
||||||
//20L ~ 1 second
|
//20L ~ 1 second
|
||||||
if(this.config_claims_blocksAccruedPerHour > 0)
|
if(this.config_claims_blocksAccruedPerHour > 0)
|
||||||
|
|
@ -779,6 +784,8 @@ public class GriefPrevention extends JavaPlugin
|
||||||
GriefPrevention.AddLogEntry("ERROR: Vault was unable to find a supported economy plugin. Either install a Vault-compatible economy plugin, or set both of the economy config variables to zero.");
|
GriefPrevention.AddLogEntry("ERROR: Vault was unable to find a supported economy plugin. Either install a Vault-compatible economy plugin, or set both of the economy config variables to zero.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AddLogEntry("Boot finished.");
|
||||||
}
|
}
|
||||||
|
|
||||||
//handles slash commands
|
//handles slash commands
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user