Java Code Examples for ch.njol.skript.Skript#testing()

The following examples show how to use ch.njol.skript.Skript#testing() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SkriptLogger.java    From Skript with GNU General Public License v3.0 6 votes vote down vote up
public static void log(final @Nullable LogEntry entry) {
	if (entry == null)
		return;
	if (Skript.testing() && node != null && node.debug())
		System.out.print("---> " + entry.level + "/" + ErrorQuality.get(entry.quality) + ": " + entry.getMessage() + " ::" + LogEntry.findCaller());
	for (final LogHandler h : handlers) {
		final LogResult r = h.log(entry);
		switch (r) {
			case CACHED:
				return;
			case DO_NOT_LOG:
				entry.discarded("denied by " + h);
				return;
			case LOG:
				continue;
		}
	}
	entry.logged();
	LOGGER.log(entry.getLevel(), "[Skript] " + entry.getMessage());
}
 
Example 2
Source File: Message.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onLanguageChange() {
	for (final Message m : messages) {
		synchronized (m) {
			m.revalidate = true;
		}
		if (firstChange && Skript.testing()) {
			if (!Language.english.containsKey(m.key))
				Language.missingEntryError(m.key);
		}
	}
	firstChange = false;
}
 
Example 3
Source File: Message.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
public Message(final String key) {
	this.key = "" + key.toLowerCase(Locale.ENGLISH);
	messages.add(this);
	if (Skript.testing() && !Language.english.isEmpty()) {
		if (!Language.english.containsKey(this.key))
			Language.missingEntryError(this.key);
	}
}
 
Example 4
Source File: Adjective.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
@Override
public String toString() {
	validate();
	if (Skript.testing())
		Skript.warning("Invalid use of Adjective.toString()");
	return "" + def;
}
 
Example 5
Source File: ExceptionUtils.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
@Nullable
public static String toString(final IOException e) {
	if (Language.keyExists(IO_NODE + "." + e.getClass().getSimpleName())) {
		return Language.format(IO_NODE + "." + e.getClass().getSimpleName(), e.getLocalizedMessage());
	}
	if (Skript.testing())
		e.printStackTrace();
	return e.getLocalizedMessage();
}
 
Example 6
Source File: RetainingLogHandler.java    From Skript with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onStop() {
	if (!printedErrorOrLog && Skript.testing())
		SkriptLogger.LOGGER.warning("Retaining log wasn't instructed to print anything at " + SkriptLogger.getCaller());
}
 
Example 7
Source File: ParseLogHandler.java    From Skript with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onStop() {
	if (!printedErrorOrLog && Skript.testing())
		SkriptLogger.LOGGER.warning("Parse log wasn't instructed to print anything at " + SkriptLogger.getCaller());
}
 
Example 8
Source File: DatabaseStorage.java    From Skript with GNU General Public License v3.0 4 votes vote down vote up
void sqlException(final SQLException e) {
	Skript.error("database error: " + e.getLocalizedMessage());
	if (Skript.testing())
		e.printStackTrace();
	prepareQueries(); // a query has to be recreated after an error
}