Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/main/java/ch/njol/skript/variables/FlatFileStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,10 @@ public final void saveVariables(boolean finalSave) {
*/
@SuppressWarnings("unchecked")
private void save(PrintWriter pw, String parent, TreeMap<String, Object> map) {
if (parent.startsWith(Variables.EPHEMERAL_VARIABLE_PREFIX))
// Skip ephemeral variables
return;

// Iterate over all children
for (Entry<String, Object> childEntry : map.entrySet()) {
Object childNode = childEntry.getValue();
Expand All @@ -471,6 +475,10 @@ private void save(PrintWriter pw, String parent, TreeMap<String, Object> map) {
// Remove variable separator if needed
String name = childKey == null ? parent.substring(0, parent.length() - Variable.SEPARATOR.length()) : parent + childKey;

if (name.startsWith(Variables.EPHEMERAL_VARIABLE_PREFIX))
// Skip ephemeral variables
continue;

try {
// Loop over storages to make sure this variable is ours to store
for (VariablesStorage storage : Variables.STORAGES) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ch/njol/skript/variables/Variables.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public class Variables {
*/
private static final String CONFIGURATION_SERIALIZABLE_PREFIX = "ConfigurationSerializable_";

private static final String EPHEMERAL_VARIABLE_PREFIX = "-";
public static final String EPHEMERAL_VARIABLE_PREFIX = "-";

private final static Multimap<Class<? extends VariablesStorage>, String> TYPES = HashMultimap.create();

Expand Down