mirror of
https://github.com/songoda/EpicBosses.git
synced 2024-06-26 14:44:58 +02:00
1.0.0-SNAPSHOT-U189
+ Connected AutoSpawnSpecialSettings to editor.yml + Started implementing AutoSpawnSpecialSettingsPanel + Updated MainAutoSpawnEditor to have a better Editing button handler
This commit is contained in:
parent
a5687f8bd2
commit
1f8bd1cf91
|
@ -2682,4 +2682,95 @@ AutoSpawnCustomSettingsEditMenu:
|
||||||
name: '&7'
|
name: '&7'
|
||||||
'54':
|
'54':
|
||||||
type: GLASS_PANE
|
type: GLASS_PANE
|
||||||
name: '&7'
|
name: '&7'
|
||||||
|
AutoSpawnSpecialSettingsEditMenu:
|
||||||
|
name: '&b&l{name} AutoSpawn'
|
||||||
|
slots: 9
|
||||||
|
Settings:
|
||||||
|
backButton: true
|
||||||
|
emptySpaceFiller: true
|
||||||
|
EmptySpaceFiller:
|
||||||
|
type: WHITE_STAINED_GLASS_PANE
|
||||||
|
name: '&7'
|
||||||
|
Buttons:
|
||||||
|
backButton: 5
|
||||||
|
Items:
|
||||||
|
'1':
|
||||||
|
type: DIAMOND
|
||||||
|
name: '&e&lShuffle Entities'
|
||||||
|
lore:
|
||||||
|
- '&bCurrently: &f{shuffleEntities}'
|
||||||
|
- '&7'
|
||||||
|
- '&7Click here to toggle the entities being'
|
||||||
|
- '&7shuffled before being called.'
|
||||||
|
Button: ShuffleEntities
|
||||||
|
'2':
|
||||||
|
type: GUNPOWDER
|
||||||
|
name: '&e&lMax Alive Entities At Once'
|
||||||
|
lore:
|
||||||
|
- '&bCurrently: &f{maxAliveEntities}'
|
||||||
|
- '&7'
|
||||||
|
- '&7This is the max alive entities from this'
|
||||||
|
- '&7auto spawn section at once. If more then'
|
||||||
|
- '&7this amount of entities is spawned at once'
|
||||||
|
- '&7then you will have to kill all entities'
|
||||||
|
- '&7before another can spawn.'
|
||||||
|
- '&7'
|
||||||
|
- '&bLeft Click &8» &f+1'
|
||||||
|
- '&bRight Click &8» &f-1'
|
||||||
|
Button: MaxAliveEntities
|
||||||
|
'3':
|
||||||
|
type: FIREWORK_CHARGE
|
||||||
|
name: '&e&lAmount of Bosses Per Spawn'
|
||||||
|
lore:
|
||||||
|
- '&bCurrently: &f{amountPerSpawn}'
|
||||||
|
- '&7'
|
||||||
|
- '&7This is the amount of bosses to be spawned'
|
||||||
|
- '&7at one interval. This can be higher then the'
|
||||||
|
- '&7max alive entities at once but you will need'
|
||||||
|
- '&7to kill the amount of bosses till it the currently'
|
||||||
|
- '&7active amount is less then the max amount so'
|
||||||
|
- '&7it can spawn again.'
|
||||||
|
- '&7'
|
||||||
|
- '&bLeft Click &8» &f+1'
|
||||||
|
- '&bRight Click &8» &f-1'
|
||||||
|
Button: AmountPerSpawn
|
||||||
|
'5':
|
||||||
|
type: REDSTONE
|
||||||
|
name: '&cClick here to go back'
|
||||||
|
lore:
|
||||||
|
- '&7Click this button to go back.'
|
||||||
|
'7':
|
||||||
|
type: PAPER
|
||||||
|
name: '&e&lSpawn When Chunk Isn''t Loaded'
|
||||||
|
lore:
|
||||||
|
- '&bCurrently: &f{chunkIsntLoaded}'
|
||||||
|
- '&7'
|
||||||
|
- '&7This will determine if the boss can spawn'
|
||||||
|
- '&7even when the chunk is unloaded. This will'
|
||||||
|
- '&7load the chunk and keep it loaded while the'
|
||||||
|
- '&7boss is alive if this is set to true.'
|
||||||
|
Button: ChunkIsntLoaded
|
||||||
|
'8':
|
||||||
|
type: EMERALD
|
||||||
|
name: '&e&lOverride Default Spawn Message'
|
||||||
|
lore:
|
||||||
|
- '&bCurrently: &f{overrideDefaultMessage}'
|
||||||
|
- '&7'
|
||||||
|
- '&7Click here to toggle the overriding of the'
|
||||||
|
- '&7default spawn messages. If this is set to'
|
||||||
|
- '&7true it won''t use the default boss spawn'
|
||||||
|
- '&7messages and it will use the one assigned'
|
||||||
|
- '&7to this auto spawn section.'
|
||||||
|
Button: OverrideSpawnMessage
|
||||||
|
'9':
|
||||||
|
type: CHEST
|
||||||
|
name: '&e&lSpawn Message'
|
||||||
|
lore:
|
||||||
|
- '&bCurrently: &f{spawnMessage}'
|
||||||
|
- '&7'
|
||||||
|
- '&7Click here to change which spawn message'
|
||||||
|
- '&7is used for the auto spawn section. If the'
|
||||||
|
- '&7overriding of the default message is true'
|
||||||
|
- '&7only then will this message be used.'
|
||||||
|
Button: SpawnMessage
|
|
@ -1,9 +1,81 @@
|
||||||
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.autospawns.settings.AutoSpawnSettings;
|
||||||
|
import com.songoda.epicbosses.managers.BossPanelManager;
|
||||||
|
import com.songoda.epicbosses.managers.files.AutoSpawnFileManager;
|
||||||
|
import com.songoda.epicbosses.utils.NumberUtils;
|
||||||
|
import com.songoda.epicbosses.utils.ObjectUtils;
|
||||||
|
import com.songoda.epicbosses.utils.panel.Panel;
|
||||||
|
import com.songoda.epicbosses.utils.panel.base.handlers.VariablePanelHandler;
|
||||||
|
import com.songoda.epicbosses.utils.panel.builder.PanelBuilder;
|
||||||
|
import com.songoda.epicbosses.utils.panel.builder.PanelBuilderCounter;
|
||||||
|
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
|
||||||
* @since 07-Jan-19
|
* @since 07-Jan-19
|
||||||
*/
|
*/
|
||||||
public class AutoSpawnSpecialSettingsEditorPanel {
|
public class AutoSpawnSpecialSettingsEditorPanel extends VariablePanelHandler<AutoSpawn> {
|
||||||
|
|
||||||
|
private AutoSpawnFileManager autoSpawnFileManager;
|
||||||
|
private CustomBosses plugin;
|
||||||
|
|
||||||
|
public AutoSpawnSpecialSettingsEditorPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
|
||||||
|
super(bossPanelManager, panelBuilder);
|
||||||
|
|
||||||
|
this.autoSpawnFileManager = plugin.getAutoSpawnFileManager();
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fillPanel(Panel panel, AutoSpawn autoSpawn) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void openFor(Player player, AutoSpawn autoSpawn) {
|
||||||
|
Map<String, String> replaceMap = new HashMap<>();
|
||||||
|
PanelBuilder panelBuilder = getPanelBuilder().cloneBuilder();
|
||||||
|
AutoSpawnSettings autoSpawnSettings = autoSpawn.getAutoSpawnSettings();
|
||||||
|
String shuffleEntities = ObjectUtils.getValue(autoSpawnSettings.getShuffleEntitiesList(), false)+"";
|
||||||
|
String maxAliveAtOnce = NumberUtils.get().formatDouble(ObjectUtils.getValue(autoSpawnSettings.getMaxAliveAtOnce(), 1));
|
||||||
|
String amountPerSpawn = NumberUtils.get().formatDouble(ObjectUtils.getValue(autoSpawnSettings.getAmountPerSpawn(), 1));
|
||||||
|
String chunkIsntLoaded = ObjectUtils.getValue(autoSpawnSettings.getSpawnWhenChunkIsntLoaded(), false)+"";
|
||||||
|
String overrideSpawnMessage = ObjectUtils.getValue(autoSpawnSettings.getOverrideDefaultSpawnMessage(), false)+"";
|
||||||
|
String spawnMessage = ObjectUtils.getValue(autoSpawnSettings.getSpawnMessage(), "");
|
||||||
|
|
||||||
|
replaceMap.put("{name}", BossAPI.getAutoSpawnName(autoSpawn));
|
||||||
|
replaceMap.put("{shuffleEntities}", shuffleEntities);
|
||||||
|
replaceMap.put("{maxAliveEntities}", maxAliveAtOnce);
|
||||||
|
replaceMap.put("{amountPerSpawn}", amountPerSpawn);
|
||||||
|
replaceMap.put("{chunkIsntLoaded}", chunkIsntLoaded);
|
||||||
|
replaceMap.put("{overrideDefaultMessage}", overrideSpawnMessage);
|
||||||
|
replaceMap.put("{spawnMessage}", spawnMessage);
|
||||||
|
panelBuilder.addReplaceData(replaceMap);
|
||||||
|
|
||||||
|
Panel panel = panelBuilder.getPanel()
|
||||||
|
.setParentPanelHandler(this.bossPanelManager.getMainAutoSpawnEditPanel(), autoSpawn);
|
||||||
|
PanelBuilderCounter counter = panel.getPanelBuilderCounter();
|
||||||
|
|
||||||
|
counter.getSlotsWith("ShuffleEntities").forEach(slot -> {});
|
||||||
|
counter.getSlotsWith("MaxAliveEntities").forEach(slot -> {});
|
||||||
|
counter.getSlotsWith("AmountPerSpawn").forEach(slot -> {});
|
||||||
|
counter.getSlotsWith("ChunkIsntLoaded").forEach(slot -> {});
|
||||||
|
counter.getSlotsWith("OverrideSpawnMessage").forEach(slot -> {});
|
||||||
|
counter.getSlotsWith("SpawnMessage").forEach(slot -> {});
|
||||||
|
|
||||||
|
panel.openFor(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initializePanel(PanelBuilder panelBuilder) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,29 +78,35 @@ public class MainAutoSpawnEditorPanel extends VariablePanelHandler<AutoSpawn> {
|
||||||
private ClickAction getEditingAction(AutoSpawn autoSpawn) {
|
private ClickAction getEditingAction(AutoSpawn autoSpawn) {
|
||||||
return event -> {
|
return event -> {
|
||||||
Player player = (Player) event.getWhoClicked();
|
Player player = (Player) event.getWhoClicked();
|
||||||
|
boolean editing = autoSpawn.isEditing();
|
||||||
|
|
||||||
if(autoSpawn.isCompleteEnoughToSpawn()) {
|
if(!editing) {
|
||||||
autoSpawn.setEditing(!autoSpawn.isEditing());
|
autoSpawn.setEditing(true);
|
||||||
this.autoSpawnFileManager.save();
|
} else {
|
||||||
player.closeInventory();
|
if(!autoSpawn.isCompleteEnoughToSpawn()) {
|
||||||
|
Message.Boss_AutoSpawn_NotCompleteEnough.msg(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Message.Boss_AutoSpawn_ToggleEditing.msg(player, BossAPI.getAutoSpawnName(autoSpawn), autoSpawn.isEditing());
|
autoSpawn.setEditing(false);
|
||||||
|
}
|
||||||
|
|
||||||
if(autoSpawn.isEditing()) {
|
Message.Boss_AutoSpawn_ToggleEditing.msg(player, BossAPI.getAutoSpawnName(autoSpawn), autoSpawn.isEditing());
|
||||||
this.autoSpawnManager.stopInterval(autoSpawn);
|
this.autoSpawnFileManager.save();
|
||||||
} else {
|
player.closeInventory();
|
||||||
ActiveAutoSpawnHolder autoSpawnHolder = this.autoSpawnManager.getActiveAutoSpawnHolder(autoSpawn);
|
|
||||||
|
|
||||||
if(autoSpawnHolder != null) {
|
if(autoSpawn.isEditing()) {
|
||||||
if(autoSpawnHolder.getSpawnType() == SpawnType.INTERVAL) {
|
this.autoSpawnManager.stopInterval(autoSpawn);
|
||||||
ActiveIntervalAutoSpawnHolder intervalAutoSpawnHolder = (ActiveIntervalAutoSpawnHolder) autoSpawnHolder;
|
} else {
|
||||||
|
ActiveAutoSpawnHolder autoSpawnHolder = this.autoSpawnManager.getActiveAutoSpawnHolder(autoSpawn);
|
||||||
|
|
||||||
intervalAutoSpawnHolder.restartInterval();
|
if(autoSpawnHolder != null) {
|
||||||
}
|
if(autoSpawnHolder.getSpawnType() == SpawnType.INTERVAL) {
|
||||||
|
ActiveIntervalAutoSpawnHolder intervalAutoSpawnHolder = (ActiveIntervalAutoSpawnHolder) autoSpawnHolder;
|
||||||
|
|
||||||
|
intervalAutoSpawnHolder.restartInterval();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Message.Boss_AutoSpawn_NotCompleteEnough.msg(player);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -19,7 +19,7 @@
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<plugin.version>1.0.0-U188</plugin.version>
|
<plugin.version>1.0.0-U189</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>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user