private <T> T exceptionHandlerNonCritical(T t, Throwable throwable) { if (throwable != null) { errorHandler.log(L.WARN, Processing.class, throwable.getCause()); } return t; }
private <T> T exceptionHandlerCritical(T t, Throwable throwable) { if (throwable != null) { errorHandler.log(L.ERROR, Processing.class, throwable.getCause()); } return t; }
@Override public void returnToPool(Connection connection) { try { if (connection != null) { connection.close(); } } catch (SQLException e) { errorHandler.log(L.ERROR, this.getClass(), e); } }
public void reload() { try { config.read(); } catch (IOException e) { errorHandler.log(L.ERROR, this.getClass(), e); } } }
private void disableSystems(SubSystem... systems) { for (SubSystem system : systems) { try { if (system != null) { system.disable(); } } catch (Exception e) { errorHandler.log(L.WARN, this.getClass(), e); } } }
@Override public void disable() { try { if (db != null) { db.close(); } } catch (DBException e) { errorHandler.log(L.WARN, this.getClass(), e); } }
private void copyFromJar(String[] resources) { for (String resource : resources) { try { copyFromJar(resource); } catch (IOException e) { errorHandler.log(L.WARN, this.getClass(), e); } } }
protected long getFreeDiskSpace() { try { File file = new File(new File("").getAbsolutePath()); return file.getFreeSpace() / 1000000L; } catch (SecurityException noPermission) { if (!diskErrored) { errorHandler.log(L.WARN, this.getClass(), noPermission); } diskErrored = true; return -1; } } }
@EventHandler(priority = EventPriority.MONITOR) public void onPlayerQuit(PlayerQuitEvent event) { try { actOnQuitEvent(event); } catch (Exception e) { errorHandler.log(L.ERROR, this.getClass(), e); } }
@Override public void enable() { try { bridge.hook(this); } catch (Exception e) { errorHandler.log(L.ERROR, this.getClass(), e); logger.error("Plan Plugin Bridge not included in the plugin jar."); } }
@Override public void run() { try { if (isOpen()) { clean(); } } catch (DBOpException e) { errorHandler.log(L.ERROR, this.getClass(), e); cancel(); } } }).runTaskTimerAsynchronously(
@Listener(order = Order.POST) public void onLogin(ClientConnectionEvent.Login event) { try { actOnLoginEvent(event); } catch (Exception e) { errorHandler.log(L.ERROR, this.getClass(), e); } }
@Listener(order = Order.POST) public void onJoin(ClientConnectionEvent.Join event) { try { actOnJoinEvent(event); } catch (Exception e) { errorHandler.log(L.ERROR, this.getClass(), e); } }
@EventHandler(priority = EventPriority.MONITOR) public void onPlayerJoin(PlayerJoinEvent event) { try { actOnJoinEvent(event); } catch (Exception e) { errorHandler.log(L.ERROR, this.getClass(), e); } }
private void event(TargetPlayerEvent event) { try { performedAction(event.getTargetEntity()); } catch (Exception e) { errorHandler.log(L.ERROR, this.getClass(), e); } }
@EventHandler(priority = EventPriority.MONITOR) public void onWorldChange(PlayerChangedWorldEvent event) { try { actOnEvent(event); } catch (Exception e) { errorHandler.log(L.ERROR, this.getClass(), e); } }
@Listener(order = Order.POST) public void onQuit(ClientConnectionEvent.Disconnect event) { try { actOnQuitEvent(event); } catch (Exception e) { errorHandler.log(L.ERROR, this.getClass(), e); } }
@Override public Map<UUID, String> getKnownPlayerNames() { try { return fetchFromPlanDB().getPlayerNames(); } catch (DBOpException e) { errorHandler.log(L.ERROR, this.getClass(), e); return new HashMap<>(); } }
private void resetWriteConfigSetting() { try { config.set(PluginSettings.WRITE_NEW_LOCALE, false); config.save(); } catch (IOException | IllegalStateException e) { logger.error("Failed set WriteNewLocaleFileOnEnable back to false"); errorHandler.log(L.WARN, this.getClass(), e); } }
private UUID getUUIDFromDB(String playerName) { try { return dbSystem.getDatabase().fetch().getUuidOf(playerName); } catch (DBOpException e) { errorHandler.log(L.ERROR, UUIDUtility.class, e); return null; } } }