mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-21 23:51:29 +01:00
1.5.2 - Added Bukkit's own Data
BukkitDataHook and methods to remove extra data points with new collisions. Plade Age analysis method.
This commit is contained in:
parent
9375797ca8
commit
615b4994b5
@ -3,12 +3,12 @@
|
||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
||||
<group>
|
||||
<file>file:/C:/Users/Risto/Documents/NetBeansProjects/Plan/src/com/djrapitops/plan/command/hooks/EssentialsHook.java</file>
|
||||
<file>file:/C:/Users/Risto/Documents/NetBeansProjects/Plan/src/config.yml</file>
|
||||
<file>file:/C:/Users/Risto/Documents/NetBeansProjects/Plan/src/com/djrapitops/plan/command/utils/Analysis.java</file>
|
||||
<file>file:/C:/Users/Risto/Documents/NetBeansProjects/Plan/src/com/djrapitops/plan/command/commands/SearchCommand.java</file>
|
||||
<file>file:/C:/Users/Risto/Documents/NetBeansProjects/Plan/src/com/djrapitops/plan/command/commands/AnalyzeCommand.java</file>
|
||||
<file>file:/C:/Users/Risto/Documents/NetBeansProjects/Plan/src/com/djrapitops/plan/command/hooks/BukkitDataHook.java</file>
|
||||
<file>file:/C:/Users/Risto/Documents/NetBeansProjects/Plan/src/com/djrapitops/plan/Plan.java</file>
|
||||
<file>file:/C:/Users/Risto/Documents/NetBeansProjects/Plan/src/com/djrapitops/plan/command/utils/DataFormatUtils.java</file>
|
||||
<file>file:/C:/Users/Risto/Documents/NetBeansProjects/Plan/src/com/djrapitops/plan/PlanCommand.java</file>
|
||||
<file>file:/C:/Users/Risto/Documents/NetBeansProjects/Plan/src/com/djrapitops/plan/command/utils/DataUtils.java</file>
|
||||
<file>file:/C:/Users/Risto/Documents/NetBeansProjects/Plan/src/plugin.yml</file>
|
||||
</group>
|
||||
</open-files>
|
||||
|
@ -10,6 +10,7 @@ import com.djrapitops.plan.command.hooks.SuperbVoteHook;
|
||||
import com.djrapitops.plan.command.hooks.TownyHook;
|
||||
import com.djrapitops.plan.command.hooks.VaultHook;
|
||||
import com.djrapitops.plan.command.hooks.AdvancedAchievementsHook;
|
||||
import com.djrapitops.plan.command.hooks.BukkitDataHook;
|
||||
import com.djrapitops.plan.command.utils.DataUtils;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
@ -101,7 +102,7 @@ public class Plan extends JavaPlugin {
|
||||
public List<String> hookInit() {
|
||||
this.hooks.clear();
|
||||
List<String> hookFail = new ArrayList<>();
|
||||
String[] pluginsArray = {"OnTime", "Essentials", "Towny", "Vault", "Factions", "SuperbVote", "AdvancedAchievements"};
|
||||
String[] pluginsArray = {"OnTime", "Essentials", "Towny", "Vault", "Factions", "SuperbVote", "AdvancedAchievements", "BukkitData"};
|
||||
List<String> plugins = new ArrayList<>();
|
||||
plugins.addAll(Arrays.asList(pluginsArray));
|
||||
plugins.parallelStream().forEach((pluginName) -> {
|
||||
|
49
src/com/djrapitops/plan/command/hooks/BukkitDataHook.java
Normal file
49
src/com/djrapitops/plan/command/hooks/BukkitDataHook.java
Normal file
@ -0,0 +1,49 @@
|
||||
package com.djrapitops.plan.command.hooks;
|
||||
|
||||
import com.djrapitops.plan.Plan;
|
||||
import com.djrapitops.plan.UUIDFetcher;
|
||||
import java.util.HashMap;
|
||||
import static org.bukkit.Bukkit.getOfflinePlayer;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
public class BukkitDataHook implements Hook {
|
||||
|
||||
private final Plan plugin;
|
||||
|
||||
public BukkitDataHook(Plan p) throws Exception {
|
||||
plugin = p;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<String, String> getData(String player) throws Exception {
|
||||
HashMap<String, String> data = new HashMap<>();
|
||||
OfflinePlayer p = getOfflinePlayer(UUIDFetcher.getUUIDOf(player));
|
||||
if (p.hasPlayedBefore()) {
|
||||
data.put("BUK-REGISTERED", "" + p.getFirstPlayed());
|
||||
data.put("BUK-LAST LOGIN", "" + p.getLastPlayed());
|
||||
if (p.isBanned()) {
|
||||
data.put("BUK-BANNED", "" + p.isBanned());
|
||||
}
|
||||
data.put("BUK-ONLINE", "" + p.isOnline());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<String, String> getAllData(String player) throws Exception {
|
||||
HashMap<String, String> data = new HashMap<>();
|
||||
data.putAll(getData(player));
|
||||
OfflinePlayer p = getOfflinePlayer(UUIDFetcher.getUUIDOf(player));
|
||||
Location loc = p.getBedSpawnLocation();
|
||||
if (p.hasPlayedBefore()) {
|
||||
if (loc != null) {
|
||||
data.put("BUK-BED LOCATION WORLD", loc.getWorld().getName());
|
||||
data.put("BUK-BED LOCATION", " X:" + loc.getBlockX() + " Y:" + loc.getBlockY() + " Z:" + loc.getBlockZ());
|
||||
}
|
||||
data.put("BUK-UUID", "" + p.getUniqueId());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
@ -21,7 +21,7 @@ public class Analysis {
|
||||
String[] ignore = {"ESS-BAN REASON", "ESS-OPPED", "ESS-MUTE TIME", "ESS-LOCATION", "ESS-HUNGER", "ESS-LOCATION WORLD",
|
||||
"ESS-NICKNAME", "ESS-UUID", "FAC-FACTION", "ONT-LAST LOGIN", "TOW-TOWN", "TOW-REGISTERED",
|
||||
"TOW-LAST LOGIN", "TOW-OWNER OF", "TOW-PLOT PERMS", "TOW-PLOT OPTIONS", "TOW-FRIENDS", "ESS-ONLINE SINCE",
|
||||
"ESS-OFFLINE SINCE"};
|
||||
"ESS-OFFLINE SINCE", "BUK-BED LOCATION", "BUK-BED LOCATION WORLD", "BUK-UUID", "BUK-LAST LOGIN", "BUK-REGISTERED"};
|
||||
List<String> ignoreKeys = new ArrayList<>();
|
||||
try {
|
||||
AdvancedAchievementsHook aaHook = (AdvancedAchievementsHook) plugin.getHooks().get("AdvancedAchievements");
|
||||
@ -50,8 +50,8 @@ public class Analysis {
|
||||
|
||||
// Define analysis method for keys
|
||||
String[] numbers = {"AAC-ACHIEVEMENTS", "ESS-HEALTH", "ESS-XP LEVEL", "FAC-POWER", "FAC-POWER PER HOUR",
|
||||
"FAC-POWER PER DEATH", "SVO-VOTES", "ONT-TOTAL VOTES", "ONT-TOTAL REFERRED", "ECO-BALANCE"};
|
||||
String[] booleanValues = {"ESS-BANNED", "ESS-JAILED", "ESS-MUTED", "ESS-FLYING", "TOW-ONLINE"};
|
||||
"FAC-POWER PER DEATH", "SVO-VOTES", "ONT-TOTAL VOTES", "ONT-TOTAL REFERRED", "ECO-BALANCE", "DEM-AGE"};
|
||||
String[] booleanValues = {"ESS-BANNED", "ESS-JAILED", "ESS-MUTED", "ESS-FLYING", "TOW-ONLINE", "BUK-BANNED", "BUK-ONLINE"};
|
||||
String[] timeValues = {"ONT-TOTAL PLAY"};
|
||||
|
||||
List<String> numberKeys = new ArrayList<>();
|
||||
|
@ -75,8 +75,25 @@ public class DataFormatUtils {
|
||||
data.remove("ONT-TOTAL VOTES");
|
||||
}
|
||||
}
|
||||
// Remove Bukkit data points if plugin present
|
||||
if (data.get("ONT-LAST LOGIN") != null || data.get("TOW-LAST LOGIN") != null) {
|
||||
data.remove("BUK-LAST LOGIN");
|
||||
}
|
||||
if (data.get("TOW-REGISTERED") != null) {
|
||||
data.remove("BUK-REGISTERED");
|
||||
}
|
||||
if (data.get("TOW-ONLINE") != null) {
|
||||
data.remove("BUK-ONLINE");
|
||||
}
|
||||
if (data.get("ESS-BANNED") != null) {
|
||||
data.remove("BUK-BANNED");
|
||||
}
|
||||
if (data.get("ESS-UUID") != null) {
|
||||
data.remove("BUK-UUID");
|
||||
}
|
||||
|
||||
// Format TimeStamps
|
||||
String[] keysTimestamp = {"ONT-LAST LOGIN"};
|
||||
String[] keysTimestamp = {"ONT-LAST LOGIN", "BUK-LAST LOGIN", "BUK-REGISTERED"};
|
||||
for (String key : keysTimestamp) {
|
||||
if (data.get(key) != null) {
|
||||
try {
|
||||
|
@ -1,6 +1,7 @@
|
||||
debug: true
|
||||
|
||||
visible:
|
||||
bukkitdata: true
|
||||
ontime: true
|
||||
essentials: true
|
||||
factions: true
|
||||
|
@ -1,6 +1,6 @@
|
||||
name: Plan
|
||||
main: com.djrapitops.plan.Plan
|
||||
version: 1.5.1
|
||||
version: 1.5.2
|
||||
|
||||
commands:
|
||||
plan:
|
||||
|
Loading…
Reference in New Issue
Block a user