generated from srnyx/plugin-template
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
5.1.3: New Value system for data to fix bugs
There was a bug with the cache where it couldn't detect when a value was being set to null (as it was being removed from the cache). This fixes that and potentially other bugs that were occurring due to similar reasons.
- Loading branch information
Showing
18 changed files
with
396 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
src/main/java/xyz/srnyx/annoyingapi/storage/FailedSet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package xyz.srnyx.annoyingapi.storage; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
|
||
/** | ||
* Represents a failed set operation | ||
*/ | ||
public class FailedSet { | ||
/** | ||
* The table that the set operation failed on | ||
*/ | ||
@NotNull public final String table; | ||
/** | ||
* The target that the set operation failed for | ||
*/ | ||
@NotNull public final String target; | ||
/** | ||
* The column that the set operation failed on | ||
*/ | ||
@NotNull public final String column; | ||
/** | ||
* The value that the set operation failed with | ||
*/ | ||
@Nullable public final String value; | ||
/** | ||
* The exception that occurred while attempting to set the value | ||
*/ | ||
@Nullable public final Throwable exception; | ||
|
||
/** | ||
* Constructs a new failed set with the given table, target, column, and value | ||
* | ||
* @param table {@link #table} | ||
* @param target {@link #target} | ||
* @param column {@link #column} | ||
* @param value {@link #value} | ||
*/ | ||
public FailedSet(@NotNull String table, @NotNull String target, @NotNull String column, @Nullable String value) { | ||
this.table = table; | ||
this.target = target; | ||
this.column = column; | ||
this.value = value; | ||
this.exception = null; | ||
} | ||
|
||
/** | ||
* Constructs a new failed set with the given table, target, column, value, and exception | ||
* | ||
* @param table {@link #table} | ||
* @param target {@link #target} | ||
* @param column {@link #column} | ||
* @param value {@link #value} | ||
* @param exception {@link #exception} | ||
*/ | ||
public FailedSet(@NotNull String table, @NotNull String target, @NotNull String column, @Nullable String value, @NotNull Throwable exception) { | ||
this.table = table; | ||
this.target = target; | ||
this.column = column; | ||
this.value = value; | ||
this.exception = exception; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package xyz.srnyx.annoyingapi.storage; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
|
||
/** | ||
* Represents a value that may be null | ||
* <br>This is needed so that the plugin can know whether a value was cached or not for data (because null could be a valid value) | ||
*/ | ||
public class Value { | ||
/** | ||
* The value | ||
*/ | ||
@Nullable public final String value; | ||
|
||
/** | ||
* Constructs a new value with the given value | ||
* | ||
* @param value the value | ||
*/ | ||
public Value(@Nullable String value) { | ||
this.value = value; | ||
} | ||
|
||
/** | ||
* Constructs a new value with a null value | ||
*/ | ||
public Value() { | ||
this.value = null; | ||
} | ||
|
||
@Override @NotNull | ||
public String toString() { | ||
return value == null ? "null" : value; | ||
} | ||
} |
Oops, something went wrong.