Removed the additional metrics data that actually wasn't working before,

may recode in the future.
This commit is contained in:
sekwah41 2014-10-28 14:47:01 +00:00
parent 9482b17e4d
commit dff5950659
4 changed files with 58 additions and 74 deletions

View File

@ -17,6 +17,45 @@ public class AdvancedPortalsPlugin extends JavaPlugin {
public void onEnable() {
try {
Metrics metrics = new Metrics(this);
metrics.start();
} catch (IOException e) {
// Failed to submit the stats :-(
}
this.getServer().getConsoleSender().sendMessage("§aAdvanced portals have been sucsessfully enabled!");
String packageName = getServer().getClass().getPackage().getName();
String[] packageSplit = packageName.split("\\.");
String version = packageSplit[packageSplit.length - 1];
try {
Class<?> nmsClass = Class.forName("com.sekwah.advancedportals.compat." + version);
if(NMS.class.isAssignableFrom(nmsClass)){
this.nmsAccess = (NMS) nmsClass.getConstructor().newInstance();
}else
{
System.out.println("Something went wrong, please notify the author and tell them this version v:" + version);
this.setEnabled(false);
}
} catch (ClassNotFoundException e) {
System.out.println("This version of craftbukkit is not yet supported, please notify the author and give them this version v:" + version);
this.setEnabled(false);
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (SecurityException e) {
e.printStackTrace();
}
new Assets(this);
// Opens a channel that messages bungeeCord
@ -55,50 +94,7 @@ public class AdvancedPortalsPlugin extends JavaPlugin {
Selection.LoadData(this);
try {
Metrics metrics = new Metrics(this);
metrics.start();
} catch (IOException e) {
// Failed to submit the stats :-(
}
this.getServer().getConsoleSender().sendMessage("§aAdvanced portals have been sucsessfully enabled!");
String packageName = getServer().getClass().getPackage().getName();
String[] packageSplit = packageName.split("\\.");
String version = packageSplit[packageSplit.length - 1];
try {
Class<?> nmsClass = Class.forName("com.sekwah.advancedportals.compat." + version);
if(NMS.class.isAssignableFrom(nmsClass)){
this.nmsAccess = (NMS) nmsClass.getConstructor().newInstance();
}else
{
System.out.println("Something went wrong, please notify the author and tell them this version v:" + version);
this.setEnabled(false);
}
} catch (ClassNotFoundException e) {
System.out.println("This version of craftbukkit is not yet supported, please notify the author and give them this version v:" + version);
this.setEnabled(false);
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NoSuchMethodException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
DataCollector.setupMetrics();
}

View File

@ -1,12 +1,18 @@
package com.sekwah.advancedportals.DataCollector;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
import com.sekwah.advancedportals.destinations.Destination;
import com.sekwah.advancedportals.metrics.Metrics;
import com.sekwah.advancedportals.metrics.Metrics.Graph;
import com.sekwah.advancedportals.portalcontrolls.AdvancedPortal;
import com.sekwah.advancedportals.portalcontrolls.Portal;
import org.bukkit.Material;
public class DataCollector {
@ -22,12 +28,12 @@ public class DataCollector {
*
*/
public static void playerWarped() {
/**public static void playerWarped() {
try {
Metrics metrics = new Metrics(plugin);
Graph TotalWarps = metrics.createGraph("Total Warps");
TotalWarps.addPlotter(new Metrics.Plotter("Internal Warps") {
@Override
@ -37,45 +43,32 @@ public class DataCollector {
});
/**TotalWarps.addPlotter(new Metrics.Plotter("Iron Sword") {
// can be used to add more data to the graph, can be in a pie chart or multiple lines on one graph
@Override
public int getValue() {
return 17;
}
});*/
metrics.start();
} catch (IOException e) {
plugin.getLogger().log(Level.SEVERE, "Could not submit data", e);
}
}
}*/
public static void portalCreated(String triggerName) {
public static void setupMetrics() {
try {
Metrics metrics = new Metrics(plugin);
Graph TotalWarps = metrics.createGraph("Portal Trigger Blocks");
/**List<Material> MaterialList = new ArrayList<Material>();
for(AdvancedPortal portal : Portal.Portals){
MaterialList.add(portal.trigger);
}*/
TotalWarps.addPlotter(new Metrics.Plotter(triggerName) {
/**TotalWarps.addPlotter(new Metrics.Plotter(triggerName) {
@Override
public int getValue() {
return 1; // number of portals created
}
});
/**TotalWarps.addPlotter(new Metrics.Plotter("Iron Sword") {
// can be used to add more data to the graph, can be in a pie chart or multiple lines on one graph
@Override
public int getValue() {
return 17;
}
});*/
metrics.start();
} catch (IOException e) {
plugin.getLogger().log(Level.SEVERE, "Could not submit data", e);
}

View File

@ -108,9 +108,6 @@ public class Listeners implements Listener {
player.teleport(fromloc);
event.setCancelled(true);
}
else{
DataCollector.playerWarped();
}
if(Portal.Portals[portalId].trigger.equals(Material.PORTAL)){
final Player finalplayer = event.getPlayer();

View File

@ -163,8 +163,6 @@ public class Portal {
config.saveConfig();
DataCollector.portalCreated(triggerBlock.toString());
loadPortals();
return "§aPortal creation successful!";