Skip to content

Commit

Permalink
Merge branch 'heads/1.6.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
funkemunky committed Nov 1, 2019
2 parents 03cf713 + b38652f commit 2c37536
Show file tree
Hide file tree
Showing 324 changed files with 1,384 additions and 95,537 deletions.
4 changes: 2 additions & 2 deletions AtlasParent/Atlas/buildNumber.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#maven.buildNumber.plugin properties file
#Fri Oct 25 14:29:13 EDT 2019
buildNumber=494
#Thu Oct 31 12:40:00 EDT 2019
buildNumber=517
16 changes: 14 additions & 2 deletions AtlasParent/Atlas/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
<parent>
<artifactId>atlas-parent</artifactId>
<groupId>cc.funkemunky.utils</groupId>
<version>1.6.1</version>
<version>1.6.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>cc.funkemunky.plugins</groupId>
<artifactId>Atlas</artifactId>
<version>1.6.2</version>
<scm>
<connection>scm:svn:http://127.0.0.1/dummy</connection>
<developerConnection>scm:svn:https://127.0.0.1/dummy</developerConnection>
Expand All @@ -24,6 +25,11 @@
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>8</source>
<target>8</target>
<compilerArgument>-XDignore.symbol.file</compilerArgument>
</configuration>
</plugin>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
Expand Down Expand Up @@ -86,7 +92,7 @@
</build>
<repositories>
<repository>
<id>funkemunky</id>
<id>funkemunky-releases</id>
<url>http://nexus.funkemunky.cc/content/repositories/releases/</url>
</repository>
</repositories>
Expand Down Expand Up @@ -193,6 +199,12 @@
<version>1.18.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>cc.funkemunky.utils</groupId>
<artifactId>java-rt</artifactId>
<version>8</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

12 changes: 9 additions & 3 deletions AtlasParent/Atlas/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@

<parent>
<groupId>cc.funkemunky.utils</groupId>
<version>1.6.1</version>
<version>1.6.2</version>
<artifactId>atlas-parent</artifactId>
</parent>

<groupId>cc.funkemunky.plugins</groupId>
<artifactId>Atlas</artifactId>
<version>1.6.2</version>

<scm>
<connection>scm:svn:http://127.0.0.1/dummy</connection>
Expand All @@ -26,6 +27,11 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>8</source>
<target>8</target>
<compilerArgument>-XDignore.symbol.file</compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -97,7 +103,7 @@

<repositories>
<repository>
<id>funkemunky</id>
<id>funkemunky-releases</id>
<url>http://nexus.funkemunky.cc/content/repositories/releases/</url>
</repository>
</repositories>
Expand All @@ -106,7 +112,7 @@
<dependency>
<groupId>cc.funkemunky.utils</groupId>
<artifactId>ProjectCarbon</artifactId>
<version>1.2.1</version>
<version>1.2.2</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
26 changes: 5 additions & 21 deletions AtlasParent/Atlas/src/main/java/cc/funkemunky/api/Atlas.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
import cc.funkemunky.api.metrics.Metrics;
import cc.funkemunky.api.profiling.BaseProfiler;
import cc.funkemunky.api.reflection.CraftReflection;
import cc.funkemunky.api.reflections.Reflections;
import cc.funkemunky.api.reflections.types.WrappedField;
import cc.funkemunky.api.settings.MongoSettings;
import cc.funkemunky.api.tinyprotocol.api.TinyProtocolHandler;
import cc.funkemunky.api.tinyprotocol.api.packets.reflections.Reflections;
import cc.funkemunky.api.tinyprotocol.api.packets.reflections.types.WrappedField;
import cc.funkemunky.api.updater.Updater;
import cc.funkemunky.api.utils.*;
import cc.funkemunky.api.utils.blockbox.BlockBoxManager;
Expand Down Expand Up @@ -71,7 +71,6 @@ public class Atlas extends JavaPlugin {
private File file;
private Yaml yaml;
private Map<UUID, List<Entity>> entities = new ConcurrentHashMap<>();
private boolean clientStatsEnabled;

@ConfigSetting(path = "updater", name = "autoDownload")
private static boolean autoDownload = false;
Expand All @@ -92,8 +91,6 @@ public void onEnable() {
atlasConfig = YamlConfiguration.saveDefaultConfig(this, "config.yml");
consoleSender = Bukkit.getConsoleSender();

clientStatsEnabled = Bukkit.getPluginManager().isPluginEnabled("ClientStats");

MiscUtils.printToConsole(Color.Red + "Loading Atlas...");

MiscUtils.printToConsole(Color.Gray + "Firing up the thread turbines...");
Expand All @@ -116,7 +113,7 @@ public void onEnable() {
updater = new Updater();

runTasks();
initCarbon();
Carbon.init();

MiscUtils.printToConsole(Color.Gray + "Starting scanner...");

Expand Down Expand Up @@ -151,7 +148,7 @@ public void onEnable() {
}
}

Bukkit.getOnlinePlayers().forEach(player -> TinyProtocolHandler.getInstance().addChannel(player));
Bukkit.getOnlinePlayers().forEach(player -> TinyProtocolHandler.getInstance().injectPlayer(player));

MiscUtils.printToConsole(Color.Green + "Successfully loaded Atlas and its utilities!");
done = true;
Expand All @@ -162,8 +159,6 @@ public void onDisable() {
HandlerList.unregisterAll(this);
Bukkit.getScheduler().cancelTasks(this);

Bukkit.getOnlinePlayers().forEach(player -> TinyProtocolHandler.getInstance().removeChannel(player));

eventManager.clearAllRegistered();
getCommandManager().unregisterCommands();

Expand All @@ -179,17 +174,6 @@ public void onDisable() {
MiscUtils.printToConsole(Color.Red + "Completed shutdown process.");
}

private void initCarbon() {
carbon = new Carbon();

if(MongoSettings.enabled) {
carbon.initMongo(MongoSettings.database,
MongoSettings.ip,
MongoSettings.port,
MongoSettings.username,
MongoSettings.password);
}
}

private void shutdownExecutor() {
service.shutdown();
Expand Down Expand Up @@ -223,7 +207,7 @@ public void run() {

entities.put(world.getUID(), bukkitEntities);
}
}, 40L, 2L);
}, 2L, 2L);
}

private static WrappedField entityList = Reflections.getNMSClass("World").getFieldByName("entityList");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import cc.funkemunky.api.utils.Color;
import cc.funkemunky.api.utils.MiscUtils;
import cc.funkemunky.api.utils.Pastebin;
import cc.funkemunky.api.utils.Tuple;
import lombok.val;
import org.apache.commons.lang.time.DateFormatUtils;
import org.bukkit.command.Command;
Expand Down Expand Up @@ -64,9 +65,10 @@ private void makePaste(CommandSender sender, ResultsType type) {

for (String key : results.keySet()) {
//Converting nanoseconds to millis to be more readable.
double amount = results.get(key) / 1000000D;
Tuple<Integer, Double> result = results.get(key);
double amount = result.two / 1000000D;

body.add(key + ": " + amount + "ms");
body.add(key + ": " + amount + "ms (" + result.one + " calls)");
}
StringBuilder builder = new StringBuilder();
for (String aBody : body) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
package cc.funkemunky.api.config.system;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.*;

public final class Configuration
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
package cc.funkemunky.api.config.system;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.io.Writer;
import java.io.*;
import java.util.HashMap;
import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cc.funkemunky.api.events;

import cc.funkemunky.api.tinyprotocol.api.packets.reflections.types.WrappedClass;
import cc.funkemunky.api.tinyprotocol.api.packets.reflections.types.WrappedMethod;
import cc.funkemunky.api.reflections.types.WrappedClass;
import cc.funkemunky.api.reflections.types.WrappedMethod;
import org.bukkit.plugin.Plugin;

import java.lang.reflect.Method;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;

import java.lang.reflect.InvocationTargetException;
import java.util.*;
import java.util.concurrent.FutureTask;
import java.util.HashSet;
import java.util.Set;

@Init
public class PluginLoaderHandler implements Listener {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cc.funkemunky.api.profiling;

import cc.funkemunky.api.Atlas;
import cc.funkemunky.api.utils.Tuple;

import java.util.ArrayList;
import java.util.HashMap;
Expand Down Expand Up @@ -67,31 +68,32 @@ public void reset() {
samples.clear();
}

//Returns Tuple<Total Calls, Result>
@Override
public Map<String, Double> results(ResultsType type) {
Map<String, Double> toReturn = new HashMap<>();
public Map<String, Tuple<Integer, Double>> results(ResultsType type) {
Map<String, Tuple<Integer, Double>> toReturn = new HashMap<>();
switch(type) {
case TOTAL: {
for (String key : total.keySet()) {
toReturn.put(key, total.get(key) / (double) calls.get(key));
toReturn.put(key, new Tuple<>(calls.get(key), total.get(key) * ((double) calls.get(key) / totalCalls)));
}
break;
}
case AVERAGE: {
for (String key : samplesTotal.keySet()) {
toReturn.put(key, samplesTotal.get(key).stream().mapToLong(val -> val).average().orElse(0));
toReturn.put(key, new Tuple<>(calls.get(key), samplesTotal.get(key).stream().mapToLong(val -> val).average().orElse(0)));
}
break;
}
case SAMPLES: {
for (String key : samples.keySet()) {
toReturn.put(key, (double)samples.get(key));
toReturn.put(key, new Tuple<>(calls.get(key), (double)samples.get(key)));
}
break;
}
case TICK: {
for(String key : averageSamples.keySet()) {
toReturn.put(key, (double)averageSamples.get(key));
toReturn.put(key, new Tuple<>(calls.get(key), (double)averageSamples.get(key)));
}
break;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package cc.funkemunky.api.profiling;

import cc.funkemunky.api.utils.Tuple;

import java.util.Map;

public interface Profiler {
Expand All @@ -15,5 +17,5 @@ public interface Profiler {

void reset();

Map<String, Double> results(ResultsType type);
Map<String, Tuple<Integer, Double>> results(ResultsType type);
}
Loading

0 comments on commit 2c37536

Please sign in to comment.