Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Commit

Permalink
add some placeholders and debuggers
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Oct 26, 2016
1 parent 3be7189 commit a0d64b4
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
42 changes: 42 additions & 0 deletions src/main/java/com/denizenscript/denizen2sponge/Denizen2Sponge.java
Expand Up @@ -28,6 +28,7 @@
import com.denizenscript.denizen2sponge.spongeevents.Denizen2SpongeLoadedEvent;
import com.denizenscript.denizen2sponge.spongeevents.Denizen2SpongeLoadingEvent;
import com.denizenscript.denizen2sponge.tags.handlers.*;
import com.denizenscript.denizen2sponge.utilities.FlagHelper;
import com.google.inject.Inject;
import org.slf4j.Logger;
import org.spongepowered.api.Sponge;
Expand Down Expand Up @@ -144,6 +145,8 @@ public void onServerStart(GamePreInitializationEvent event) {
Denizen2Core.register(new WorldTagBase());
// Sponge Commands
ExCommand.register();
// Sponge-related Utilities
FlagHelper.registerFlagKeyToEntities();
// Call loading event for sub-plugins registering things
Sponge.getEventManager().post(new Denizen2SpongeLoadingEvent(getGenericCause()));
// Load Denizen2
Expand All @@ -152,8 +155,47 @@ public void onServerStart(GamePreInitializationEvent event) {
Sponge.getScheduler().createTaskBuilder().intervalTicks(1).execute(() -> Denizen2Core.tick(0.05)).submit(this);
// Call loaded event for sub-plugins to listen for
Sponge.getEventManager().post(new Denizen2SpongeLoadedEvent(getGenericCause()));
// TODO: Config option -> readyToSpamEvents = true;
}

/*
private static boolean readyToSpamEvents = false;
private static HashMap<Class, Integer> limiter = new HashMap<>();
@Listener
public void onAnyEvent(Event evt) {
if (readyToSpamEvents) {
if (evt instanceof AITaskEvent
|| evt instanceof SpawnEntityEvent
|| evt instanceof LoadChunkEvent
|| evt instanceof MoveEntityEvent) {
return;
}
if (limiter.containsKey(evt.getClass())) {
int current = limiter.get(evt.getClass());
limiter.put(evt.getClass(), current + 1);
if (current > 100) {
return;
}
}
else {
limiter.put(evt.getClass(), 1);
}
StringBuilder sb = new StringBuilder();
sb.append(evt.getClass().getCanonicalName()).append(":");
Class clz = evt.getClass().getSuperclass();
while (clz != null) {
sb.append(clz.getCanonicalName()).append(",");
clz = clz.getSuperclass();
}
if (sb.length() > 0 && sb.toString().contains("spongepowered")) {
Debug.info("EVENT OCCURRED: " + sb.toString());
}
}
}
*/

public File getMainDirectory() {
return new File("./assets/Denizen/");
}
Expand Down
@@ -0,0 +1,8 @@
package com.denizenscript.denizen2sponge.utilities;

public class FlagHelper {

public static void registerFlagKeyToEntities() {

}
}

0 comments on commit a0d64b4

Please sign in to comment.