Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scoreboard, Tag & villager trades requirement support #719

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
bcad995
Update build number towards new release.
Staartvin Feb 26, 2017
5173139
Update build number towards development.
Staartvin Feb 26, 2017
56dd6a2
Add the option to define custom descriptions for requirements.
Staartvin Feb 27, 2017
fb0b1f3
Fix NullPointerException when asynchronously updating cached leaderboard
Staartvin Feb 27, 2017
6b5de93
Make a start on activity tracking.
Staartvin Feb 27, 2017
9cb4ce9
Add an /ar activity command and implement activity tracker.
Staartvin Mar 1, 2017
0df8d09
Add reset command to reset completed paths.
Staartvin Mar 1, 2017
202f200
Move debug message to debug message method.
Staartvin Mar 1, 2017
868f7da
Add auto completion (with tab) for performing commands.
Staartvin Mar 1, 2017
7315491
Adding Junit to Maven pom.xml
Staartvin Mar 1, 2017
4b06b1a
Remove test method call.
Staartvin Mar 2, 2017
34c6cf2
Add warning when AFK was enabled but Statz is not installed.
Staartvin Mar 2, 2017
f5ea096
Tidy up /ar hooks command.
Staartvin Mar 2, 2017
f79cfe2
Only close MySQL connection when it is open in the first place.
Staartvin Mar 2, 2017
ba48064
Update build number towards next beta release.
Staartvin Mar 2, 2017
b866504
Update build number towards development.
Staartvin Mar 2, 2017
1e0a2ba
Fix typo in reset command.
Staartvin Mar 5, 2017
2afe886
Almost missed one.
Staartvin Mar 5, 2017
1697296
Paths will now automatically be assigned if possible to a player.
Staartvin Mar 5, 2017
ec2ef50
Add AdvancedAchievement and uSkyBlock requirements.
Staartvin Mar 5, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make a start on activity tracking.
  • Loading branch information
Staartvin committed Feb 27, 2017
commit 6b5de93bdb6c59fd3cf67ddec7685c1688d3a13b
59 changes: 36 additions & 23 deletions src/me/armar/plugins/autorank/Autorank.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

import me.armar.plugins.autorank.activity.ActivityTracker;
import me.armar.plugins.autorank.activity.ActivityTracker.ActionType;
import me.armar.plugins.autorank.addons.AddOnManager;
import me.armar.plugins.autorank.api.API;
import me.armar.plugins.autorank.backup.BackupManager;
Expand All @@ -24,6 +26,7 @@
import me.armar.plugins.autorank.language.LanguageHandler;
import me.armar.plugins.autorank.leaderboard.LeaderboardHandler;
import me.armar.plugins.autorank.listeners.PlayerJoinListener;
import me.armar.plugins.autorank.listeners.PlayerQuitListener;
import me.armar.plugins.autorank.pathbuilder.PathManager;
import me.armar.plugins.autorank.pathbuilder.builders.RequirementBuilder;
import me.armar.plugins.autorank.pathbuilder.builders.ResultBuilder;
Expand Down Expand Up @@ -99,7 +102,7 @@
*
*/
public class Autorank extends JavaPlugin {

public static Autorank getAutorank() {
return (Autorank) Bukkit.getPluginManager().getPlugin("Autorank");
}
Expand All @@ -108,7 +111,7 @@ public static Autorank getAutorank() {
//
//
//

// Managers
private PathManager pathManager;
private AddOnManager addonManager;
Expand Down Expand Up @@ -176,6 +179,11 @@ public void onDisable() {
// Save playerdata.yml
this.getPlayerDataConfig().saveConfig();

// ------------- Make sure to log everyone out of the server
for (Player p : this.getServer().getOnlinePlayers()) {
this.getActivityTracker().addAction(p.getUniqueId(), ActionType.LOGGED_OUT);
}

// ------------- Say bye-bye -------------

getLogger().info(String.format("Autorank %s has been disabled!", getDescription().getVersion()));
Expand Down Expand Up @@ -245,9 +253,9 @@ public void onEnable() {

// Create leaderboard class
setLeaderboardManager(new LeaderboardHandler(this));

// Start up ActivityTracker
//setActivityTracker(new ActivityTracker(this));
setActivityTracker(new ActivityTracker(this));

// ------------- Initialize storage -------------

Expand All @@ -267,17 +275,17 @@ public void onEnable() {

// Load uuids - ready for new ones
getUUIDStorage().createNewFiles();

// Load data converter
setDataConverter(new DataConverter(this));

// ------------- Create files & folders -------------

// Setup language file
languageHandler.createNewFile();

// Load Activity tracker file
//this.getActivityTracker().loadWorkingFile();
this.getActivityTracker().loadWorkingFile();

// ------------- Initialize requirements and results -------------
this.initializeReqsAndRes();
Expand All @@ -289,6 +297,7 @@ public void onEnable() {

// Register listeners
getServer().getPluginManager().registerEvents(new PlayerJoinListener(this), this);
getServer().getPluginManager().registerEvents(new PlayerQuitListener(this), this);

// ------------- Schedule tasks -------------

Expand All @@ -310,41 +319,44 @@ public void run() {
// After dependencies, load paths
// Initialize paths
getPathManager().initialiseFromConfigs();
// Validate paths

// Validate paths
if (!getValidateHandler().startValidation()) {
getServer().getConsoleSender().sendMessage("[Autorank] " + ChatColor.RED + "Detected errors in your Paths.yml file. Log in to your server to see the problems!");
getServer().getConsoleSender().sendMessage("[Autorank] " + ChatColor.RED
+ "Detected errors in your Paths.yml file. Log in to your server to see the problems!");
}

// Show warnings (if there are any)

HashMap<String, Integer> warnings = getWarningManager().getWarnings();

if (warnings.size() > 0) {
getLogger().warning("Autorank has some warnings for you: ");
}

for (Entry<String, Integer> entry : warnings.entrySet()) {
getLogger().warning("(Priority " + entry.getValue() + ") '" + entry.getKey() + "'");
}

}
}, 1L);

// Remove old data of players
getServer().getScheduler().runTaskTimerAsynchronously(this, new Runnable() {
@Override
public void run() {
if (!getSettingsConfig().shouldRemoveOldEntries()) return;

if (!getInternalPropertiesConfig().isConvertedToNewFormat()) return;

if (!getSettingsConfig().shouldRemoveOldEntries())
return;

if (!getInternalPropertiesConfig().isConvertedToNewFormat())
return;

// Remove old entries
int removed = getFlatFileManager().removeOldEntries();

getLogger().info("Removed " + removed + " old data entries from database!");
}
}, 0, (long) AutorankTools.TICKS_PER_MINUTE*60*24);
}, 0, (long) AutorankTools.TICKS_PER_MINUTE * 60 * 24);

// ------------- Register commands -------------

Expand Down Expand Up @@ -386,12 +398,12 @@ public void run() {

// ------------- Say Welcome! -------------
getLogger().info(String.format("Autorank %s has been enabled!", getDescription().getVersion()));

// Run converter to Autorank 4.0
getServer().getScheduler().runTaskLaterAsynchronously(this, new Runnable() {
@Override
public void run() {

// Convert to new format (Autorank 4.0) if needed
if (!getInternalPropertiesConfig().isConvertedToNewFormat()) {
getDataConverter().convertData();
Expand Down Expand Up @@ -457,7 +469,8 @@ private void initializeReqsAndRes() {
res.registerResult("command", CommandResult.class);
res.registerResult("effect", EffectResult.class);
res.registerResult("message", MessageResult.class);
//res.registerResult("rank change", RankChangeResult.class); -- Temporarily disabled until fixed
// res.registerResult("rank change", RankChangeResult.class); --
// Temporarily disabled until fixed
res.registerResult("tp", TeleportResult.class);
res.registerResult("firework", SpawnFireworkResult.class);
res.registerResult("money", MoneyResult.class);
Expand Down
Loading