Added the class stubs for Achievements support.

This commit is contained in:
Pascal Koenig
2011-09-03 01:58:29 +02:00
parent 184ccb3cf3
commit 4381237315
6 changed files with 77 additions and 3 deletions

View File

@@ -0,0 +1,12 @@
/**
*
*/
package de.sockenklaus.XmlStats.Datasource;
/**
* @author socrates
*
*/
public class AchievementsDS extends Datasource {
}

View File

@@ -81,6 +81,9 @@ public class Webserver {
server.createContext("/userstats.xml", new XmlWorkerUserstats());
XmlStats.LogInfo("Stats seems to be loaded correctly. Enabling /userstats.xml");
}
else {
XmlStats.LogWarn("Stats not loaded correctly. Disabling /userstats.xml");
}
if (XmlStats.isiConomyHooked()){
server.createContext("/money.xml", new XmlWorkerMoney());
@@ -90,6 +93,13 @@ public class Webserver {
XmlStats.LogWarn("iConomy not loaded correctly. Disabling /money.xml");
}
if(XmlStats.isAchievementsHooked()){
server.createContext("/achievements.xml", new XmlWorkerAchievements());
}
else {
XmlStats.LogWarn("Achievements not loaded correctly. Disabling /achievements.xml");
}
this.server.start();
}
}

View File

@@ -23,6 +23,7 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import com.iConomy.iConomy;
import com.nidefawl.Achievements.Achievements;
import com.nidefawl.Stats.Stats;
// TODO: Auto-generated Javadoc
@@ -142,7 +143,8 @@ public class XmlStats extends JavaPlugin {
protected void hookPlugins(){
Plugin StatsTemp = getServer().getPluginManager().getPlugin("Stats");
Plugin iConomyTemp = getServer().getPluginManager().getPlugin("iConomy");
Plugin AchievementsTemp = getServer().getPluginManager().getPlugin("Achievements");
if(StatsTemp != null){
if(StatsTemp.isEnabled() && StatsTemp.getClass().getName().equals("com.nidefawl.Stats.Stats")){
XmlStatsRegistry.put("stats", (Stats)StatsTemp);
@@ -150,8 +152,19 @@ public class XmlStats extends JavaPlugin {
}
}
else {
LogError("Stats not found! Can't hook into it.");
LogWarn("Stats not found! Can't hook into it.");
}
if(AchievementsTemp != null){
if(AchievementsTemp.isEnabled() && AchievementsTemp.getClass().getName().equals("com.nidefawl.Achievements.Achievements")){
XmlStatsRegistry.put("achievements", (Achievements)AchievementsTemp);
LogInfo("Hooked into Achievements!");
}
}
else {
LogWarn("Achievements not found! Can't hook into it.");
}
if (iConomyTemp != null) {
if (iConomyTemp.isEnabled() && iConomyTemp.getClass().getName().equals("com.iConomy.iConomy")) {
XmlStatsRegistry.put("iconomy", (iConomy)iConomyTemp);
@@ -159,7 +172,7 @@ public class XmlStats extends JavaPlugin {
}
}
else {
LogError("iConomy not found! Can't hook into it.");
LogWarn("iConomy not found! Can't hook into it.");
}
}
@@ -190,6 +203,20 @@ public class XmlStats extends JavaPlugin {
}
return false;
}
/**
* Checks if is Achievements hooked.
*
* @return true, if is Achievements hooked
*/
public static boolean isAchievementsHooked(){
Achievements AchievementsTemp = (Achievements)XmlStatsRegistry.get("achievments");
if (AchievementsTemp != null){
if(AchievementsTemp.getClass().getName().equals("com.nidefawl.Achievements.Achievements") && AchievementsTemp.isEnabled()) return true;
}
return false;
}
/* (non-Javadoc)
* @see org.bukkit.plugin.java.JavaPlugin#onCommand(org.bukkit.command.CommandSender, org.bukkit.command.Command, java.lang.String, java.lang.String[])

View File

@@ -0,0 +1,24 @@
/**
*
*/
package de.sockenklaus.XmlStats.XmlWorkers;
import java.util.List;
import java.util.Map;
/**
* @author socrates
*
*/
public class XmlWorkerAchievements extends XmlWorker {
/* (non-Javadoc)
* @see de.sockenklaus.XmlStats.XmlWorkers.XmlWorker#getXML(java.util.Map)
*/
@Override
String getXML(Map<String, List<String>> parameters) {
// TODO Auto-generated method stub
return null;
}
}