mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-11-22 18:46:39 +01:00
Add button in Challenges admin GUI that allows to import default challenges.
This commit is contained in:
parent
b24f7ebcb0
commit
ca5cfcc841
@ -102,6 +102,10 @@ public abstract class CommonGUI
|
||||
|
||||
protected static final String IMPORT = "import";
|
||||
|
||||
protected static final String DEFAULT = "default";
|
||||
|
||||
protected static final String GENERATE = "generate";
|
||||
|
||||
protected static final String SETTINGS = "settings";
|
||||
|
||||
protected static final String DELETE = "delete";
|
||||
|
@ -56,7 +56,9 @@ public class AdminGUI extends CommonGUI
|
||||
DELETE_CHALLENGE,
|
||||
DELETE_LEVEL,
|
||||
IMPORT_CHALLENGES,
|
||||
EDIT_SETTINGS
|
||||
EDIT_SETTINGS,
|
||||
DEFAULT_IMPORT_CHALLENGES,
|
||||
DEFAULT_EXPORT_CHALLENGES
|
||||
}
|
||||
|
||||
|
||||
@ -111,6 +113,9 @@ public class AdminGUI extends CommonGUI
|
||||
|
||||
// Import Challenges
|
||||
panelBuilder.item(15, this.createButton(Button.IMPORT_CHALLENGES));
|
||||
panelBuilder.item(24, this.createButton(Button.DEFAULT_IMPORT_CHALLENGES));
|
||||
// Not added as I do not think admins should use it. It still will be able via command.
|
||||
// panelBuilder.item(33, this.createButton(Button.DEFAULT_EXPORT_CHALLENGES));
|
||||
|
||||
// Edit Addon Settings
|
||||
panelBuilder.item(16, this.createButton(Button.EDIT_SETTINGS));
|
||||
@ -371,6 +376,55 @@ public class AdminGUI extends CommonGUI
|
||||
|
||||
break;
|
||||
}
|
||||
case DEFAULT_IMPORT_CHALLENGES:
|
||||
{
|
||||
permissionSuffix = DEFAULT;
|
||||
|
||||
name = this.user.getTranslation("challenges.gui.buttons.admin.default-import");
|
||||
description = this.user.getTranslation("challenges.gui.descriptions.admin.default-import");
|
||||
icon = new ItemStack(Material.HOPPER);
|
||||
clickHandler = (panel, user, clickType, slot) -> {
|
||||
if (clickType.isRightClick())
|
||||
{
|
||||
this.overwriteMode = !this.overwriteMode;
|
||||
this.build();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Run import command.
|
||||
this.user.performCommand(this.topLabel + " " + CHALLENGES + " " + DEFAULT + " " + IMPORT);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
glow = false;
|
||||
|
||||
break;
|
||||
}
|
||||
case DEFAULT_EXPORT_CHALLENGES:
|
||||
{
|
||||
permissionSuffix = DEFAULT;
|
||||
|
||||
name = this.user.getTranslation("challenges.gui.buttons.admin.default-export");
|
||||
description = this.user.getTranslation("challenges.gui.descriptions.admin.default-export");
|
||||
icon = new ItemStack(Material.HOPPER);
|
||||
clickHandler = (panel, user, clickType, slot) -> {
|
||||
if (clickType.isRightClick())
|
||||
{
|
||||
this.overwriteMode = !this.overwriteMode;
|
||||
this.build();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Run import command.
|
||||
this.user.performCommand(this.topLabel + " " + CHALLENGES + " " + DEFAULT + " " + GENERATE +
|
||||
(this.overwriteMode ? " overwrite" : ""));
|
||||
}
|
||||
return true;
|
||||
};
|
||||
glow = this.overwriteMode;
|
||||
|
||||
break;
|
||||
}
|
||||
case EDIT_SETTINGS:
|
||||
{
|
||||
permissionSuffix = SETTINGS;
|
||||
|
@ -153,6 +153,8 @@ challenges:
|
||||
input-mode: 'Switch input mode'
|
||||
title-enable: 'Completion title'
|
||||
title-showtime: 'Title Show Time'
|
||||
default-import: 'Import Default Challenges'
|
||||
default-export: 'Export Existing Challenges'
|
||||
next: 'Next'
|
||||
previous: 'Previous'
|
||||
return: 'Return'
|
||||
@ -246,6 +248,8 @@ challenges:
|
||||
input-mode: 'Switch between chat and anvil input modes.'
|
||||
title-enable: 'Allows to enable/disable title message that will be showed when player complete challenge.'
|
||||
title-showtime: 'Allows to modify how long title message will be visible for player.'
|
||||
default-import: 'Allows to import default challenges.'
|
||||
default-export: 'Allows to export existing challenges into defaults.json file.'
|
||||
current-value: '|&6Current value: [value].'
|
||||
enabled: 'Active'
|
||||
disabled: 'Disabled'
|
||||
|
Loading…
Reference in New Issue
Block a user