mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2025-01-20 23:21:25 +01:00
Debugging
This commit is contained in:
parent
a73a548b6e
commit
c03fab0653
11
pom.xml
11
pom.xml
@ -58,6 +58,7 @@
|
||||
<includes>
|
||||
<include>io.github.dre2n:commons</include>
|
||||
<include>io.github.dre2n:caliburn</include>
|
||||
<include>io.github.dre2n:debukkit</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
@ -84,6 +85,11 @@
|
||||
<artifactId>commons</artifactId>
|
||||
<version>1.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.github.dre2n</groupId>
|
||||
<artifactId>debukkit</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.github.dre2n</groupId>
|
||||
<artifactId>caliburn</artifactId>
|
||||
@ -115,6 +121,11 @@
|
||||
<artifactId>BetonQuest</artifactId>
|
||||
<version>1.8.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.boydti</groupId>
|
||||
<artifactId>fawe-api</artifactId>
|
||||
<version>3.5.0-dev</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<repositories>
|
||||
<repository>
|
||||
|
@ -208,6 +208,9 @@ public class DungeonsXL extends BRPlugin {
|
||||
|
||||
// Stop shedulers
|
||||
getServer().getScheduler().cancelTasks(this);
|
||||
|
||||
// DebukkIt
|
||||
debug.save();
|
||||
}
|
||||
|
||||
// Init.
|
||||
@ -650,4 +653,7 @@ public class DungeonsXL extends BRPlugin {
|
||||
return dGroups;
|
||||
}
|
||||
|
||||
// DebukkIt
|
||||
public final io.github.dre2n.debukkit.DebukkIt debug = new io.github.dre2n.debukkit.DebukkIt(this);
|
||||
|
||||
}
|
||||
|
@ -139,6 +139,7 @@ public class PlayerListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onInteract(PlayerInteractEvent event) {
|
||||
plugin.debug.start("PlayerListener#onInteract");
|
||||
Player player = event.getPlayer();
|
||||
DGlobalPlayer dGlobalPlayer = dPlayers.getByPlayer(player);
|
||||
Block clickedBlock = event.getClickedBlock();
|
||||
@ -291,7 +292,7 @@ public class PlayerListener implements Listener {
|
||||
if (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||
dPlayer.setDClass(ChatColor.stripColor(classSign.getLine(1)));
|
||||
}
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -302,6 +303,7 @@ public class PlayerListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
plugin.debug.end("PlayerListener#onInteract", true);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
@ -440,6 +442,7 @@ public class PlayerListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onQuit(PlayerQuitEvent event) {
|
||||
plugin.debug.start("PlayerListener#onQuit");
|
||||
Player player = event.getPlayer();
|
||||
DGlobalPlayer dPlayer = dPlayers.getByPlayer(player);
|
||||
DGroup dGroup = DGroup.getByPlayer(player);
|
||||
@ -468,10 +471,12 @@ public class PlayerListener implements Listener {
|
||||
} else if (dPlayer instanceof DEditPlayer) {
|
||||
((DEditPlayer) dPlayer).leave();
|
||||
}
|
||||
plugin.debug.end("PlayerListener#onQuit", true);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void onJoin(PlayerJoinEvent event) {
|
||||
plugin.debug.start("PlayerListener#onJoin");
|
||||
Player player = event.getPlayer();
|
||||
|
||||
new DGlobalPlayer(player);
|
||||
@ -504,18 +509,22 @@ public class PlayerListener implements Listener {
|
||||
|
||||
// Tutorial Mode
|
||||
if (!plugin.getMainConfig().isTutorialActivated()) {
|
||||
plugin.debug.end("PlayerListener#onJoin", true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (DGamePlayer.getByPlayer(player) != null) {
|
||||
plugin.debug.end("PlayerListener#onJoin", true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.getPermissionProvider() == null || !plugin.getPermissionProvider().hasGroupSupport()) {
|
||||
plugin.debug.end("PlayerListener#onJoin", true);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((plugin.getMainConfig().getTutorialDungeon() == null || plugin.getMainConfig().getTutorialStartGroup() == null || plugin.getMainConfig().getTutorialEndGroup() == null)) {
|
||||
plugin.debug.end("PlayerListener#onJoin", true);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -548,8 +557,10 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
|
||||
new DGamePlayer(player, dGroup.getGameWorld());
|
||||
plugin.debug.end("PlayerListener#onJoin", true);
|
||||
return;
|
||||
}
|
||||
plugin.debug.end("PlayerListener#onJoin", true);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
|
@ -84,6 +84,7 @@ public class DGamePlayer extends DInstancePlayer {
|
||||
public DGamePlayer(Player player, World world) {
|
||||
super(player, world);
|
||||
|
||||
plugin.debug.start("DGamePlayer#init");
|
||||
Game game = Game.getByWorld(world);
|
||||
if (game == null) {
|
||||
game = new Game(DGroup.getByPlayer(player));
|
||||
@ -109,6 +110,7 @@ public class DGamePlayer extends DInstancePlayer {
|
||||
} else {
|
||||
PlayerUtil.secureTeleport(player, teleport);
|
||||
}
|
||||
plugin.debug.end("DGamePlayer#init", true);
|
||||
}
|
||||
|
||||
/* Getters and setters */
|
||||
@ -189,8 +191,10 @@ public class DGamePlayer extends DInstancePlayer {
|
||||
* the dClass to set
|
||||
*/
|
||||
public void setDClass(String className) {
|
||||
plugin.debug.start("DGamePlayer#setDClass");
|
||||
Game game = Game.getByWorld(getPlayer().getWorld());
|
||||
if (game == null) {
|
||||
plugin.debug.end("DGamePlayer#setDClass", true);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -253,6 +257,7 @@ public class DGamePlayer extends DInstancePlayer {
|
||||
}
|
||||
}
|
||||
}
|
||||
plugin.debug.end("DGamePlayer#setDClass", true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -371,6 +376,7 @@ public class DGamePlayer extends DInstancePlayer {
|
||||
* if messages should be sent
|
||||
*/
|
||||
public void leave(boolean message) {
|
||||
plugin.debug.start("DGamePlayer#leave");
|
||||
GameRules rules = Game.getByWorld(getWorld()).getRules();
|
||||
delete();
|
||||
|
||||
@ -455,6 +461,7 @@ public class DGamePlayer extends DInstancePlayer {
|
||||
// ...*flies away*
|
||||
}
|
||||
}
|
||||
plugin.debug.end("DGamePlayer#leave", true);
|
||||
}
|
||||
|
||||
public void kill() {
|
||||
@ -640,15 +647,18 @@ public class DGamePlayer extends DInstancePlayer {
|
||||
* the name of the next floor
|
||||
*/
|
||||
public void finishFloor(DResourceWorld specifiedFloor) {
|
||||
plugin.debug.start("DGamePlayer#finishFloor");
|
||||
MessageUtil.sendMessage(getPlayer(), DMessages.PLAYER_FINISHED_DUNGEON.getMessage());
|
||||
finished = true;
|
||||
|
||||
DGroup dGroup = DGroup.getByPlayer(getPlayer());
|
||||
if (dGroup == null) {
|
||||
plugin.debug.end("DGamePlayer#finishFloor", true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dGroup.isPlaying()) {
|
||||
plugin.debug.end("DGamePlayer#finishFloor", true);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -658,6 +668,7 @@ public class DGamePlayer extends DInstancePlayer {
|
||||
DGamePlayer dPlayer = getByPlayer(player);
|
||||
if (!dPlayer.finished) {
|
||||
MessageUtil.sendMessage(this.getPlayer(), DMessages.PLAYER_WAIT_FOR_OTHER_PLAYERS.getMessage());
|
||||
plugin.debug.end("DGamePlayer#finishFloor", true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -676,6 +687,7 @@ public class DGamePlayer extends DInstancePlayer {
|
||||
}
|
||||
|
||||
if (invalid) {
|
||||
plugin.debug.end("DGamePlayer#finishFloor", true);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -715,6 +727,7 @@ public class DGamePlayer extends DInstancePlayer {
|
||||
}
|
||||
}
|
||||
dGroup.startGame(game);
|
||||
plugin.debug.end("DGamePlayer#finishFloor", true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -729,6 +742,7 @@ public class DGamePlayer extends DInstancePlayer {
|
||||
* if messages should be sent
|
||||
*/
|
||||
public void finish(boolean message) {
|
||||
plugin.debug.start("DGamePlayer#finish");
|
||||
if (message) {
|
||||
MessageUtil.sendMessage(getPlayer(), DMessages.PLAYER_FINISHED_DUNGEON.getMessage());
|
||||
}
|
||||
@ -736,10 +750,12 @@ public class DGamePlayer extends DInstancePlayer {
|
||||
|
||||
DGroup dGroup = DGroup.getByPlayer(getPlayer());
|
||||
if (dGroup == null) {
|
||||
plugin.debug.end("DGamePlayer#finish", true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dGroup.isPlaying()) {
|
||||
plugin.debug.end("DGamePlayer#finish", true);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -763,16 +779,19 @@ public class DGamePlayer extends DInstancePlayer {
|
||||
|
||||
if (dPlayerFinishEvent.isCancelled()) {
|
||||
finished = false;
|
||||
plugin.debug.end("DGamePlayer#finish", true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (hasToWait) {
|
||||
plugin.debug.end("DGamePlayer#finish", true);
|
||||
return;
|
||||
}
|
||||
|
||||
DGroupFinishDungeonEvent dGroupFinishDungeonEvent = new DGroupFinishDungeonEvent(dGroup);
|
||||
|
||||
if (dGroupFinishDungeonEvent.isCancelled()) {
|
||||
plugin.debug.end("DGamePlayer#finish", true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -91,6 +91,7 @@ public class DGroup {
|
||||
}
|
||||
|
||||
public DGroup(String name, Player captain, List<Player> players, String identifier, boolean multiFloor) {
|
||||
plugin.debug.start("DGroup#init4");
|
||||
plugin.getDGroups().add(this);
|
||||
this.name = name;
|
||||
|
||||
@ -121,6 +122,7 @@ public class DGroup {
|
||||
|
||||
playing = false;
|
||||
floorCount = 0;
|
||||
plugin.debug.end("DGroup#init4", true);
|
||||
}
|
||||
|
||||
// Getters and setters
|
||||
@ -579,6 +581,7 @@ public class DGroup {
|
||||
}
|
||||
|
||||
public void startGame(Game game) {
|
||||
plugin.debug.start("DGroup#startGame");
|
||||
if (game == null) {
|
||||
return;
|
||||
}
|
||||
@ -602,6 +605,7 @@ public class DGroup {
|
||||
}
|
||||
|
||||
if (!ready) {
|
||||
plugin.debug.end("DGroup#startGame", true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -610,6 +614,7 @@ public class DGroup {
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
plugin.debug.end("DGroup#startGame", true);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -677,6 +682,7 @@ public class DGroup {
|
||||
|
||||
GroupSign.updatePerGroup(this);
|
||||
nextFloor = null;
|
||||
plugin.debug.end("DGroup#startGame", true);
|
||||
}
|
||||
|
||||
public boolean checkTime(Game game) {
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
package io.github.dre2n.dungeonsxl.task;
|
||||
|
||||
import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||
import io.github.dre2n.dungeonsxl.mob.DMob;
|
||||
import io.github.dre2n.dungeonsxl.mob.ExternalMobProvider;
|
||||
import io.github.dre2n.dungeonsxl.sign.ExternalMobSign;
|
||||
@ -28,6 +29,8 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
*/
|
||||
public class ExternalMobSpawnTask extends BukkitRunnable {
|
||||
|
||||
DungeonsXL plugin = DungeonsXL.getInstance();
|
||||
|
||||
private ExternalMobSign sign;
|
||||
private ExternalMobProvider provider;
|
||||
|
||||
@ -38,6 +41,7 @@ public class ExternalMobSpawnTask extends BukkitRunnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
plugin.debug.start("ExternalMobSpawnTask#run");
|
||||
if (sign.getInterval() <= 0) {
|
||||
World world = sign.getSign().getWorld();
|
||||
DGameWorld gameWorld = DGameWorld.getByWorld(world);
|
||||
@ -70,6 +74,7 @@ public class ExternalMobSpawnTask extends BukkitRunnable {
|
||||
}
|
||||
|
||||
sign.setInterval(sign.getInterval() - 1);
|
||||
plugin.debug.end("ExternalMobSpawnTask#run", true);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -36,6 +36,8 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
*/
|
||||
public class MobSpawnTask extends BukkitRunnable {
|
||||
|
||||
DungeonsXL plugin = DungeonsXL.getInstance();
|
||||
|
||||
private DMobSign sign;
|
||||
|
||||
public MobSpawnTask(DMobSign sign) {
|
||||
@ -44,6 +46,7 @@ public class MobSpawnTask extends BukkitRunnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
plugin.debug.start("MobSpawnTask#run");
|
||||
if (sign.getInterval() <= 0) {
|
||||
World world = sign.getSign().getWorld();
|
||||
DGameWorld gameWorld = DGameWorld.getByWorld(world);
|
||||
@ -96,6 +99,7 @@ public class MobSpawnTask extends BukkitRunnable {
|
||||
}
|
||||
|
||||
sign.setInterval(sign.getInterval() - 1);
|
||||
plugin.debug.end("MobSpawnTask#run", true);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -312,6 +312,7 @@ public class DGameWorld extends DInstanceWorld {
|
||||
* @return the potential amount of mobs in the world
|
||||
*/
|
||||
public int getMobCount() {
|
||||
plugin.debug.start("DGameWorld#getMobCount");
|
||||
int mobCount = 0;
|
||||
|
||||
signs:
|
||||
@ -331,6 +332,7 @@ public class DGameWorld extends DInstanceWorld {
|
||||
mobCount += ((MobSign) dSign).getInitialAmount();
|
||||
}
|
||||
|
||||
plugin.debug.end("DGameWorld#getMobCount", true);
|
||||
return mobCount;
|
||||
}
|
||||
|
||||
@ -351,6 +353,7 @@ public class DGameWorld extends DInstanceWorld {
|
||||
* Set up the instance for the game
|
||||
*/
|
||||
public void startGame() {
|
||||
plugin.debug.start("DGameWorld#startGame");
|
||||
GameWorldStartGameEvent event = new GameWorldStartGameEvent(this, getGame());
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
@ -379,6 +382,7 @@ public class DGameWorld extends DInstanceWorld {
|
||||
}
|
||||
}
|
||||
}
|
||||
plugin.debug.end("DGameWorld#startGame", true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -386,6 +390,7 @@ public class DGameWorld extends DInstanceWorld {
|
||||
*/
|
||||
@Override
|
||||
public void delete() {
|
||||
plugin.debug.start("DGameWorld#delete");
|
||||
GameWorldUnloadEvent event = new GameWorldUnloadEvent(this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
@ -398,6 +403,7 @@ public class DGameWorld extends DInstanceWorld {
|
||||
FileUtil.removeDirectory(getFolder());
|
||||
|
||||
worlds.removeInstance(this);
|
||||
plugin.debug.end("DGameWorld#delete", true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -171,6 +171,7 @@ public class DResourceWorld {
|
||||
* @return an instance of this world
|
||||
*/
|
||||
public DInstanceWorld instantiate(boolean game) {
|
||||
plugin.debug.start("DResourceWorld#instantiate");
|
||||
int id = worlds.generateId();
|
||||
String name = worlds.generateName(game);
|
||||
File instanceFolder = new File(Bukkit.getWorldContainer(), name);
|
||||
@ -197,6 +198,7 @@ public class DResourceWorld {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
|
||||
plugin.debug.end("DResourceWorld#instantiate", true);
|
||||
return instance;
|
||||
}
|
||||
|
||||
@ -220,6 +222,7 @@ public class DResourceWorld {
|
||||
* @return the automatically created DEditWorld instance
|
||||
*/
|
||||
public DEditWorld generate() {
|
||||
plugin.debug.start("DResourceWorld#generate");
|
||||
String name = worlds.generateName(false);
|
||||
WorldCreator creator = WorldCreator.name(name);
|
||||
creator.type(WorldType.FLAT);
|
||||
@ -238,6 +241,7 @@ public class DResourceWorld {
|
||||
|
||||
DEditWorld editWorld = new DEditWorld(this, folder, world, id);
|
||||
|
||||
plugin.debug.end("DResourceWorld#generate", true);
|
||||
return editWorld;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user