1
0
mirror of https://github.com/mcMMO-Dev/mcMMO.git synced 2026-02-18 01:42:32 +01:00

Compare commits

...

22 Commits

Author SHA1 Message Date
t00thpick1
9957ca41a8 Fully remove metrics. 2017-12-22 15:43:44 -08:00
t00thpick1
00e18d4096 Remove metrics 2017-12-22 15:35:46 -08:00
t00thpick1
31cefbfc8c Update readme 2014-12-17 18:54:21 -05:00
riking
2c940ecdac Try again later when Mojang ratelimits us 2014-11-26 01:52:17 -08:00
riking
e51809d066 Goddamnit, save more often to make sure progress is made 2014-11-26 01:24:44 -08:00
riking
01a18fa587 Revert "Downgrade Bukkit to 1.7.9 to compile"
This reverts commit d0881ab3fd.
2014-11-24 05:34:15 -08:00
Kane York
f93deeceb6 Merge pull request #2356 from riking/logout-method
This will allow for BungeeCord compat when the sending server knows about the move. It will NOT work if the proxy processes the transfer.
2014-11-24 05:30:49 -08:00
riking
3275395d53 Remove dead logoutParty() method 2014-11-24 05:28:46 -08:00
riking
d0881ab3fd Downgrade Bukkit to 1.7.9 to compile 2014-11-24 05:28:28 -08:00
riking
5db09bf45c Allow synchronous save on logout
This is intended for plugins that have foreknowledge of a logout
happening (e.g. a BungeeCord server hop about to happen), so that they
can tell mcMMO to save the data, and the new server will be able to pull
the profile correctly from the database.
2014-11-24 05:24:13 -08:00
riking
f4406bd9cf Move PlayerQuit logic to mcMMOPlayer.logout() 2014-11-24 05:23:37 -08:00
riking
3b441073fd Change PROFILES_PER_REQUEST to 50
@blood thinks this may fix the 429 issue
2014-11-18 17:25:03 -08:00
riking
da22a8ff93 Change UUID ratelimits to sane values 2014-11-18 17:21:44 -08:00
Harry
f8469cbe00 Fix an old bug where the config is read incorrectly
This should be "DamageModifier" not "DamagerModifier.". As seen here dbc7b98b0d/src/main/resources/advanced.yml (L140) . Thanks to @matagin for pointing this out.
2014-11-03 12:36:20 +01:00
TfT_02
0188629fe2 Should add these to the hash map to prevent a NPE
Fixes #2333
2014-10-25 17:33:55 +02:00
TfT_02
5d246d2701 Add missing UserManager check
Caused an java.lang.IndexOutOfBoundsException: Index: 0

Fixes #2335
2014-10-25 17:29:58 +02:00
t00thpick1
b3cd5486d6 Actually use settings 2014-10-19 01:55:10 -04:00
zreed
7e961fc2a3 Actually include Tomcat (and dependencies) 2014-10-15 22:00:11 -04:00
t00thpick1
8fcd286eb0 This might be important 2014-10-15 01:31:11 -04:00
t00thpick1
4723a7cbdb Switch to a different ConnectionPool implementation 2014-10-15 00:15:43 -04:00
TfT_02
dbc7b98b0d Properly name these config nodes
I forgot that we don’t use underscores here
2014-10-11 13:37:25 +02:00
TfT_02
a5bc547c40 Add settings for Bleed damage
Adds #2154
2014-10-11 12:18:31 +02:00
17 changed files with 138 additions and 466 deletions

View File

@@ -1,8 +1,8 @@
# mcMMO
## The RPG lovers mod
### Dev builds
Our latest development builds are available ~~[here](http://ci.mcmmo.info)~~. Unfortunately, the mcMMO site is down; a temporary dev build location is hosted [here](http://ci.ecocitycraft.com/job/mcMMO/).
### Builds
Currently, you can obtain our builds via the Spigot resource page: http://www.spigotmc.org/resources/mcmmo.2445/
### Brief Description
The goal of mcMMO is to take core Minecraft game mechanics and expand them into add an extensive and quality RPG experience. Everything in mcMMO has been carefully thought out and is constantly being improved upon. Currently, mcMMO adds fourteen unique skills to train and level in. Each of these skills is highly customizable through our configuration files, allowing server admins to tweak mcMMO to best suit the needs of his or her server. Know that the mcMMO team is dedicated to providing an ever-evolving experience, and that we carefully read all feedback and bug reports in order to evaluate and balance the mechanics of mcMMO in every update.

28
pom.xml
View File

@@ -75,23 +75,23 @@
<configuration>
<artifactSet>
<includes>
<include>com.turt2live.metrics:MetricsExtension</include>
<include>commons-logging:commons-logging</include>
<include>net.snaq:dbpool</include>
<include>org.apache.tomcat:tomcat-jdbc</include>
<include>org.apache.tomcat:tomcat-juli</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>com.turt2live.metrics</pattern>
<shadedPattern>com.gmail.nossr50.metrics.mcstats</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache.commons.logging</pattern>
<shadedPattern>com.gmail.nossr50.commons.logging</shadedPattern>
</relocation>
<relocation>
<pattern>net.snaq</pattern>
<shadedPattern>com.gmail.nossr50.dbpool</shadedPattern>
<pattern>org.apache.juli</pattern>
<shadedPattern>com.gmail.nossr50.database.tomcat.juli</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache.tomcat</pattern>
<shadedPattern>com.gmail.nossr50.database.tomcat</shadedPattern>
</relocation>
</relocations>
</configuration>
@@ -142,14 +142,10 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.turt2live.metrics</groupId>
<artifactId>MetricsExtension</artifactId>
<version>0.0.5-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.snaq</groupId>
<artifactId>dbpool</artifactId>
<version>5.1</version>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
<version>7.0.52</version>
<scope>compile</scope>
</dependency>
</dependencies>
<distributionManagement>

View File

@@ -200,7 +200,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
}
if (getSkullSplitterModifier() < 1) {
reason.add("Skills.Axes.SkullSplitter.DamagerModifier should be at least 1!");
reason.add("Skills.Axes.SkullSplitter.DamageModifier should be at least 1!");
}
/* FISHING */
@@ -733,7 +733,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
public double getImpactChance() { return config.getDouble("Skills.Axes.ArmorImpact.Chance", 25.0D); }
public double getArmorImpactMaxDurabilityDamage() { return config.getDouble("Skills.Axes.ArmorImpact.MaxPercentageDurabilityDamage", 20.0D); }
public double getSkullSplitterModifier() { return config.getDouble("Skills.Axes.SkullSplitter.DamagerModifier", 2.0D); }
public double getSkullSplitterModifier() { return config.getDouble("Skills.Axes.SkullSplitter.DamageModifier", 2.0D); }
/* EXCAVATION */
//Nothing to configure, everything is already configurable in config.yml
@@ -802,6 +802,9 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
public int getSmeltingVanillaXPBoostMultiplier(Smelting.Tier tier) { return config.getInt("Skills.Smelting.VanillaXPMultiplier.Rank_" + tier.toNumerical()); }
/* SWORDS */
public double getBleedDamagePlayer() { return config.getDouble("Skills.Swords.Bleed.DamagePlayer", 1.0); }
public double getBleedDamageMobs() { return config.getDouble("Skills.Swords.Bleed.DamageMobs", 2.0); }
public int getBleedMaxTicks() { return config.getInt("Skills.Swords.Bleed.MaxTicks", 3); }
public int getBleedBaseTicks() { return config.getInt("Skills.Swords.Bleed.BaseTicks", 2); }

View File

@@ -12,8 +12,6 @@ import java.util.Set;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import com.gmail.nossr50.metrics.MetricsManager;
public abstract class AutoUpdateConfigLoader extends ConfigLoader {
public AutoUpdateConfigLoader(String relativePath, String fileName) {
super(relativePath, fileName);
@@ -116,13 +114,5 @@ public abstract class AutoUpdateConfigLoader extends ConfigLoader {
e.printStackTrace();
}
}
else {
for (String key : configKeys) {
if (!config.isConfigurationSection(key) && !config.get(key).equals(internalConfig.get(key))) {
MetricsManager.customConfig();
break;
}
}
}
}
}

View File

@@ -11,10 +11,11 @@ import java.util.EnumMap;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.UUID;
import java.util.concurrent.locks.ReentrantLock;
import org.apache.tomcat.jdbc.pool.DataSource;
import org.apache.tomcat.jdbc.pool.PoolProperties;
import org.bukkit.scheduler.BukkitRunnable;
import com.gmail.nossr50.mcMMO;
@@ -29,19 +30,15 @@ import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.runnables.database.UUIDUpdateAsyncTask;
import com.gmail.nossr50.util.Misc;
import snaq.db.ConnectionPool;
public final class SQLDatabaseManager implements DatabaseManager {
private static final String ALL_QUERY_VERSION = "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing+alchemy";
private String tablePrefix = Config.getInstance().getMySQLTablePrefix();
private final int POOL_FETCH_TIMEOUT = 360000;
private final Map<UUID, Integer> cachedUserIDs = new HashMap<UUID, Integer>();
private ConnectionPool miscPool;
private ConnectionPool loadPool;
private ConnectionPool savePool;
private DataSource miscPool;
private DataSource loadPool;
private DataSource savePool;
private ReentrantLock massUpdateLock = new ReentrantLock();
@@ -58,44 +55,54 @@ public final class SQLDatabaseManager implements DatabaseManager {
//throw e; // aborts onEnable() Riking if you want to do this, fully implement it.
}
Properties connectionProperties = new Properties();
connectionProperties.put("user", Config.getInstance().getMySQLUserName());
connectionProperties.put("password", Config.getInstance().getMySQLUserPassword());
connectionProperties.put("autoReconnect", "true");
connectionProperties.put("cachePrepStmts", "true");
connectionProperties.put("prepStmtCacheSize", "64");
connectionProperties.put("prepStmtCacheSqlLimit", "2048");
connectionProperties.put("useServerPrepStmts", "true");
miscPool = new ConnectionPool("mcMMO-Misc-Pool",
0 /*No Minimum really needed*/,
Config.getInstance().getMySQLMaxPoolSize(PoolIdentifier.MISC) /*max pool size */,
Config.getInstance().getMySQLMaxConnections(PoolIdentifier.MISC) /*max num connections*/,
400 /* idle timeout of connections */,
connectionString,
connectionProperties);
loadPool = new ConnectionPool("mcMMO-Load-Pool",
1 /*Minimum of one*/,
Config.getInstance().getMySQLMaxPoolSize(PoolIdentifier.LOAD) /*max pool size */,
Config.getInstance().getMySQLMaxConnections(PoolIdentifier.LOAD) /*max num connections*/,
400 /* idle timeout of connections */,
connectionString,
connectionProperties);
savePool = new ConnectionPool("mcMMO-Save-Pool",
1 /*Minimum of one*/,
Config.getInstance().getMySQLMaxPoolSize(PoolIdentifier.SAVE) /*max pool size */,
Config.getInstance().getMySQLMaxConnections(PoolIdentifier.SAVE) /*max num connections*/,
400 /* idle timeout of connections */,
connectionString,
connectionProperties);
miscPool.init(); // Init first connection
miscPool.registerShutdownHook(); // Auto release on jvm exit just in case
loadPool.init();
loadPool.registerShutdownHook();
savePool.init();
savePool.registerShutdownHook();
PoolProperties poolProperties = new PoolProperties();
poolProperties.setDriverClassName("com.mysql.jdbc.Driver");
poolProperties.setUrl(connectionString);
poolProperties.setUsername(Config.getInstance().getMySQLUserName());
poolProperties.setPassword(Config.getInstance().getMySQLUserPassword());
poolProperties.setMaxIdle(Config.getInstance().getMySQLMaxPoolSize(PoolIdentifier.MISC));
poolProperties.setMaxActive(Config.getInstance().getMySQLMaxConnections(PoolIdentifier.MISC));
poolProperties.setInitialSize(0);
poolProperties.setMaxWait(-1);
poolProperties.setRemoveAbandoned(true);
poolProperties.setRemoveAbandonedTimeout(60);
poolProperties.setTestOnBorrow(true);
poolProperties.setValidationQuery("SELECT 1");
poolProperties.setValidationInterval(30000);
miscPool = new DataSource(poolProperties);
poolProperties = new PoolProperties();
poolProperties.setDriverClassName("com.mysql.jdbc.Driver");
poolProperties.setUrl(connectionString);
poolProperties.setUsername(Config.getInstance().getMySQLUserName());
poolProperties.setPassword(Config.getInstance().getMySQLUserPassword());
poolProperties.setInitialSize(0);
poolProperties.setMaxIdle(Config.getInstance().getMySQLMaxPoolSize(PoolIdentifier.SAVE));
poolProperties.setMaxActive(Config.getInstance().getMySQLMaxConnections(PoolIdentifier.SAVE));
poolProperties.setMaxWait(-1);
poolProperties.setRemoveAbandoned(true);
poolProperties.setRemoveAbandonedTimeout(60);
poolProperties.setTestOnBorrow(true);
poolProperties.setValidationQuery("SELECT 1");
poolProperties.setValidationInterval(30000);
savePool = new DataSource(poolProperties);
poolProperties = new PoolProperties();
poolProperties.setDriverClassName("com.mysql.jdbc.Driver");
poolProperties.setUrl(connectionString);
poolProperties.setUsername(Config.getInstance().getMySQLUserName());
poolProperties.setPassword(Config.getInstance().getMySQLUserPassword());
poolProperties.setInitialSize(0);
poolProperties.setMaxIdle(Config.getInstance().getMySQLMaxPoolSize(PoolIdentifier.LOAD));
poolProperties.setMaxActive(Config.getInstance().getMySQLMaxConnections(PoolIdentifier.LOAD));
poolProperties.setMaxWait(-1);
poolProperties.setRemoveAbandoned(true);
poolProperties.setRemoveAbandonedTimeout(60);
poolProperties.setTestOnBorrow(true);
poolProperties.setValidationQuery("SELECT 1");
poolProperties.setValidationInterval(30000);
loadPool = new DataSource(poolProperties);
checkStructure();
}
public void purgePowerlessUsers() {
@@ -1094,13 +1101,13 @@ public final class SQLDatabaseManager implements DatabaseManager {
Connection connection = null;
switch (identifier) {
case LOAD:
connection = loadPool.getConnection(POOL_FETCH_TIMEOUT);
connection = loadPool.getConnection();
break;
case MISC:
connection = miscPool.getConnection(POOL_FETCH_TIMEOUT);
connection = miscPool.getConnection();
break;
case SAVE:
connection = savePool.getConnection(POOL_FETCH_TIMEOUT);
connection = savePool.getConnection();
break;
}
if (connection == null) {
@@ -1594,9 +1601,9 @@ public final class SQLDatabaseManager implements DatabaseManager {
@Override
public void onDisable() {
mcMMO.p.debug("Releasing connection pool resource...");
miscPool.release();
loadPool.release();
savePool.release();
miscPool.close();
loadPool.close();
savePool.close();
}
public enum PoolIdentifier {

View File

@@ -5,6 +5,9 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Sound;
@@ -585,10 +588,6 @@ public class McMMOPlayer {
party.addOnlineMember(this.getPlayer());
}
public void logoutParty() {
party.removeOnlineMember(this.getPlayer());
}
public int getItemShareModifier() {
if (itemShareModifier < 10) {
setItemShareModifier(10);
@@ -879,4 +878,28 @@ public class McMMOPlayer {
public FixedMetadataValue getPlayerMetadata() {
return playerMetadata;
}
/**
* This method is called by PlayerQuitEvent to tear down the mcMMOPlayer.
*
* @param syncSave if true, data is saved synchronously
*/
public void logout(boolean syncSave) {
Player thisPlayer = getPlayer();
resetAbilityMode();
BleedTimerTask.bleedOut(thisPlayer);
if (syncSave) {
getProfile().save();
} else {
getProfile().scheduleAsyncSave();
}
UserManager.remove(thisPlayer);
ScoreboardManager.teardownPlayer(thisPlayer);
if (inParty()) {
party.removeOnlineMember(thisPlayer);
}
}
}

View File

@@ -42,7 +42,6 @@ import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.ShareHandler;
import com.gmail.nossr50.runnables.player.PlayerProfileLoadingTask;
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
import com.gmail.nossr50.skills.fishing.FishingManager;
import com.gmail.nossr50.skills.herbalism.HerbalismManager;
import com.gmail.nossr50.skills.mining.MiningManager;
@@ -62,7 +61,6 @@ import com.gmail.nossr50.util.MobHealthbarUtils;
import com.gmail.nossr50.util.Motd;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import com.gmail.nossr50.util.skills.SkillUtils;
public class PlayerListener implements Listener {
@@ -361,16 +359,7 @@ public class PlayerListener implements Listener {
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
mcMMOPlayer.resetAbilityMode();
BleedTimerTask.bleedOut(player);
mcMMOPlayer.getProfile().scheduleAsyncSave();
UserManager.remove(player);
ScoreboardManager.teardownPlayer(player);
if (mcMMOPlayer.inParty()) {
mcMMOPlayer.logoutParty();
}
mcMMOPlayer.logout(false);
}
/**

View File

@@ -31,7 +31,6 @@ import com.gmail.nossr50.listeners.InventoryListener;
import com.gmail.nossr50.listeners.PlayerListener;
import com.gmail.nossr50.listeners.SelfListener;
import com.gmail.nossr50.listeners.WorldListener;
import com.gmail.nossr50.metrics.MetricsManager;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.runnables.CheckDateTask;
import com.gmail.nossr50.runnables.SaveTimerTask;
@@ -179,8 +178,6 @@ public class mcMMO extends JavaPlugin {
scheduleTasks();
CommandRegistrationManager.registerCommands();
MetricsManager.setup();
placeStore = ChunkManagerFactory.getChunkManager(); // Get our ChunkletManager
checkForUpdates();

View File

@@ -1,353 +0,0 @@
package com.gmail.nossr50.metrics;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Locale;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.HiddenConfig;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.experience.FormulaType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.turt2live.metrics.EMetrics;
import com.turt2live.metrics.Metrics;
import com.turt2live.metrics.Metrics.Graph;
import com.turt2live.metrics.data.DataEvent;
import com.turt2live.metrics.data.DataTracker;
import com.turt2live.metrics.tracker.Tracker;
public class MetricsManager {
private static boolean setup = false;
private static Tracker chimeraUseTracker;
private static Tracker chimeraServerUseTracker;
private static boolean customConfig = false;
private static DataTracker tracker;
private static EMetrics emetrics;
public static void setup() {
if (setup) {
return;
}
if (Config.getInstance().getStatsTrackingEnabled()) {
try {
emetrics = new EMetrics(mcMMO.p);
Metrics metrics = emetrics.getMetrics();
// Timings Graph
Graph timingsGraph = metrics.createGraph("Percentage of servers using timings");
if (mcMMO.p.getServer().getPluginManager().useTimings()) {
timingsGraph.addPlotter(new Metrics.Plotter("Enabled") {
@Override
public int getValue() {
return 1;
}
});
}
else {
timingsGraph.addPlotter(new Metrics.Plotter("Disabled") {
@Override
public int getValue() {
return 1;
}
});
}
// Donut Version Graph
Graph versionDonutGraph = metrics.createGraph("Donut Version");
boolean haveVersionInformation = false;
boolean isOfficialBuild = false;
String officialKey = "e14cfacdd442a953343ebd8529138680";
String version = mcMMO.p.getDescription().getVersion();
InputStreamReader isr = new InputStreamReader(mcMMO.p.getResource(".jenkins"));
BufferedReader br = new BufferedReader(isr);
char[] key = new char[32];
br.read(key);
if (officialKey.equals(String.valueOf(key))) {
isOfficialBuild = true;
}
if (version.contains("-")) {
String majorVersion = version.substring(0, version.indexOf("-"));
String subVersion;
if (isOfficialBuild) {
int startIndex = version.indexOf("-");
if (version.substring(startIndex + 1).contains("-")) {
subVersion = version.substring(startIndex, version.indexOf("-", startIndex + 1));
}
else {
subVersion = "-release";
}
}
else {
subVersion = "-custom";
}
version = majorVersion + "~=~" + subVersion;
haveVersionInformation = true;
}
if (haveVersionInformation) {
versionDonutGraph.addPlotter(new Metrics.Plotter(version) {
@Override
public int getValue() {
return 1;
}
});
}
// Official v Custom build Graph
Graph officialGraph = metrics.createGraph("Built by official ci");
if (isOfficialBuild) {
officialGraph.addPlotter(new Metrics.Plotter("Yes") {
@Override
public int getValue() {
return 1;
}
});
}
else {
officialGraph.addPlotter(new Metrics.Plotter("No") {
@Override
public int getValue() {
return 1;
}
});
}
// Chunkmeta enabled Graph
Graph chunkmetaGraph = metrics.createGraph("Uses Chunkmeta");
if (HiddenConfig.getInstance().getChunkletsEnabled()) {
chunkmetaGraph.addPlotter(new Metrics.Plotter("Yes") {
@Override
public int getValue() {
return 1;
}
});
}
else {
chunkmetaGraph.addPlotter(new Metrics.Plotter("No") {
@Override
public int getValue() {
return 1;
}
});
}
// Storage method Graph
Graph storageGraph = metrics.createGraph("Storage method");
if (Config.getInstance().getUseMySQL()) {
storageGraph.addPlotter(new Metrics.Plotter("SQL") {
@Override
public int getValue() {
return 1;
}
});
}
else {
storageGraph.addPlotter(new Metrics.Plotter("Flatfile") {
@Override
public int getValue() {
return 1;
}
});
}
// Locale Graph
Graph localeGraph = metrics.createGraph("Locale");
localeGraph.addPlotter(new Metrics.Plotter(LocaleLoader.getCurrentLocale().getDisplayLanguage(Locale.US)) {
@Override
public int getValue() {
return 1;
}
});
// ExperienceFormulaShape Graph
Graph experienceFormulaShapeGraph = metrics.createGraph("Experience Formula Shape Graph");
experienceFormulaShapeGraph.addPlotter(new Metrics.Plotter(ExperienceConfig.getInstance().getFormulaType().toString()) {
@Override
public int getValue() {
return 1;
}
});
// GlobalMultiplier Graph
Graph globalMultiplierGraph = metrics.createGraph("Global Multiplier Graph");
globalMultiplierGraph.addPlotter(new Metrics.Plotter(ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier() + "") {
@Override
public int getValue() {
return 1;
}
});
// GlobalCurveModifier Graph
Graph globalCurveModifierGraph = metrics.createGraph("Global Curve Modifier Graph");
globalCurveModifierGraph.addPlotter(new Metrics.Plotter(ExperienceConfig.getInstance().getMultiplier(FormulaType.LINEAR) + "") {
@Override
public int getValue() {
return 1;
}
});
// GlobalMultiplierGraph Fuzzy Logic Numbers
Graph globalMultiplierGraphFuzzy = metrics.createGraph("Global Multiplier Fuzz");
if (ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier() > 1.0) {
globalMultiplierGraphFuzzy.addPlotter(new Metrics.Plotter("Higher") {
@Override
public int getValue() {
return 1;
}
});
}
else if (ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier() < 1.0) {
globalMultiplierGraphFuzzy.addPlotter(new Metrics.Plotter("Lower") {
@Override
public int getValue() {
return 1;
}
});
}
else {
globalMultiplierGraphFuzzy.addPlotter(new Metrics.Plotter("Default") {
@Override
public int getValue() {
return 1;
}
});
}
// GlobalCurveModifier Fuzzy Logic Numbers
Graph globalCurveMultiplierGraphFuzzy = metrics.createGraph("Global Curve Multiplier Fuzz");
if (ExperienceConfig.getInstance().getMultiplier(FormulaType.LINEAR) > 20.0) {
globalCurveMultiplierGraphFuzzy.addPlotter(new Metrics.Plotter("Higher") {
@Override
public int getValue() {
return 1;
}
});
}
else if (ExperienceConfig.getInstance().getMultiplier(FormulaType.LINEAR) < 20.0) {
globalCurveMultiplierGraphFuzzy.addPlotter(new Metrics.Plotter("Lower") {
@Override
public int getValue() {
return 1;
}
});
}
else {
globalCurveMultiplierGraphFuzzy.addPlotter(new Metrics.Plotter("Default") {
@Override
public int getValue() {
return 1;
}
});
}
// Chimera Wing Usage Trackers
final String chimeraGraphName = "Chimera Wing Usage";
chimeraUseTracker = EMetrics.createBasicTracker(chimeraGraphName, "Player use");
chimeraServerUseTracker = EMetrics.createEnabledTracker(chimeraGraphName, "Server use");
emetrics.addTracker(chimeraUseTracker);
emetrics.addTracker(chimeraServerUseTracker);
// Chimera Wing Enabled Graph
Graph chimeraGraph = metrics.createGraph("Chimera Wing");
if (Config.getInstance().getChimaeraEnabled()) {
chimeraGraph.addPlotter(new Metrics.Plotter("Enabled") {
@Override
public int getValue() {
return 1;
}
});
}
else {
chimeraGraph.addPlotter(new Metrics.Plotter("Disabled") {
@Override
public int getValue() {
return 1;
}
});
}
// Vanilla v Modified config graph
Graph customConfigGraph = metrics.createGraph("Modified Configs");
if (customConfig) {
customConfigGraph.addPlotter(new Metrics.Plotter("Edited") {
@Override
public int getValue() {
return 1;
}
});
}
else {
customConfigGraph.addPlotter(new Metrics.Plotter("Vanilla") {
@Override
public int getValue() {
return 1;
}
});
}
/*
* Debug stuff
* tracker = emetrics.getDataTracker();
* tracker.enable();
* tracker.setFilter(new DataEvent.DataType [] { DataEvent.DataType.SEND_DATA });
*/
emetrics.startMetrics();
}
catch (IOException e) {
mcMMO.p.getLogger().warning("Failed to submit stats.");
}
}
}
public static void chimeraWingUsed() {
chimeraUseTracker.increment();
chimeraServerUseTracker.increment();
}
public static void customConfig() {
customConfig = true;
}
@SuppressWarnings("unused")
private static void debug() {
emetrics.getMetrics().flush();
for (DataEvent event : tracker.getEvents()) {
String graphName = event.getGraphName();
String colName = event.getTrackerName();
int value = event.getValueSent();
System.out.println("Graph: " + graphName + ", Column: " + colName + ", Value: " + value);
}
tracker.resetEvents();
}
}

View File

@@ -20,7 +20,7 @@ public class UUIDUpdateAsyncTask extends BukkitRunnable {
private static final int MAX_LOOKUP = Math.max(HiddenConfig.getInstance().getUUIDConvertAmount(), 100);
private static final int RATE_LIMIT = HiddenConfig.getInstance().getMojangRateLimit();
private static final long LIMIT_PERIOD = HiddenConfig.getInstance().getMojangLimitPeriod();
private static final int BATCH_SIZE = 5000;
private static final int BATCH_SIZE = MAX_LOOKUP * 3;
private List<String> userNames;
private int size;
@@ -68,6 +68,17 @@ public class UUIDUpdateAsyncTask extends BukkitRunnable {
fetchedUUIDs.putAll(new UUIDFetcher(userNamesSection).call());
}
catch (Exception e) {
// Handle 429
if (e.getMessage().contains("429")) {
try {
Thread.sleep(LIMIT_PERIOD);
} catch (InterruptedException ex) {
e.printStackTrace();
return;
}
continue;
}
plugin.getLogger().log(Level.SEVERE, "Unable to fetch UUIDs!", e);
return;
}
@@ -77,7 +88,7 @@ public class UUIDUpdateAsyncTask extends BukkitRunnable {
size = userNames.size();
Misc.printProgress(checkedUsers, DatabaseManager.progressInterval, startMillis);
if (fetchedUUIDs.size() > BATCH_SIZE) {
if (fetchedUUIDs.size() >= BATCH_SIZE) {
mcMMO.getDatabaseManager().saveUserUUIDs(fetchedUUIDs);
fetchedUUIDs = new HashMap<String, UUID>();
}

View File

@@ -9,6 +9,7 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
@@ -28,10 +29,10 @@ public class BleedTimerTask extends BukkitRunnable {
continue;
}
int damage;
double damage;
if (entity instanceof Player) {
damage = 1;
damage = AdvancedConfig.getInstance().getBleedDamagePlayer();
Player player = (Player) entity;
if (!player.isOnline()) {
@@ -44,14 +45,14 @@ public class BleedTimerTask extends BukkitRunnable {
ParticleEffectUtils.playBleedEffect(entity);
}
entry.setValue(entry.getValue() - damage);
entry.setValue(entry.getValue() - 1);
if (entry.getValue() <= 0) {
player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleeding.Stopped"));
}
}
else {
damage = 2;
damage = AdvancedConfig.getInstance().getBleedDamageMobs();
// Anticipate the entity's death to prevent CME because of our EntityDeathEvent listener
if (entity.getHealth() - damage > 0) {

View File

@@ -52,6 +52,10 @@ public class TrackedTamingEntity extends BukkitRunnable {
CombatUtils.dealDamage(livingEntity, livingEntity.getMaxHealth(), DamageCause.SUICIDE, livingEntity);
}
if (!UserManager.hasPlayerDataKey(owner)) {
return;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(owner);
TamingManager tamingManager = mcMMOPlayer.getTamingManager();

View File

@@ -17,7 +17,6 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.metrics.MetricsManager;
import com.gmail.nossr50.runnables.items.ChimaeraWingWarmup;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.CombatUtils;
@@ -135,10 +134,6 @@ public final class ChimaeraWing {
mcMMOPlayer.actualizeChimeraWingLastUse();
mcMMOPlayer.setTeleportCommenceLocation(null);
if (Config.getInstance().getStatsTrackingEnabled()) {
MetricsManager.chimeraWingUsed();
}
if (Config.getInstance().getChimaeraSoundEnabled()) {
player.playSound(location, Sound.BAT_TAKEOFF, Misc.BAT_VOLUME, Misc.BAT_PITCH);
}

View File

@@ -34,6 +34,8 @@ public final class HardcoreManager {
int playerSkillXpLevel = playerProfile.getSkillXpLevel(skillType);
if (playerSkillLevel <= 0 || playerSkillLevel <= levelThreshold) {
levelChanged.put(skillType.toString(), 0);
experienceChanged.put(skillType.toString(), 0F);
continue;
}
@@ -75,6 +77,8 @@ public final class HardcoreManager {
int victimSkillLevel = victimProfile.getSkillLevel(skillType);
if (victimSkillLevel <= 0 || victimSkillLevel < killerSkillLevel / 2 || victimSkillLevel <= levelThreshold) {
levelChanged.put(skillType.toString(), 0);
experienceChanged.put(skillType.toString(), 0F);
continue;
}

View File

@@ -18,7 +18,7 @@ import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
public class UUIDFetcher implements Callable<Map<String, UUID>> {
private static final int PROFILES_PER_REQUEST = 100;
private static final int PROFILES_PER_REQUEST = 50;
private static final long RATE_LIMIT = 100L;
private static final String PROFILE_URL = "https://api.mojang.com/profiles/minecraft";
private final JSONParser jsonParser = new JSONParser();

View File

@@ -447,6 +447,11 @@ Skills:
ChanceMax: 75.0
MaxBonusLevel: 750
# DamagePlayer: Bleeding damage dealt to players
# DamageMobs: Bleeding damage dealt to mobs
DamagePlayer: 1.0
DamageMobs: 2.0
# These settings determine how long the Bleeding effect lasts
MaxTicks: 3
BaseTicks: 2

View File

@@ -14,6 +14,6 @@ Options:
UUIDConvertAmount: 100
# Amount of users to be converted at a time before waiting MojangLimitPeriod milliseconds to begin again
# This setting is for large servers to avoid being temp banned from mojang api
MojangRateLimit: 50000
MojangRateLimit: 300
# Amount of time to wait after hitting the MojangRateLimit in UUID conversion
MojangLimitPeriod: 600000
MojangLimitPeriod: 6000