Remove legacy bansystem and add WARN punish type
This commit is contained in:
@@ -7,4 +7,4 @@ class_name Punishment extends Resource
|
||||
## in unix time, zero means forever
|
||||
@export var punish_end:int
|
||||
|
||||
enum punishment_types{BAN,MUTE}
|
||||
enum punishment_types{BAN,MUTE,WARN}
|
||||
|
||||
@@ -12,14 +12,23 @@ func Export(Punishments:Array[Punishment],file:String) -> void:
|
||||
continue
|
||||
content += "NAME: " + punishment.username + "\n"
|
||||
content += "UID: " + punishment.uid + "\n"
|
||||
content += "PUNISHMENT: " + ("MUTE" if punishment.what_punishment ==
|
||||
punishment.punishment_types.MUTE else "BAN") + "\n"
|
||||
content += "PUNISHMENT: " + (get_punish_type(punishment)) + "\n"
|
||||
content += "REASON: " + punishment.punish_reason + "\n"
|
||||
content += "END_DATE: " + str(punishment.punish_end) + "\n"
|
||||
content += "L!ListEnd\n"
|
||||
|
||||
fileaccess.store_string(content)
|
||||
|
||||
func get_punish_type(punishment:Punishment):
|
||||
match punishment.what_punishment:
|
||||
Punishment.punishment_types.BAN:
|
||||
return "BAN"
|
||||
Punishment.punishment_types.MUTE:
|
||||
return "MUTE"
|
||||
Punishment.punishment_types.WARN:
|
||||
return "WARN"
|
||||
|
||||
# DEPRECATED
|
||||
func Exportv1(Punishments:Array[Punishment],file:String) -> void:
|
||||
var fileaccess:FileAccess = FileAccess.open(file,FileAccess.WRITE)
|
||||
if !fileaccess:
|
||||
|
||||
@@ -39,13 +39,11 @@ func _ready() -> void:
|
||||
options_window.email_edit.text = save_file.get("EMAIL","")
|
||||
options_window.name_edit.text = save_file.get("NAME","")
|
||||
options_window.key_edit.text = save_file.get("KEY","")
|
||||
options_window.use_old.button_pressed = save_file.get("USE_OLD",false)
|
||||
|
||||
options_window.repo_edit.text_changed.connect(unsave.unbind(1))
|
||||
options_window.email_edit.text_changed.connect(unsave.unbind(1))
|
||||
options_window.name_edit.text_changed.connect(unsave.unbind(1))
|
||||
options_window.key_edit.text_changed.connect(unsave.unbind(1))
|
||||
options_window.use_old.pressed.connect(unsave)
|
||||
if options_window.repo_edit.text:
|
||||
if git.has_method("Clone"):
|
||||
git.Clone()
|
||||
@@ -136,10 +134,7 @@ func save():
|
||||
Punishments.append(child.punishment)
|
||||
update_ban_counter()
|
||||
save_file_parser.save()
|
||||
if options_window.use_old.button_pressed:
|
||||
exporter.Exportv1(Punishments,current_path)
|
||||
else:
|
||||
exporter.Export(Punishments,current_path)
|
||||
exporter.Export(Punishments,current_path)
|
||||
unsaved = false
|
||||
git.Commit_changes()
|
||||
|
||||
|
||||
@@ -46,4 +46,6 @@ func punish_text_to_enum(text) -> Punishment.punishment_types:
|
||||
punish = Punishment.punishment_types.BAN
|
||||
"MUTE":
|
||||
punish = Punishment.punishment_types.MUTE
|
||||
"WARN":
|
||||
punish = Punishment.punishment_types.WARN
|
||||
return punish
|
||||
|
||||
@@ -21,6 +21,5 @@ func save() -> void:
|
||||
"EMAIL":options_window.email_edit.text,
|
||||
"NAME":options_window.name_edit.text,
|
||||
"KEY":options_window.key_edit.text,
|
||||
"USE_OLD":options_window.use_old.button_pressed,
|
||||
}
|
||||
file.store_var(Dict)
|
||||
|
||||
Reference in New Issue
Block a user