Catch DungeonSign#trigger() exceptions

This commit is contained in:
Daniel Saukel 2020-06-30 14:51:48 +02:00
parent b5e53cfce7
commit cfd3e026bb
3 changed files with 21 additions and 3 deletions

View File

@ -185,7 +185,13 @@ public interface DungeonSign {
}
}
trigger(lastFired != null ? lastFired.getPlayer() : null);
try {
trigger(lastFired != null ? lastFired.getPlayer() : null);
} catch (Exception exception) {
markAsErroneous("An error occurred while triggering a sign of the type " + getName()
+ ". This is not a user error. Please report the following stacktrace to the developer of the plugin:");
exception.printStackTrace();
}
}
/**

View File

@ -97,7 +97,13 @@ public class ScriptSign extends Passive {
exception.printStackTrace();
}
if (!dSign.hasTriggers()) {
dSign.trigger(null);
try {
dSign.trigger(null);
} catch (Exception exception) {
markAsErroneous("An error occurred while triggering a sign of the type " + getName()
+ ". This is not a user error. Please report the following stacktrace to the developer of the plugin:");
exception.printStackTrace();
}
}
}
}

View File

@ -437,7 +437,13 @@ public class DGameWorld extends DInstanceWorld implements GameWorld {
sign.setToAir();
}
if (!sign.hasTriggers()) {
sign.trigger(null);
try {
sign.trigger(null);
} catch (Exception exception) {
sign.markAsErroneous("An error occurred while triggering a sign of the type " + getName()
+ ". This is not a user error. Please report the following stacktrace to the developer of the plugin:");
exception.printStackTrace();
}
}
}