Force Metrics to submit to TFM even if the plugin is renamed (#119)

This commit is contained in:
Model 3 2018-09-18 06:56:24 -07:00 committed by Seth
parent d58ee9f590
commit 322ed77232
5 changed files with 9 additions and 12 deletions

View File

@ -13,6 +13,7 @@
<orderEntry type="library" name="Maven: org.bstats:bstats-bukkit:1.2" level="project" /> <orderEntry type="library" name="Maven: org.bstats:bstats-bukkit:1.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.9.4-R0.1-SNAPSHOT" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.9.4-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.avaje:ebean:2.8.1" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.avaje:ebean:2.8.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldguard:worldguard-legacy:6.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.0" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot:1.13.1-R0.1-SNAPSHOT" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot:1.13.1-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.Pravian:Aero:5f82926" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: com.github.Pravian:Aero:5f82926" level="project" />

View File

@ -146,7 +146,7 @@
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- Temporaily here due to CoreProtect needing the official worldedit, and because it's <!-- Temporarily here due to CoreProtect needing the official worldedit, and because it's
not on the official maven repo, it needs to be in a lib folder for now. Will be removed not on the official maven repo, it needs to be in a lib folder for now. Will be removed
once 7.0.0 is on the sk89q repo. --> once 7.0.0 is on the sk89q repo. -->
<dependency> <dependency>

View File

@ -31,7 +31,7 @@ public class CommandLoader extends FreedomService
handler.setOnlyPlayerMessage(ChatColor.RED + "This command can only be used by players."); handler.setOnlyPlayerMessage(ChatColor.RED + "This command can only be used by players.");
handler.loadFrom(FreedomCommand.class.getPackage()); handler.loadFrom(FreedomCommand.class.getPackage());
handler.registerAll("TotalFreedomMod", true); handler.registerAll(plugin.getDescription().getName(), true);
FLog.info("Loaded " + handler.getExecutors().size() + " commands."); FLog.info("Loaded " + handler.getExecutors().size() + " commands.");
} }

View File

@ -306,12 +306,12 @@ public class FPlayer
{ {
if (getPlayer() != null) if (getPlayer() != null)
{ {
FUtil.adminAction("TotalFreedom", "Unmuting " + getPlayer().getName(), false); FUtil.adminAction(ConfigEntry.SERVER_NAME.getString(), "Unmuting " + getPlayer().getName(), false);
setMuted(false); setMuted(false);
} }
else else
{ {
FUtil.adminAction("TotalFreedom", "Unmuting " + getName(), false); FUtil.adminAction(ConfigEntry.SERVER_NAME.getString(), "Unmuting " + getName(), false);
plugin.mu.MUTED_PLAYERS.remove(getName()); plugin.mu.MUTED_PLAYERS.remove(getName());
} }
} }
@ -343,7 +343,6 @@ public class FPlayer
this.inAdminchat = inAdminchat; this.inAdminchat = inAdminchat;
} }
public boolean inAdminChat() public boolean inAdminChat()
{ {
return this.inAdminchat; return this.inAdminchat;

View File

@ -18,6 +18,7 @@ import java.util.concurrent.Callable;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.zip.GZIPOutputStream; import java.util.zip.GZIPOutputStream;
import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.HttpsURLConnection;
import me.totalfreedom.totalfreedommod.util.FLog;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -34,7 +35,6 @@ import org.json.simple.JSONObject;
*/ */
public class Metrics public class Metrics
{ {
static static
{ {
// You can use the property to disable the check in your test environment // You can use the property to disable the check in your test environment
@ -91,7 +91,6 @@ public class Metrics
// Check if the config file exists // Check if the config file exists
if (!config.isSet("serverUuid")) if (!config.isSet("serverUuid"))
{ {
// Add default values // Add default values
config.addDefault("enabled", true); config.addDefault("enabled", true);
// Every server gets it's unique random id. // Every server gets it's unique random id.
@ -201,10 +200,9 @@ public class Metrics
{ {
JSONObject data = new JSONObject(); JSONObject data = new JSONObject();
String pluginName = plugin.getDescription().getName();
String pluginVersion = plugin.getDescription().getVersion(); String pluginVersion = plugin.getDescription().getVersion();
data.put("pluginName", pluginName); // Append the name of the plugin data.put("pluginName", "TotalFreedomMod"); // Append the name of the plugin
data.put("pluginVersion", pluginVersion); // Append the version of the plugin data.put("pluginVersion", pluginVersion); // Append the version of the plugin
JSONArray customCharts = new JSONArray(); JSONArray customCharts = new JSONArray();
for (CustomChart customChart : charts) for (CustomChart customChart : charts)
@ -321,7 +319,7 @@ public class Metrics
// Something went wrong! :( // Something went wrong! :(
if (logFailedRequests) if (logFailedRequests)
{ {
plugin.getLogger().log(Level.WARNING, "Could not submit plugin stats of " + plugin.getName(), e); FLog.warning("Could not submit plugin stats of " + plugin.getName() + e);
} }
} }
} }
@ -429,7 +427,7 @@ public class Metrics
{ {
if (logFailedRequests) if (logFailedRequests)
{ {
Bukkit.getLogger().log(Level.WARNING, "Failed to get data for custom chart with id " + chartId, t); FLog.warning("Failed to get data for custom chart with id " + chartId + t);
} }
return null; return null;
} }
@ -768,6 +766,5 @@ public class Metrics
data.put("values", values); data.put("values", values);
return data; return data;
} }
} }
} }