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