@@ -92,34 +92,39 @@ private void load(){
92
92
public void reload (){
93
93
load ();
94
94
}
95
+
96
+ private void save () {
97
+ FileUtils .write (storeFile , json .toString (4 ));
98
+ }
95
99
public void put (String key , Object value ){
96
100
if (value instanceof Collection <?> collection )
97
101
json .put (key , collection );
98
102
else if (value instanceof Map <?,?> map )
99
103
json .put (key , map );
100
104
else
101
105
json .put (key , value );
102
- FileUtils . write ( storeFile , json . toString ( 4 ) );
106
+ save ( );
103
107
}
108
+
104
109
public void put (String key , int value ){
105
110
json .put (key , value );
106
- FileUtils . write ( storeFile , json . toString ( 4 ) );
111
+ save ( );
107
112
}
108
113
public void put (String key , long value ){
109
114
json .put (key , value );
110
- FileUtils . write ( storeFile , json . toString ( 4 ) );
115
+ save ( );
111
116
}
112
117
public void put (String key , double value ){
113
118
json .put (key , value );
114
- FileUtils . write ( storeFile , json . toString ( 4 ) );
119
+ save ( );
115
120
}
116
121
public void put (String key , float value ){
117
122
json .put (key , value );
118
- FileUtils . write ( storeFile , json . toString ( 4 ) );
123
+ save ( );
119
124
}
120
125
public void put (String key , boolean value ){
121
126
json .put (key , value );
122
- FileUtils . write ( storeFile , json . toString ( 4 ) );
127
+ save ( );
123
128
}
124
129
public Object get (String key ){
125
130
return json .get (key );
0 commit comments