Plugin deprecation warnings

This commit is contained in:
JannisX11 2024-01-07 11:53:32 +01:00
parent 9c7b0a644d
commit 842eb413be
2 changed files with 19 additions and 0 deletions

View File

@ -50,6 +50,7 @@ class Plugin {
this.variant = 'both';
this.min_version = '';
this.max_version = '';
this.deprecation_note = '';
this.website = '';
this.source = 'store';
this.creation_date = 0;
@ -76,6 +77,7 @@ class Plugin {
Merge.string(this, data, 'variant')
Merge.string(this, data, 'min_version')
Merge.string(this, data, 'max_version')
Merge.string(this, data, 'deprecation_note')
Merge.string(this, data, 'website')
Merge.string(this, data, 'repository')
Merge.string(this, data, 'bug_tracker')
@ -100,6 +102,21 @@ class Plugin {
return this.title;
}
async install() {
if (this.tags.includes('Deprecated') || this.deprecation_note) {
let message = tl('message.plugin_deprecated.message');
if (this.deprecation_note) {
message += '\n\n*' + this.deprecation_note + '*';
}
let answer = await new Promise((resolve) => {
Blockbench.showMessageBox({
icon: 'warning',
title: this.title,
message,
buttons: ['dialog.cancel', 'message.plugin_deprecated.install_anyway']
}, resolve)
})
if (answer == 0) return;
}
return await this.download(true);
}
async load(first, cb) {

View File

@ -263,6 +263,8 @@
"message.plugin_dependencies.message1_update": "The plugin %0 has been updated and now requires these dependencies:",
"message.plugin_dependencies.message2": "Do you want to install them to continue?",
"message.plugin_dependencies.invalid": "Unfortunately the plugin cannot be installed, it has an invalid dependency:",
"message.plugin_deprecated.message": "Are you sure you want to install this deprecated plugin?",
"message.plugin_deprecated.install_anyway": "Install Anyway",
"message.unsaved_textures.title": "Unsaved Textures",
"message.unsaved_textures.message": "Your model has unsaved textures. Make sure to save them and paste them into your resource pack in the correct folder.",