ChanceSD / PvPManager

Returned Futures should not be ignored JAVA-W1087
Anti-pattern
Major
2 months ago6 months old
 83	}
 84
 85	public <T> void doQuery(final String sql, final Consumer<T> consumer, final String field, final Class<T> type) {
 86		CompletableFuture.runAsync(() -> { 87			try (Connection connection = getConnection(); 88					PreparedStatement ps = connection.prepareStatement(sql); 89					ResultSet result = ps.executeQuery()) { 90				if (result.next()) { 91					final T value = result.getObject(field, type); 92					consumer.accept(value); 93				} 94			} catch (final SQLException e) { 95				log("Failed to do query", e); 96			} 97		}); 98	}
 99
100	/**
28
29	private void setup() {
30		if (Settings.isUpdateCheck()) {
31			ScheduleUtils.runAsyncTimer(this::checkForUpdates, 3, 18000, TimeUnit.SECONDS);32		}
33	}
34
157	public static void checkGlide(final Player p) {
158		if (p.isGliding()) {
159			p.setGliding(false);
160			ScheduleUtils.teleport(p, p.getLocation());161			p.setFallDistance(-200);
162			if (!Settings.isBorderPushbackTakeElytra())
163				return;
 52			ScheduleUtils.runAsyncTimer(new CleanKillersTask(this), Settings.getKillAbuseTime(), Settings.getKillAbuseTime(), TimeUnit.SECONDS);
 53		}
 54		if (Settings.getPvPDisabledFee() != 0) {
 55			ScheduleUtils.runAsyncTimer(new PvPToggleFeeTask(this), 0, 1, TimeUnit.HOURS); 56		}
 57
 58		addOnlinePlayers();
 49		this.dependencyManager = plugin.getDependencyManager();
 50		this.tagTask = new TagTask(plugin.getDisplayManager());
 51		if (Settings.isKillAbuseEnabled()) {
 52			ScheduleUtils.runAsyncTimer(new CleanKillersTask(this), Settings.getKillAbuseTime(), Settings.getKillAbuseTime(), TimeUnit.SECONDS); 53		}
 54		if (Settings.getPvPDisabledFee() != 0) {
 55			ScheduleUtils.runAsyncTimer(new PvPToggleFeeTask(this), 0, 1, TimeUnit.HOURS);