1.0.0-SNAPSHOT-U192

+ Connected and completed the AutoSpawn Panel Editors
This commit is contained in:
Charles 2019-01-09 01:26:56 +08:00
parent 1988e9913b
commit e316816c33
7 changed files with 154 additions and 9 deletions

View File

@ -104,7 +104,7 @@ Display:
- '&3Shuffle Entities: &f{shuffleEntities}' - '&3Shuffle Entities: &f{shuffleEntities}'
- '&3Custom Spawn Message: &f{customSpawnMessage}' - '&3Custom Spawn Message: &f{customSpawnMessage}'
Entities: Entities:
selectedName: '&bBoss: &f{name} &a*** Selected ***' selectedName: '&bBoss: &f{name} &a** Selected **'
name: '&bBoss: &f{name}' name: '&bBoss: &f{name}'
lore: lore:
- '&3Editing: &f{editing}' - '&3Editing: &f{editing}'
@ -117,6 +117,13 @@ Display:
lore: lore:
- '&3Currently: &f{currently}' - '&3Currently: &f{currently}'
- '{extraInformation}' - '{extraInformation}'
SpawnMessage:
menuName: '&b&l{name} AutoSpawn'
selectedName: '&bMessage: &f{name} &a** Selected **'
name: '&bMessage: &f{name}'
lore:
- '&fStrings within this section:'
- '{message}'
Bosses: Bosses:
menuName: '&b&lEpicBosses &3&lBosses' menuName: '&b&lEpicBosses &3&lBosses'
name: '&b&l{name}' name: '&b&l{name}'

View File

@ -2774,3 +2774,59 @@ AutoSpawnSpecialSettingsEditMenu:
- '&7overriding of the default message is true' - '&7overriding of the default message is true'
- '&7only then will this message be used.' - '&7only then will this message be used.'
Button: SpawnMessage Button: SpawnMessage
AutoSpawnTypeEditMenu:
name: '&b&l{name} AutoSpawn'
slots: 9
Settings:
backButton: true
emptySpaceFiller: true
EmptySpaceFiller:
type: WHITE_STAINED_GLASS_PANE
name: '&7'
Buttons:
backButton: 9
Items:
'2':
type: CLOCK
name: '&e&lInterval Spawn System'
lore:
- '&7Select this spawn system if you want to make'
- '&7the bosses spawn at a certain interval at a'
- '&7specific location.'
Button: IntervalSystem
'3':
type: GRASS_BLOCK
name: '&e&lWilderness Spawn System'
lore:
- '&7Select this spawn system if you want to make'
- '&7the boss(es) spawn randomly in the wilderness'
- '&7as players load the chunks.'
- '&7'
- '&c&lComing soon...'
Button: WildernessSystem
'4':
type: MAGMA_CREAM
name: '&e&lBiome Spawn System'
lore:
- '&7Select this spawn system if you want to make'
- '&7the boss(es) spawn randomly in specific biomes'
- '&7as players load and unload the chunks which are'
- '&7the selected biome.'
- '&7'
- '&c&lComing soon...'
Button: BiomeSystem
'5':
type: MOB_SPAWNER
name: '&e&lMob Spawner Spawn System'
lore:
- '&7Select this spawn system if you want to make'
- '&7the boss(es) spawn randomly within the selected'
- '&7spawner types.'
- '&7'
- '&c&lComing soon...'
Button: SpawnerSystem
'9':
type: REDSTONE
name: '&cClick here to go back'
lore:
- '&7Click this button to go back.'

View File

@ -10,10 +10,7 @@ import com.songoda.epicbosses.entity.BossEntity;
import com.songoda.epicbosses.entity.elements.EntityStatsElement; import com.songoda.epicbosses.entity.elements.EntityStatsElement;
import com.songoda.epicbosses.entity.elements.EquipmentElement; import com.songoda.epicbosses.entity.elements.EquipmentElement;
import com.songoda.epicbosses.entity.elements.HandsElement; import com.songoda.epicbosses.entity.elements.HandsElement;
import com.songoda.epicbosses.panel.autospawns.AutoSpawnCustomSettingsEditorPanel; import com.songoda.epicbosses.panel.autospawns.*;
import com.songoda.epicbosses.panel.autospawns.AutoSpawnEntitiesEditorPanel;
import com.songoda.epicbosses.panel.autospawns.AutoSpawnSpecialSettingsEditorPanel;
import com.songoda.epicbosses.panel.autospawns.MainAutoSpawnEditorPanel;
import com.songoda.epicbosses.panel.bosses.*; import com.songoda.epicbosses.panel.bosses.*;
import com.songoda.epicbosses.panel.bosses.commands.OnDeathCommandEditor; import com.songoda.epicbosses.panel.bosses.commands.OnDeathCommandEditor;
import com.songoda.epicbosses.panel.bosses.commands.OnSpawnCommandEditor; import com.songoda.epicbosses.panel.bosses.commands.OnSpawnCommandEditor;
@ -252,11 +249,14 @@ public class BossPanelManager implements ILoadable, IReloadable {
PanelBuilder panelBuilder1 = new PanelBuilder(editor.getConfigurationSection("AutoSpawnEntitiesEditMenu")); PanelBuilder panelBuilder1 = new PanelBuilder(editor.getConfigurationSection("AutoSpawnEntitiesEditMenu"));
PanelBuilder panelBuilder2 = new PanelBuilder(editor.getConfigurationSection("AutoSpawnCustomSettingsEditMenu")); PanelBuilder panelBuilder2 = new PanelBuilder(editor.getConfigurationSection("AutoSpawnCustomSettingsEditMenu"));
PanelBuilder panelBuilder3 = new PanelBuilder(editor.getConfigurationSection("AutoSpawnSpecialSettingsEditMenu")); PanelBuilder panelBuilder3 = new PanelBuilder(editor.getConfigurationSection("AutoSpawnSpecialSettingsEditMenu"));
PanelBuilder panelBuilder4 = new PanelBuilder(editor.getConfigurationSection("AutoSpawnTypeEditMenu"));
this.mainAutoSpawnEditPanel = new MainAutoSpawnEditorPanel(this, panelBuilder, this.customBosses); this.mainAutoSpawnEditPanel = new MainAutoSpawnEditorPanel(this, panelBuilder, this.customBosses);
this.autoSpawnEntitiesEditPanel = new AutoSpawnEntitiesEditorPanel(this, panelBuilder1, this.customBosses); this.autoSpawnEntitiesEditPanel = new AutoSpawnEntitiesEditorPanel(this, panelBuilder1, this.customBosses);
this.autoSpawnCustomSettingsEditorPanel = new AutoSpawnCustomSettingsEditorPanel(this, panelBuilder2, this.customBosses); this.autoSpawnCustomSettingsEditorPanel = new AutoSpawnCustomSettingsEditorPanel(this, panelBuilder2, this.customBosses);
this.autoSpawnSpecialSettingsEditorPanel = new AutoSpawnSpecialSettingsEditorPanel(this, panelBuilder3, this.customBosses); this.autoSpawnSpecialSettingsEditorPanel = new AutoSpawnSpecialSettingsEditorPanel(this, panelBuilder3, this.customBosses);
this.autoSpawnMessageEditorPanel = new AutoSpawnSpawnMessageEditorPanel(this, getListMenu("AutoSpawns.SpawnMessage"), this.customBosses);
this.autoSpawnTypeEditorPanel = new AutoSpawnTypeEditorPanel(this, panelBuilder4, this.customBosses);
} }
private void reloadAutoSpawnEditMenus() { private void reloadAutoSpawnEditMenus() {
@ -265,11 +265,14 @@ public class BossPanelManager implements ILoadable, IReloadable {
PanelBuilder panelBuilder1 = new PanelBuilder(editor.getConfigurationSection("AutoSpawnEntitiesEditMenu")); PanelBuilder panelBuilder1 = new PanelBuilder(editor.getConfigurationSection("AutoSpawnEntitiesEditMenu"));
PanelBuilder panelBuilder2 = new PanelBuilder(editor.getConfigurationSection("AutoSpawnCustomSettingsEditMenu")); PanelBuilder panelBuilder2 = new PanelBuilder(editor.getConfigurationSection("AutoSpawnCustomSettingsEditMenu"));
PanelBuilder panelBuilder3 = new PanelBuilder(editor.getConfigurationSection("AutoSpawnSpecialSettingsEditMenu")); PanelBuilder panelBuilder3 = new PanelBuilder(editor.getConfigurationSection("AutoSpawnSpecialSettingsEditMenu"));
PanelBuilder panelBuilder4 = new PanelBuilder(editor.getConfigurationSection("AutoSpawnTypeEditMenu"));
this.mainAutoSpawnEditPanel.initializePanel(panelBuilder); this.mainAutoSpawnEditPanel.initializePanel(panelBuilder);
this.autoSpawnEntitiesEditPanel.initializePanel(panelBuilder1); this.autoSpawnEntitiesEditPanel.initializePanel(panelBuilder1);
this.autoSpawnCustomSettingsEditorPanel.initializePanel(panelBuilder2); this.autoSpawnCustomSettingsEditorPanel.initializePanel(panelBuilder2);
this.autoSpawnSpecialSettingsEditorPanel.initializePanel(panelBuilder3); this.autoSpawnSpecialSettingsEditorPanel.initializePanel(panelBuilder3);
this.autoSpawnMessageEditorPanel.initializePanel(getListMenu("AutoSpawns.SpawnMessage"));
this.autoSpawnTypeEditorPanel.initializePanel(panelBuilder4);
} }
//--------------------------------------------- //---------------------------------------------

View File

@ -1,9 +1,48 @@
package com.songoda.epicbosses.panel.autospawns; package com.songoda.epicbosses.panel.autospawns;
import com.songoda.epicbosses.CustomBosses;
import com.songoda.epicbosses.api.BossAPI;
import com.songoda.epicbosses.autospawns.AutoSpawn;
import com.songoda.epicbosses.managers.BossPanelManager;
import com.songoda.epicbosses.managers.files.AutoSpawnFileManager;
import com.songoda.epicbosses.panel.handlers.SingleMessageListEditor;
import com.songoda.epicbosses.utils.ObjectUtils;
import com.songoda.epicbosses.utils.panel.base.IVariablePanelHandler;
import com.songoda.epicbosses.utils.panel.builder.PanelBuilder;
/** /**
* @author Charles Cullen * @author Charles Cullen
* @version 1.0.0 * @version 1.0.0
* @since 09-Jan-19 * @since 09-Jan-19
*/ */
public class AutoSpawnSpawnMessageEditorPanel { public class AutoSpawnSpawnMessageEditorPanel extends SingleMessageListEditor<AutoSpawn> {
private AutoSpawnFileManager autoSpawnFileManager;
public AutoSpawnSpawnMessageEditorPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
super(bossPanelManager, panelBuilder, plugin);
this.autoSpawnFileManager = plugin.getAutoSpawnFileManager();
}
@Override
public String getCurrent(AutoSpawn object) {
return ObjectUtils.getValue(object.getAutoSpawnSettings().getSpawnMessage(), "");
}
@Override
public void updateMessage(AutoSpawn object, String newPath) {
object.getAutoSpawnSettings().setSpawnMessage(newPath);
this.autoSpawnFileManager.save();
}
@Override
public IVariablePanelHandler<AutoSpawn> getParentHolder() {
return this.bossPanelManager.getAutoSpawnSpecialSettingsEditorPanel();
}
@Override
public String getName(AutoSpawn object) {
return BossAPI.getAutoSpawnName(object);
}
} }

View File

@ -1,13 +1,22 @@
package com.songoda.epicbosses.panel.autospawns; package com.songoda.epicbosses.panel.autospawns;
import com.songoda.epicbosses.CustomBosses; import com.songoda.epicbosses.CustomBosses;
import com.songoda.epicbosses.api.BossAPI;
import com.songoda.epicbosses.autospawns.AutoSpawn; import com.songoda.epicbosses.autospawns.AutoSpawn;
import com.songoda.epicbosses.autospawns.types.IntervalSpawnElement;
import com.songoda.epicbosses.managers.BossPanelManager; import com.songoda.epicbosses.managers.BossPanelManager;
import com.songoda.epicbosses.managers.files.AutoSpawnFileManager;
import com.songoda.epicbosses.utils.Message;
import com.songoda.epicbosses.utils.panel.Panel; import com.songoda.epicbosses.utils.panel.Panel;
import com.songoda.epicbosses.utils.panel.base.ClickAction;
import com.songoda.epicbosses.utils.panel.base.handlers.VariablePanelHandler; import com.songoda.epicbosses.utils.panel.base.handlers.VariablePanelHandler;
import com.songoda.epicbosses.utils.panel.builder.PanelBuilder; import com.songoda.epicbosses.utils.panel.builder.PanelBuilder;
import com.songoda.epicbosses.utils.panel.builder.PanelBuilderCounter;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.HashMap;
import java.util.Map;
/** /**
* @author Charles Cullen * @author Charles Cullen
* @version 1.0.0 * @version 1.0.0
@ -15,8 +24,12 @@ import org.bukkit.entity.Player;
*/ */
public class AutoSpawnTypeEditorPanel extends VariablePanelHandler<AutoSpawn> { public class AutoSpawnTypeEditorPanel extends VariablePanelHandler<AutoSpawn> {
private AutoSpawnFileManager autoSpawnFileManager;
public AutoSpawnTypeEditorPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) { public AutoSpawnTypeEditorPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
super(bossPanelManager, panelBuilder); super(bossPanelManager, panelBuilder);
this.autoSpawnFileManager = plugin.getAutoSpawnFileManager();
} }
@Override @Override
@ -26,11 +39,38 @@ public class AutoSpawnTypeEditorPanel extends VariablePanelHandler<AutoSpawn> {
@Override @Override
public void openFor(Player player, AutoSpawn autoSpawn) { public void openFor(Player player, AutoSpawn autoSpawn) {
Map<String, String> replaceMap = new HashMap<>();
PanelBuilder panelBuilder = getPanelBuilder().cloneBuilder();
replaceMap.put("{name}", BossAPI.getAutoSpawnName(autoSpawn));
panelBuilder.addReplaceData(replaceMap);
Panel panel = panelBuilder.getPanel()
.setParentPanelHandler(this.bossPanelManager.getMainAutoSpawnEditPanel(), autoSpawn);
PanelBuilderCounter counter = panel.getPanelBuilderCounter();
counter.getSlotsWith("IntervalSystem").forEach(slot -> panel.setOnClick(slot, getIntervalSystem(autoSpawn)));
counter.getSlotsWith("WildernessSystem");
counter.getSlotsWith("BiomeSystem");
counter.getSlotsWith("SpawnerSystem");
panel.openFor(player);
} }
@Override @Override
public void initializePanel(PanelBuilder panelBuilder) { public void initializePanel(PanelBuilder panelBuilder) {
} }
private ClickAction getIntervalSystem(AutoSpawn autoSpawn) {
return event -> {
if(!autoSpawn.isEditing()) {
Message.Boss_AutoSpawn_MustToggleEditing.msg(event.getWhoClicked());
return;
}
autoSpawn.setCustomData(BossAPI.convertObjectToJsonObject(new IntervalSpawnElement("world,0,100,0", "{boss_" + BossAPI.getAutoSpawnName(autoSpawn) + "}", 30, false)));
this.autoSpawnFileManager.save();
};
}
} }

View File

@ -65,7 +65,7 @@ public class MainAutoSpawnEditorPanel extends VariablePanelHandler<AutoSpawn> {
counter.getSlotsWith("SpecialSettings").forEach(slot -> panel.setOnClick(slot, event -> this.bossPanelManager.getAutoSpawnSpecialSettingsEditorPanel().openFor(player, autoSpawn))); counter.getSlotsWith("SpecialSettings").forEach(slot -> panel.setOnClick(slot, event -> this.bossPanelManager.getAutoSpawnSpecialSettingsEditorPanel().openFor(player, autoSpawn)));
counter.getSlotsWith("Type").forEach(slot -> panel.setOnClick(slot, event -> this.bossPanelManager.getAutoSpawnTypeEditorPanel().openFor(player, autoSpawn))); counter.getSlotsWith("Type").forEach(slot -> panel.setOnClick(slot, event -> this.bossPanelManager.getAutoSpawnTypeEditorPanel().openFor(player, autoSpawn)));
counter.getSlotsWith("Entities").forEach(slot -> panel.setOnClick(slot, event -> this.bossPanelManager.getAutoSpawnEntitiesEditPanel().openFor(player, autoSpawn))); counter.getSlotsWith("Entities").forEach(slot -> panel.setOnClick(slot, event -> this.bossPanelManager.getAutoSpawnEntitiesEditPanel().openFor(player, autoSpawn)));
counter.getSlotsWith("CustomSettings").forEach(slot -> {}); counter.getSlotsWith("CustomSettings").forEach(slot -> panel.setOnClick(slot, event -> this.bossPanelManager.getAutoSpawnCustomSettingsEditorPanel().openFor(player, autoSpawn)));
panel.openFor(player); panel.openFor(player);
} }

View File

@ -19,7 +19,7 @@
</modules> </modules>
<properties> <properties>
<plugin.version>1.0.0-U191</plugin.version> <plugin.version>1.0.0-U192</plugin.version>
<plugin.name>EpicBosses</plugin.name> <plugin.name>EpicBosses</plugin.name>
<plugin.main>com.songoda.epicbosses.CustomBosses</plugin.main> <plugin.main>com.songoda.epicbosses.CustomBosses</plugin.main>
<plugin.author>AMinecraftDev</plugin.author> <plugin.author>AMinecraftDev</plugin.author>