fix /pronouns reset command
Fix crash when resetting pronouns due to null value in database write
This commit is contained in:
4
pom.xml
4
pom.xml
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<groupId>com.sophiaatkinson</groupId>
|
<groupId>com.sophiaatkinson</groupId>
|
||||||
<artifactId>PronounsPlugin</artifactId>
|
<artifactId>PronounsPlugin</artifactId>
|
||||||
<version>1.0</version>
|
<version>1.0.1</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>PronounsPlugin</name>
|
<name>PronounsPlugin</name>
|
||||||
@ -37,7 +37,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>me.clip</groupId>
|
<groupId>me.clip</groupId>
|
||||||
<artifactId>placeholderapi</artifactId>
|
<artifactId>placeholderapi</artifactId>
|
||||||
<version>2.11.7</version>
|
<version>2.11.7-DEV-207</version>
|
||||||
<scope>system</scope>
|
<scope>system</scope>
|
||||||
<!-- Make sure this path is correct -->
|
<!-- Make sure this path is correct -->
|
||||||
<systemPath>${project.basedir}/lib/PlaceholderAPI-2.11.7-DEV-207.jar</systemPath>
|
<systemPath>${project.basedir}/lib/PlaceholderAPI-2.11.7-DEV-207.jar</systemPath>
|
||||||
|
@ -68,6 +68,17 @@ public class PronounsPlugin extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setPronouns(UUID uuid, String pronouns) {
|
public void setPronouns(UUID uuid, String pronouns) {
|
||||||
|
if (pronouns == null) {
|
||||||
|
try (PreparedStatement ps = connection.prepareStatement("DELETE FROM pronouns WHERE uuid = ?")) {
|
||||||
|
ps.setString(1, uuid.toString());
|
||||||
|
ps.executeUpdate();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
errorLog.add("Database delete error: " + e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (String blocked : blockedPronouns) {
|
for (String blocked : blockedPronouns) {
|
||||||
if (pronouns.contains(blocked)) {
|
if (pronouns.contains(blocked)) {
|
||||||
return;
|
return;
|
||||||
|
@ -17,11 +17,11 @@ blocked-pronouns:
|
|||||||
- "spic"
|
- "spic"
|
||||||
|
|
||||||
pronoun-suggestions:
|
pronoun-suggestions:
|
||||||
- "she/her"
|
- "She/Her"
|
||||||
- "he/him"
|
- "He/Him"
|
||||||
- "they/them"
|
- "They/Them"
|
||||||
- "xe/xem"
|
- "Xe/Xem"
|
||||||
- "it/its"
|
- "It/Its"
|
||||||
|
|
||||||
debug: true
|
debug: true
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user