Add new commands to metrics
This commit is contained in:
parent
3536bf63c3
commit
64f9da47c9
@ -85,6 +85,8 @@ public class CopyDisguiseCommand implements CommandExecutor {
|
||||
sendMessage(sender, LibsMsg.CLICK_TO_COPY_WITH_SKIN, DisguiseParser.parseToString(disguise), true);
|
||||
}
|
||||
|
||||
DisguiseUtilities.setCopyDisguiseCommandUsed();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -141,6 +141,8 @@ public class GrabSkinCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
sender.spigot().sendMessage(builder.create());
|
||||
|
||||
DisguiseUtilities.setGrabSkinCommandUsed();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -164,6 +164,8 @@ public class SaveDisguiseCommand implements CommandExecutor {
|
||||
try {
|
||||
DisguiseAPI.addCustomDisguise(name, disguiseString);
|
||||
sender.sendMessage(LibsMsg.CUSTOM_DISGUISE_SAVED.get(name));
|
||||
|
||||
DisguiseUtilities.setSaveDisguiseCommandUsed();
|
||||
}
|
||||
catch (DisguiseParseException e) {
|
||||
if (e.getMessage() != null) {
|
||||
|
@ -8,7 +8,6 @@ import com.comphenix.protocol.wrappers.*;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.PropertyMap;
|
||||
import me.libraryaddict.disguise.DisguiseAPI;
|
||||
import me.libraryaddict.disguise.DisguiseConfig;
|
||||
@ -79,7 +78,7 @@ public class DisguiseUtilities {
|
||||
private static File profileCache = new File("plugins/LibsDisguises/GameProfiles"), savedDisguises = new File(
|
||||
"plugins/LibsDisguises/SavedDisguises");
|
||||
private static Gson gson;
|
||||
private static boolean pluginsUsed, commandsUsed;
|
||||
private static boolean pluginsUsed, commandsUsed, copyDisguiseCommandUsed, grabSkinCommandUsed, saveDisguiseCommandUsed;
|
||||
private static long libsDisguisesCalled;
|
||||
/**
|
||||
* Keeps track of what tick this occured
|
||||
@ -108,6 +107,30 @@ public class DisguiseUtilities {
|
||||
return player.getEntityId() == velocityID && (player.getWorld().getTime() - velocityTime) < 3;
|
||||
}
|
||||
|
||||
public static void setGrabSkinCommandUsed() {
|
||||
grabSkinCommandUsed = true;
|
||||
}
|
||||
|
||||
public static void setCopyDisguiseCommandUsed() {
|
||||
copyDisguiseCommandUsed = true;
|
||||
}
|
||||
|
||||
public static void setSaveDisguiseCommandUsed() {
|
||||
saveDisguiseCommandUsed = true;
|
||||
}
|
||||
|
||||
public static boolean isGrabSkinCommandUsed() {
|
||||
return grabSkinCommandUsed;
|
||||
}
|
||||
|
||||
public static boolean isCopyDisguiseCommandUsed() {
|
||||
return copyDisguiseCommandUsed;
|
||||
}
|
||||
|
||||
public static boolean isSaveDisguiseCommandUsed() {
|
||||
return saveDisguiseCommandUsed;
|
||||
}
|
||||
|
||||
public static void setPluginsUsed() {
|
||||
if (libsDisguisesCalled > System.currentTimeMillis()) {
|
||||
return;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package me.libraryaddict.disguise.utilities.metrics;
|
||||
|
||||
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.ServicePriority;
|
||||
@ -89,8 +90,7 @@ public class Metrics {
|
||||
// Inform the server owners about bStats
|
||||
config.options()
|
||||
.header("bStats collects some data for plugin authors like how many servers are using their " +
|
||||
"plugins.\n" +
|
||||
"To honor their work, you should not disable it.\n" +
|
||||
"plugins.\n" + "To honor their work, you should not disable it.\n" +
|
||||
"This has nearly no effect on the server performance!\n" +
|
||||
"Check out https://bStats.org/ to learn more :)").copyDefaults(true);
|
||||
try {
|
||||
@ -121,6 +121,8 @@ public class Metrics {
|
||||
// We are the first!
|
||||
startSubmitting();
|
||||
}
|
||||
} else {
|
||||
DisguiseUtilities.getLogger().info("The author sees Metrics disabled, the author is sad");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1027,6 +1029,5 @@ public class Metrics {
|
||||
public static Country byLocale(Locale locale) {
|
||||
return byIsoTag(locale.getCountry());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -68,6 +68,27 @@ public class MetricsInitalizer {
|
||||
premiumType = "Free Builds";
|
||||
}
|
||||
|
||||
metrics.addCustomChart(new Metrics.SimplePie("grabskin_command") {
|
||||
@Override
|
||||
public String getValue() {
|
||||
return "" + DisguiseUtilities.isGrabSkinCommandUsed();
|
||||
}
|
||||
});
|
||||
|
||||
metrics.addCustomChart(new Metrics.SimplePie("save_disguise_command") {
|
||||
@Override
|
||||
public String getValue() {
|
||||
return "" + DisguiseUtilities.isSaveDisguiseCommandUsed();
|
||||
}
|
||||
});
|
||||
|
||||
metrics.addCustomChart(new Metrics.SimplePie("copydisguise_command") {
|
||||
@Override
|
||||
public String getValue() {
|
||||
return "" + DisguiseUtilities.isCopyDisguiseCommandUsed();
|
||||
}
|
||||
});
|
||||
|
||||
metrics.addCustomChart(new Metrics.SimplePie("premium") {
|
||||
@Override
|
||||
public String getValue() {
|
||||
|
Loading…
Reference in New Issue
Block a user