Skip to content

Commit 53387d0

Browse files
committed
remove redundant nullability attributes in main class
1 parent 9e8dc9a commit 53387d0

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/main/java/pro/cloudnode/smp/smpcore/SMPCore.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public void onEnable() {
8383
getServer().getPluginManager().registerEvents(new PlayerPreLoginListener(), this);
8484
getServer().getPluginManager().registerEvents(new PlayerPostRespawnListener(), this);
8585

86-
final @NotNull Map<@NotNull String, @NotNull Command> commands = new HashMap<>() {{
86+
final Map<String, Command> commands = new HashMap<>() {{
8787
put("smpcore", new MainCommand());
8888
put("ban", new BanCommand());
8989
put("unban", new UnbanCommand());
@@ -93,7 +93,7 @@ public void onEnable() {
9393
put("citizens", new CitizensCommand());
9494
}};
9595
commands.put("alts", new AltsCommand(commands.get("smpcore")));
96-
for (final @NotNull Map.Entry<@NotNull String, @NotNull Command> entry : commands.entrySet())
96+
for (final Map.Entry<String, Command> entry : commands.entrySet())
9797
Objects.requireNonNull(getServer().getPluginCommand(entry.getKey())).setExecutor(entry.getValue());
9898
}
9999

@@ -134,26 +134,26 @@ private void setupDatabase() {
134134
}
135135

136136
private void initDatabase() {
137-
final @NotNull String setup;
138-
try (final @Nullable InputStream in = getClassLoader().getResourceAsStream("init.sql")) {
137+
final String setup;
138+
try (final InputStream in = getClassLoader().getResourceAsStream("init.sql")) {
139139
setup = new String(Objects.requireNonNull(in).readAllBytes());
140140
}
141-
catch (final @NotNull IOException e) {
141+
catch (final IOException e) {
142142
getLogger().log(Level.SEVERE, "db init: could not read db setup file", e);
143143
disable();
144144
return;
145145
}
146-
final @NotNull String @NotNull [] queries = setup.split(";");
147-
for (@NotNull String q : queries) {
148-
final @NotNull String query = q.stripTrailing().stripIndent().replaceAll("^\\s+(?:--.+)*", "");
146+
final String[] queries = setup.split(";");
147+
for (String q : queries) {
148+
final String query = q.stripTrailing().stripIndent().replaceAll("^\\s+(?:--.+)*", "");
149149
if (query.isBlank()) continue;
150150
try (
151-
final @NotNull Connection conn = db().getConnection();
152-
final @NotNull PreparedStatement stmt = conn.prepareStatement(query)
151+
final Connection conn = db().getConnection();
152+
final PreparedStatement stmt = conn.prepareStatement(query)
153153
) {
154154
stmt.executeUpdate();
155155
}
156-
catch (final @NotNull SQLException e) {
156+
catch (final SQLException e) {
157157
getLogger().log(Level.SEVERE, "db init: could not execute query: " + query, e);
158158
disable();
159159
return;
@@ -170,16 +170,16 @@ public static void runMain(final @NotNull Runnable runnable) {
170170
}
171171

172172
public static @NotNull Set<@NotNull Character> getDisallowedCharacters(final @NotNull String source, final @NotNull Pattern pattern) {
173-
final @NotNull Matcher matcher = pattern.matcher(source);
174-
final @NotNull Set<@NotNull Character> chars = new HashSet<>();
173+
final Matcher matcher = pattern.matcher(source);
174+
final Set<Character> chars = new HashSet<>();
175175
while (matcher.find())
176176
for (char c : matcher.group().toCharArray())
177177
chars.add(c);
178178
return chars;
179179
}
180180

181181
public static boolean ifDisallowedCharacters(final @NotNull String source, final @NotNull Pattern pattern, final @NotNull Consumer<@NotNull Set<@NotNull Character>> consumer) {
182-
final @NotNull Set<@NotNull Character> chars = getDisallowedCharacters(source, pattern);
182+
final Set<Character> chars = getDisallowedCharacters(source, pattern);
183183
if (!chars.isEmpty()) {
184184
consumer.accept(chars);
185185
return true;
@@ -197,7 +197,7 @@ public static boolean ifDisallowedCharacters(final @NotNull String source, final
197197
final double months = Math.floor(days / 30.0);
198198
final double years = Math.floor(months / 12.0);
199199

200-
final @NotNull Component t;
200+
final Component t;
201201
if (years > 0) t = SMPCore.config().relativeTime(years, ChronoUnit.YEARS);
202202
else if (months > 0) t = SMPCore.config().relativeTime((int) months, ChronoUnit.MONTHS);
203203
else if (days > 0) t = SMPCore.config().relativeTime((int) days, ChronoUnit.DAYS);

0 commit comments

Comments
 (0)