mirror of
https://github.com/songoda/EpicBosses.git
synced 2025-03-12 22:49:13 +01:00
1.0.0-SNAPSHOT-U94
+ Implemented Taunt menus + Updated config.yml + Updated editor.yml + Fixed a few issues within editor.yml + Removed Death and Spawn Message List Editors and moved them to SingleMessageListEditor + Implemented method in WorldGuardHelper to get List of regions at location
This commit is contained in:
parent
12872d9515
commit
d108fb5657
@ -1210,15 +1210,69 @@ SpawnTextEditorPanel:
|
||||
- '&7blocks. Set it to &f-1&7 if you want it'
|
||||
- '&7to be a server-wide broadcast.'
|
||||
- '&7'
|
||||
- '&bLeft Click »'
|
||||
- '&7Increase the radius by &f1&7.'
|
||||
- '&bLeft Click &8» &f+1'
|
||||
- '&bShift Left-Click &8» &f+10'
|
||||
- '&7'
|
||||
- '&bShift Left-Click »'
|
||||
- '&7Increase the radius by &f10&7.'
|
||||
- '&7'
|
||||
- '&bRight Click »'
|
||||
- '&7Decrease the radius by &f1&7.'
|
||||
- '&7'
|
||||
- '&bShift Right-Click »'
|
||||
- '&7Decrease the radius by &f10&7.'
|
||||
- '&bRight Click &8» &f-1'
|
||||
- '&bShift Right-Click &8» &f-10'
|
||||
Button: Radius
|
||||
TauntEditorPanel:
|
||||
name: '&b&l{name} Editor'
|
||||
slots: 9
|
||||
Settings:
|
||||
backButton: true
|
||||
emptySpaceFiller: true
|
||||
EmptySpaceFiller:
|
||||
type: WHITE_STAINED_GLASS_PANE
|
||||
name: '&7'
|
||||
Buttons:
|
||||
backButton: 9
|
||||
Items:
|
||||
'3':
|
||||
type: REDSTONE
|
||||
name: '&e&lRadius'
|
||||
lore:
|
||||
- '&7Here you can change the radius that players'
|
||||
- '&7will see the taunts in. It is currently: &f{radius}'
|
||||
- '&7blocks. Set it to &f-1&7 if you want it'
|
||||
- '&7to be a server-wide broadcast.'
|
||||
- '&7'
|
||||
- '&bLeft Click &8» &f+1'
|
||||
- '&bShift Left-Click &8» &f+10'
|
||||
- '&7'
|
||||
- '&bRight Click &8» &f-1'
|
||||
- '&bShift Right-Click &8» &f-10'
|
||||
Button: Radius
|
||||
'5':
|
||||
type: BOOK
|
||||
name: '&e&lTaunts'
|
||||
lore:
|
||||
- '&7Here you can select the taunts that the boss'
|
||||
- '&7will say while he is active. If this list is'
|
||||
- '&7empty he won''t say anything.'
|
||||
- '&7'
|
||||
- '&bCurrently Selected:'
|
||||
- '&f{taunts}'
|
||||
Button: Taunts
|
||||
'7':
|
||||
type: CLOCK
|
||||
name: '&e&lDelay'
|
||||
lore:
|
||||
- '&7Here you can change the delay between each'
|
||||
- '&7taunt that the boss says. The delay is'
|
||||
- '&7currently set to {delay}s. This time is in'
|
||||
- '&7seconds. Once the boss has gone through the'
|
||||
- '&7list of taunts he will start again at the'
|
||||
- '&7beginning until he''s dead.'
|
||||
- '&7'
|
||||
- '&bLeft Click &8» &f+1'
|
||||
- '&bShift Left-Click &8» &f+10'
|
||||
- '&7'
|
||||
- '&bRight Click &8» &f-1'
|
||||
- '&bShift Right-Click &8» &f-10'
|
||||
Button: Delay
|
||||
'9':
|
||||
type: PAPER
|
||||
name: '&e&lGo Back'
|
||||
lore:
|
||||
- '&7Click here to go back.'
|
||||
|
@ -14,12 +14,10 @@ import com.songoda.epicbosses.panel.bosses.equipment.HelmetEditorPanel;
|
||||
import com.songoda.epicbosses.panel.bosses.equipment.LeggingsEditorPanel;
|
||||
import com.songoda.epicbosses.panel.bosses.list.BossListStatisticEditorPanel;
|
||||
import com.songoda.epicbosses.panel.bosses.list.BossListWeaponEditorPanel;
|
||||
import com.songoda.epicbosses.panel.bosses.text.DeathMessageListEditor;
|
||||
import com.songoda.epicbosses.panel.bosses.text.DeathTextEditorPanel;
|
||||
import com.songoda.epicbosses.panel.bosses.text.SpawnMessageListEditor;
|
||||
import com.songoda.epicbosses.panel.bosses.text.SpawnTextEditorPanel;
|
||||
import com.songoda.epicbosses.panel.bosses.text.*;
|
||||
import com.songoda.epicbosses.panel.bosses.weapons.MainHandEditorPanel;
|
||||
import com.songoda.epicbosses.panel.bosses.weapons.OffHandEditorPanel;
|
||||
import com.songoda.epicbosses.panel.handlers.*;
|
||||
import com.songoda.epicbosses.utils.panel.base.ISubVariablePanelHandler;
|
||||
import com.songoda.epicbosses.utils.panel.base.IVariablePanelHandler;
|
||||
import lombok.Getter;
|
||||
@ -44,14 +42,18 @@ import java.util.Map;
|
||||
*/
|
||||
public class BossPanelManager implements ILoadable, IReloadable {
|
||||
|
||||
private static final String HELMET_EDITOR_PATH = "HelmetEditorPanel", CHESTPLATE_EDITOR_PATH = "ChestplateEditorPanel", LEGGINGS_EDITOR_PATH = "LeggingsEditorPanel",
|
||||
BOOTS_EDITOR_PATH = "BootsEditorPanel", MAIN_HAND_EDITOR_PATH = "MainHandEditorPanel", OFF_HAND_EDITOR_PATH = "OffHandEditorPanel";
|
||||
|
||||
@Getter private IPanelHandler mainMenu, customItems, bosses, autoSpawns, dropTables, customSkills, shopPanel;
|
||||
@Getter private IPanelHandler addItemsMenu;
|
||||
|
||||
@Getter private ISubVariablePanelHandler<BossEntity, EntityStatsElement> equipmentEditMenu, helmetEditorMenu, chestplateEditorMenu, leggingsEditorMenu, bootsEditorMenu;
|
||||
@Getter private ISubVariablePanelHandler<BossEntity, EntityStatsElement> weaponEditMenu, offHandEditorMenu, mainHandEditorMenu;
|
||||
@Getter private ISubVariablePanelHandler<BossEntity, EntityStatsElement> statisticMainEditMenu, entityTypeEditMenu;
|
||||
@Getter private IVariablePanelHandler<BossEntity> mainBossEditMenu, dropsEditMenu, targetingEditMenu, skillsBossEditMenu, skillListBossEditMenu, commandsMainEditMenu, onSpawnCommandEditMenu, onDeathCommandEditMenu;
|
||||
@Getter private IVariablePanelHandler<BossEntity> mainDropsEditMenu, mainTextEditMenu, mainTauntEditMenu, onSpawnTextEditMenu, onSpawnSubTextEditMenu, onDeathTextEditMenu, onDeathSubTextEditMenu, onDeathPositionTextEditMenu;
|
||||
@Getter private IVariablePanelHandler<BossEntity> mainBossEditMenu, dropsEditMenu, targetingEditMenu, skillsBossEditMenu, skillListBossEditMenu, commandsMainEditMenu, onSpawnCommandEditMenu,
|
||||
onDeathCommandEditMenu, mainDropsEditMenu, mainTextEditMenu, mainTauntEditMenu, onSpawnTextEditMenu, onSpawnSubTextEditMenu, onDeathTextEditMenu, onDeathSubTextEditMenu, onDeathPositionTextEditMenu,
|
||||
onTauntTextEditMenu;
|
||||
@Getter private BossListEditorPanel equipmentListEditMenu, weaponListEditMenu, statisticListEditMenu;
|
||||
|
||||
private final CustomBosses customBosses;
|
||||
@ -146,16 +148,33 @@ public class BossPanelManager implements ILoadable, IReloadable {
|
||||
//---------------------------------------------
|
||||
|
||||
private void loadTextEditMenus() {
|
||||
PanelBuilder panelBuilder = new PanelBuilder(this.customBosses.getEditor().getConfigurationSection("TextEditorMainPanel"));
|
||||
PanelBuilder panelBuilder1 = new PanelBuilder(this.customBosses.getEditor().getConfigurationSection("SpawnTextEditorPanel"));
|
||||
PanelBuilder panelBuilder2 = new PanelBuilder(this.customBosses.getEditor().getConfigurationSection("DeathTextEditorPanel"));
|
||||
FileConfiguration editor = this.customBosses.getEditor();
|
||||
PanelBuilder panelBuilder = new PanelBuilder(editor.getConfigurationSection("TextEditorMainPanel"));
|
||||
PanelBuilder panelBuilder1 = new PanelBuilder(editor.getConfigurationSection("SpawnTextEditorPanel"));
|
||||
PanelBuilder panelBuilder2 = new PanelBuilder(editor.getConfigurationSection("DeathTextEditorPanel"));
|
||||
PanelBuilder panelBuilder3 = new PanelBuilder(editor.getConfigurationSection("TauntEditorPanel"));
|
||||
|
||||
this.mainTextEditMenu = new TextMainEditorPanel(this, panelBuilder);
|
||||
this.onSpawnSubTextEditMenu = new SpawnTextEditorPanel(this, panelBuilder1, this.customBosses);
|
||||
this.onDeathSubTextEditMenu = new DeathTextEditorPanel(this, panelBuilder2, this.customBosses);
|
||||
this.onSpawnTextEditMenu = new SpawnMessageListEditor(this, getListMenu("Boss.Text"), this.customBosses);
|
||||
this.onDeathTextEditMenu = new DeathMessageListEditor(this, getListMenu("Boss.Text"), this.customBosses) {
|
||||
this.mainTauntEditMenu = new TauntTextEditorPanel(this, panelBuilder3, this.customBosses);
|
||||
this.onSpawnTextEditMenu = new SingleMessageListEditor(this, getListMenu("Boss.Text"), this.customBosses) {
|
||||
@Override
|
||||
public String getCurrent(BossEntity bossEntity) {
|
||||
return bossEntity.getMessages().getOnSpawn().getMessage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMessage(BossEntity bossEntity, String newPath) {
|
||||
bossEntity.getMessages().getOnSpawn().setMessage(newPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariablePanelHandler<BossEntity> getParentHolder() {
|
||||
return getOnSpawnSubTextEditMenu();
|
||||
}
|
||||
};
|
||||
this.onDeathTextEditMenu = new SingleMessageListEditor(this, getListMenu("Boss.Text"), this.customBosses) {
|
||||
@Override
|
||||
public String getCurrent(BossEntity bossEntity) {
|
||||
return bossEntity.getMessages().getOnDeath().getMessage();
|
||||
@ -165,8 +184,13 @@ public class BossPanelManager implements ILoadable, IReloadable {
|
||||
public void updateMessage(BossEntity bossEntity, String newPath) {
|
||||
bossEntity.getMessages().getOnDeath().setMessage(newPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariablePanelHandler<BossEntity> getParentHolder() {
|
||||
return getOnDeathSubTextEditMenu();
|
||||
}
|
||||
};
|
||||
this.onDeathPositionTextEditMenu = new DeathMessageListEditor(this, getListMenu("Boss.Text"), this.customBosses) {
|
||||
this.onDeathPositionTextEditMenu = new SingleMessageListEditor(this, getListMenu("Boss.Text"), this.customBosses) {
|
||||
@Override
|
||||
public String getCurrent(BossEntity bossEntity) {
|
||||
return bossEntity.getMessages().getOnDeath().getPositionMessage();
|
||||
@ -176,19 +200,53 @@ public class BossPanelManager implements ILoadable, IReloadable {
|
||||
public void updateMessage(BossEntity bossEntity, String newPath) {
|
||||
bossEntity.getMessages().getOnDeath().setPositionMessage(newPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariablePanelHandler<BossEntity> getParentHolder() {
|
||||
return getOnDeathSubTextEditMenu();
|
||||
}
|
||||
};
|
||||
this.onTauntTextEditMenu = new ListMessageListEditor(this, getListMenu("Boss.Text"), this.customBosses) {
|
||||
@Override
|
||||
public List<String> getCurrent(BossEntity bossEntity) {
|
||||
return bossEntity.getMessages().getTaunts().getTaunts();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMessage(BossEntity bossEntity, String modifiedValue) {
|
||||
List<String> current = getCurrent(bossEntity);
|
||||
|
||||
if(current.contains(modifiedValue)) {
|
||||
current.remove(modifiedValue);
|
||||
} else {
|
||||
current.add(modifiedValue);
|
||||
}
|
||||
|
||||
bossEntity.getMessages().getTaunts().setTaunts(current);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariablePanelHandler<BossEntity> getParentHolder() {
|
||||
return getMainTauntEditMenu();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void reloadTextEditMenus() {
|
||||
PanelBuilder panelBuilder = new PanelBuilder(this.customBosses.getEditor().getConfigurationSection("TextEditorMainPanel"));
|
||||
PanelBuilder panelBuilder1 = new PanelBuilder(this.customBosses.getEditor().getConfigurationSection("SpawnTextEditorPanel"));
|
||||
PanelBuilder panelBuilder2 = new PanelBuilder(this.customBosses.getEditor().getConfigurationSection("DeathTextEditorPanel"));
|
||||
FileConfiguration editor = this.customBosses.getEditor();
|
||||
PanelBuilder panelBuilder = new PanelBuilder(editor.getConfigurationSection("TextEditorMainPanel"));
|
||||
PanelBuilder panelBuilder1 = new PanelBuilder(editor.getConfigurationSection("SpawnTextEditorPanel"));
|
||||
PanelBuilder panelBuilder2 = new PanelBuilder(editor.getConfigurationSection("DeathTextEditorPanel"));
|
||||
PanelBuilder panelBuilder3 = new PanelBuilder(editor.getConfigurationSection("TauntEditorPanel"));
|
||||
|
||||
this.mainTextEditMenu.initializePanel(panelBuilder);
|
||||
this.onSpawnSubTextEditMenu.initializePanel(panelBuilder1);
|
||||
this.onDeathSubTextEditMenu.initializePanel(panelBuilder2);
|
||||
this.mainTauntEditMenu.initializePanel(panelBuilder3);
|
||||
this.onSpawnTextEditMenu.initializePanel(getListMenu("Boss.Text"));
|
||||
this.onDeathTextEditMenu.initializePanel(getListMenu("Boss.Text"));
|
||||
this.onDeathPositionTextEditMenu.initializePanel(getListMenu("Boss.Text"));
|
||||
this.onTauntTextEditMenu.initializePanel(getListMenu("Boss.Text"));
|
||||
}
|
||||
|
||||
//---------------------------------------------
|
||||
@ -219,9 +277,6 @@ public class BossPanelManager implements ILoadable, IReloadable {
|
||||
//
|
||||
//---------------------------------------------
|
||||
|
||||
private static final String HELMET_EDITOR_PATH = "HelmetEditorPanel", CHESTPLATE_EDITOR_PATH = "ChestplateEditorPanel", LEGGINGS_EDITOR_PATH = "LeggingsEditorPanel",
|
||||
BOOTS_EDITOR_PATH = "BootsEditorPanel", MAIN_HAND_EDITOR_PATH = "MainHandEditorPanel", OFF_HAND_EDITOR_PATH = "OffHandEditorPanel";
|
||||
|
||||
private void loadEquipmentEditMenus() {
|
||||
FileConfiguration editor = this.customBosses.getEditor();
|
||||
|
||||
|
@ -0,0 +1,153 @@
|
||||
package com.songoda.epicbosses.panel.bosses.text;
|
||||
|
||||
import com.songoda.epicbosses.CustomBosses;
|
||||
import com.songoda.epicbosses.api.BossAPI;
|
||||
import com.songoda.epicbosses.entity.BossEntity;
|
||||
import com.songoda.epicbosses.entity.elements.TauntElement;
|
||||
import com.songoda.epicbosses.managers.BossPanelManager;
|
||||
import com.songoda.epicbosses.managers.files.BossesFileManager;
|
||||
import com.songoda.epicbosses.utils.Message;
|
||||
import com.songoda.epicbosses.utils.NumberUtils;
|
||||
import com.songoda.epicbosses.utils.StringUtils;
|
||||
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.builder.PanelBuilder;
|
||||
import com.songoda.epicbosses.utils.panel.builder.PanelBuilderCounter;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Charles Cullen
|
||||
* @version 1.0.0
|
||||
* @since 01-Dec-18
|
||||
*/
|
||||
public class TauntTextEditorPanel extends VariablePanelHandler<BossEntity> {
|
||||
|
||||
private BossesFileManager bossesFileManager;
|
||||
|
||||
public TauntTextEditorPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
|
||||
super(bossPanelManager, panelBuilder);
|
||||
|
||||
this.bossesFileManager = plugin.getBossesFileManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillPanel(Panel panel, BossEntity bossEntity) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openFor(Player player, BossEntity bossEntity) {
|
||||
Map<String, String> replaceMap = new HashMap<>();
|
||||
TauntElement tauntElement = bossEntity.getMessages().getTaunts();
|
||||
Integer radius = tauntElement.getRadius();
|
||||
Integer delay = tauntElement.getDelay();
|
||||
List<String> taunts = tauntElement.getTaunts();
|
||||
PanelBuilder panelBuilder = getPanelBuilder().cloneBuilder();
|
||||
|
||||
if(radius == null) radius = 100;
|
||||
if(delay == null) delay = 60;
|
||||
if(taunts == null || taunts.isEmpty()) taunts = Arrays.asList("N/A");
|
||||
|
||||
replaceMap.put("{name}", BossAPI.getBossEntityName(bossEntity));
|
||||
replaceMap.put("{radius}", NumberUtils.get().formatDouble(radius));
|
||||
replaceMap.put("{delay}", NumberUtils.get().formatDouble(delay));
|
||||
replaceMap.put("{taunts}", StringUtils.get().appendList(taunts));
|
||||
panelBuilder.addReplaceData(replaceMap);
|
||||
|
||||
Panel panel = panelBuilder.getPanel()
|
||||
.setDestroyWhenDone(true)
|
||||
.setCancelClick(true)
|
||||
.setCancelLowerClick(true)
|
||||
.setParentPanelHandler(this.bossPanelManager.getMainTextEditMenu(), bossEntity);
|
||||
PanelBuilderCounter counter = panel.getPanelBuilderCounter();
|
||||
|
||||
counter.getSlotsWith("Radius").forEach(slot -> panel.setOnClick(slot, getRadiusAction(bossEntity)));
|
||||
counter.getSlotsWith("Delay").forEach(slot -> panel.setOnClick(slot, getDelayAction(bossEntity)));
|
||||
counter.getSlotsWith("Taunts").forEach(slot -> panel.setOnClick(slot, event -> {}));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializePanel(PanelBuilder panelBuilder) {
|
||||
PanelBuilderCounter panelBuilderCounter = panelBuilder.getPanelBuilderCounter();
|
||||
|
||||
panelBuilderCounter
|
||||
.addSlotCounter("Radius")
|
||||
.addSlotCounter("Delay")
|
||||
.addSlotCounter("Taunts");
|
||||
}
|
||||
|
||||
private ClickAction getRadiusAction(BossEntity bossEntity) {
|
||||
return event -> {
|
||||
ClickType clickType = event.getClick();
|
||||
int radiusToModifyBy = 0;
|
||||
|
||||
if(clickType == ClickType.LEFT) {
|
||||
radiusToModifyBy = 1;
|
||||
} else if(clickType == ClickType.SHIFT_LEFT) {
|
||||
radiusToModifyBy = 10;
|
||||
} else if(clickType == ClickType.RIGHT) {
|
||||
radiusToModifyBy = -1;
|
||||
} else if(clickType == ClickType.SHIFT_RIGHT) {
|
||||
radiusToModifyBy = -10;
|
||||
}
|
||||
|
||||
String modifyValue = radiusToModifyBy > 0? "increased" : "decreased";
|
||||
Integer currentRadius = bossEntity.getMessages().getTaunts().getRadius();
|
||||
|
||||
if(currentRadius == null) currentRadius = 0;
|
||||
|
||||
int newRadius = currentRadius + radiusToModifyBy;
|
||||
|
||||
if(newRadius < -1) {
|
||||
newRadius = -1;
|
||||
}
|
||||
|
||||
bossEntity.getMessages().getTaunts().setRadius(newRadius);
|
||||
this.bossesFileManager.save();
|
||||
Message.Boss_Messages_SetTauntRadius.msg(event.getWhoClicked(), modifyValue, NumberUtils.get().formatDouble(newRadius));
|
||||
openFor((Player) event.getWhoClicked(), bossEntity);
|
||||
};
|
||||
}
|
||||
|
||||
private ClickAction getDelayAction(BossEntity bossEntity) {
|
||||
return event -> {
|
||||
ClickType clickType = event.getClick();
|
||||
int delayToModifyBy = 0;
|
||||
|
||||
if(clickType == ClickType.LEFT) {
|
||||
delayToModifyBy = 1;
|
||||
} else if(clickType == ClickType.SHIFT_LEFT) {
|
||||
delayToModifyBy = 10;
|
||||
} else if(clickType == ClickType.RIGHT) {
|
||||
delayToModifyBy = -1;
|
||||
} else if(clickType == ClickType.SHIFT_RIGHT) {
|
||||
delayToModifyBy = -10;
|
||||
}
|
||||
|
||||
String modifyValue = delayToModifyBy > 0? "increased" : "decreased";
|
||||
Integer currentDelay = bossEntity.getMessages().getTaunts().getDelay();
|
||||
|
||||
if(currentDelay == null) currentDelay = 0;
|
||||
|
||||
int newDelay = currentDelay + delayToModifyBy;
|
||||
|
||||
if(newDelay < -1) {
|
||||
newDelay = -1;
|
||||
}
|
||||
|
||||
bossEntity.getMessages().getTaunts().setDelay(newDelay);
|
||||
this.bossesFileManager.save();
|
||||
Message.Boss_Messages_SetTauntDelay.msg(event.getWhoClicked(), modifyValue, NumberUtils.get().formatDouble(newDelay));
|
||||
openFor((Player) event.getWhoClicked(), bossEntity);
|
||||
};
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.songoda.epicbosses.panel.bosses.text;
|
||||
package com.songoda.epicbosses.panel.handlers;
|
||||
|
||||
import com.songoda.epicbosses.CustomBosses;
|
||||
import com.songoda.epicbosses.api.BossAPI;
|
||||
@ -10,6 +10,7 @@ import com.songoda.epicbosses.utils.itemstack.ItemStackConverter;
|
||||
import com.songoda.epicbosses.utils.itemstack.ItemStackUtils;
|
||||
import com.songoda.epicbosses.utils.itemstack.holder.ItemStackHolder;
|
||||
import com.songoda.epicbosses.utils.panel.Panel;
|
||||
import com.songoda.epicbosses.utils.panel.base.IVariablePanelHandler;
|
||||
import com.songoda.epicbosses.utils.panel.base.handlers.VariablePanelHandler;
|
||||
import com.songoda.epicbosses.utils.panel.builder.PanelBuilder;
|
||||
import org.bukkit.Material;
|
||||
@ -27,13 +28,13 @@ import java.util.Map;
|
||||
* @version 1.0.0
|
||||
* @since 29-Nov-18
|
||||
*/
|
||||
public class SpawnMessageListEditor extends VariablePanelHandler<BossEntity> {
|
||||
public abstract class ListMessageListEditor extends VariablePanelHandler<BossEntity> {
|
||||
|
||||
private MessagesFileManager messagesFileManager;
|
||||
private ItemStackConverter itemStackConverter;
|
||||
private CustomBosses plugin;
|
||||
|
||||
public SpawnMessageListEditor(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
|
||||
public ListMessageListEditor(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
|
||||
super(bossPanelManager, panelBuilder);
|
||||
|
||||
this.plugin = plugin;
|
||||
@ -41,6 +42,12 @@ public class SpawnMessageListEditor extends VariablePanelHandler<BossEntity> {
|
||||
this.messagesFileManager = plugin.getBossMessagesFileManager();
|
||||
}
|
||||
|
||||
public abstract List<String> getCurrent(BossEntity bossEntity);
|
||||
|
||||
public abstract void updateMessage(BossEntity bossEntity, String modifiedValue);
|
||||
|
||||
public abstract IVariablePanelHandler<BossEntity> getParentHolder();
|
||||
|
||||
@Override
|
||||
public void fillPanel(Panel panel, BossEntity bossEntity) {
|
||||
Map<String, List<String>> currentTexts = this.messagesFileManager.getMessagesMap();
|
||||
@ -69,7 +76,7 @@ public class SpawnMessageListEditor extends VariablePanelHandler<BossEntity> {
|
||||
.setDestroyWhenDone(true)
|
||||
.setCancelClick(true)
|
||||
.setCancelLowerClick(true)
|
||||
.setParentPanelHandler(this.bossPanelManager.getOnSpawnSubTextEditMenu(), bossEntity);
|
||||
.setParentPanelHandler(getParentHolder(), bossEntity);
|
||||
|
||||
fillPanel(panel, bossEntity);
|
||||
|
||||
@ -82,7 +89,7 @@ public class SpawnMessageListEditor extends VariablePanelHandler<BossEntity> {
|
||||
}
|
||||
|
||||
private void loadPage(Panel panel, int page, Map<String, List<String>> currentMessages, List<String> entryList, BossEntity bossEntity) {
|
||||
String current = bossEntity.getMessages().getOnSpawn().getMessage();
|
||||
List<String> current = getCurrent(bossEntity);
|
||||
|
||||
panel.loadPage(page, (slot, realisticSlot) -> {
|
||||
if(slot >= entryList.size()) {
|
||||
@ -97,7 +104,7 @@ public class SpawnMessageListEditor extends VariablePanelHandler<BossEntity> {
|
||||
|
||||
replaceMap.put("{name}", name);
|
||||
|
||||
if(current.equalsIgnoreCase(name)) {
|
||||
if(current.contains(name)) {
|
||||
ItemStackUtils.applyDisplayName(itemStack, this.plugin.getConfig().getString("Display.Boss.Text.selectedName"), replaceMap);
|
||||
} else {
|
||||
ItemStackUtils.applyDisplayName(itemStack, this.plugin.getConfig().getString("Display.Boss.Text.name"), replaceMap);
|
||||
@ -121,7 +128,7 @@ public class SpawnMessageListEditor extends VariablePanelHandler<BossEntity> {
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
|
||||
panel.setItem(realisticSlot, itemStack, e -> {
|
||||
bossEntity.getMessages().getOnSpawn().setMessage(name);
|
||||
updateMessage(bossEntity, name);
|
||||
this.plugin.getBossesFileManager().save();
|
||||
loadPage(panel, page, currentMessages, entryList, bossEntity);
|
||||
});
|
@ -1,4 +1,4 @@
|
||||
package com.songoda.epicbosses.panel.bosses.text;
|
||||
package com.songoda.epicbosses.panel.handlers;
|
||||
|
||||
import com.songoda.epicbosses.CustomBosses;
|
||||
import com.songoda.epicbosses.api.BossAPI;
|
||||
@ -10,6 +10,7 @@ import com.songoda.epicbosses.utils.itemstack.ItemStackConverter;
|
||||
import com.songoda.epicbosses.utils.itemstack.ItemStackUtils;
|
||||
import com.songoda.epicbosses.utils.itemstack.holder.ItemStackHolder;
|
||||
import com.songoda.epicbosses.utils.panel.Panel;
|
||||
import com.songoda.epicbosses.utils.panel.base.IVariablePanelHandler;
|
||||
import com.songoda.epicbosses.utils.panel.base.handlers.VariablePanelHandler;
|
||||
import com.songoda.epicbosses.utils.panel.builder.PanelBuilder;
|
||||
import org.bukkit.Material;
|
||||
@ -27,13 +28,13 @@ import java.util.Map;
|
||||
* @version 1.0.0
|
||||
* @since 29-Nov-18
|
||||
*/
|
||||
public abstract class DeathMessageListEditor extends VariablePanelHandler<BossEntity> {
|
||||
public abstract class SingleMessageListEditor extends VariablePanelHandler<BossEntity> {
|
||||
|
||||
private MessagesFileManager messagesFileManager;
|
||||
private ItemStackConverter itemStackConverter;
|
||||
private CustomBosses plugin;
|
||||
|
||||
public DeathMessageListEditor(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
|
||||
public SingleMessageListEditor(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
|
||||
super(bossPanelManager, panelBuilder);
|
||||
|
||||
this.plugin = plugin;
|
||||
@ -45,6 +46,8 @@ public abstract class DeathMessageListEditor extends VariablePanelHandler<BossEn
|
||||
|
||||
public abstract void updateMessage(BossEntity bossEntity, String newPath);
|
||||
|
||||
public abstract IVariablePanelHandler<BossEntity> getParentHolder();
|
||||
|
||||
@Override
|
||||
public void fillPanel(Panel panel, BossEntity bossEntity) {
|
||||
Map<String, List<String>> currentTexts = this.messagesFileManager.getMessagesMap();
|
||||
@ -73,7 +76,7 @@ public abstract class DeathMessageListEditor extends VariablePanelHandler<BossEn
|
||||
.setDestroyWhenDone(true)
|
||||
.setCancelClick(true)
|
||||
.setCancelLowerClick(true)
|
||||
.setParentPanelHandler(this.bossPanelManager.getOnDeathSubTextEditMenu(), bossEntity);
|
||||
.setParentPanelHandler(getParentHolder(), bossEntity);
|
||||
|
||||
fillPanel(panel, bossEntity);
|
||||
|
@ -109,6 +109,8 @@ public enum Message {
|
||||
Boss_Messages_SetRadiusOnSpawn("&b&lEpicBosses &8» &7You have just {0} the radius for the onSpawn message to &f{1}&7."),
|
||||
Boss_Messages_SetRadiusOnDeath("&b&lEpicBosses &8» &7You have just {0} the radius for the onDeath message to &f{1}&7."),
|
||||
Boss_Messages_SetOnlyShowOnDeath("&b&lEpicBosses &8» &7You have just {0} the only show amount for the onDeath message to &f{1}&7."),
|
||||
Boss_Messages_SetTauntRadius("&b&lEpicBosses &8» &7You have just {0} the radius for the taunt message to &f{1}&7."),
|
||||
Boss_Messages_SetTauntDelay("&b&lEpicBosses &8» &7You have just {0} the delay for the taunt message to &f{1}&7."),
|
||||
|
||||
Boss_Nearby_NoPermission("&c&l(!) &cYou do not have access to this command."),
|
||||
Boss_Nearby_MaxRadius("&c&l(!) &cYou cannot check for bosses any further then &f{0}&c away from your position."),
|
||||
|
@ -1,16 +1,20 @@
|
||||
package com.songoda.epicbosses.utils.dependencies;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.bukkit.BukkitUtil;
|
||||
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||
import com.sk89q.worldguard.protection.flags.Flags;
|
||||
import com.sk89q.worldguard.protection.flags.StateFlag;
|
||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
import com.sk89q.worldguard.protection.regions.RegionQuery;
|
||||
import com.songoda.epicbosses.utils.IWorldGuardHelper;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@ -77,32 +81,37 @@ public class WorldGuardHelper implements IWorldGuardHelper {
|
||||
@Override
|
||||
public List<String> getRegionNames(Location loc) {
|
||||
if(Bukkit.getServer().getPluginManager().getPlugin("WorldGuard") != null) {
|
||||
if(worldGuard == null) {
|
||||
if (worldGuard == null) {
|
||||
this.worldGuard = WorldGuard.getInstance();
|
||||
}
|
||||
|
||||
// ApplicableRegionSet set = this.worldGuard.getRegionManager(loc.getWorld()).getApplicableRegions(loc);
|
||||
// LinkedList<String> parentNames = new LinkedList<String>();
|
||||
// LinkedList<String> regions = new LinkedList<String>();
|
||||
//
|
||||
// for(ProtectedRegion region : set) {
|
||||
// String id = region.getId();
|
||||
//
|
||||
// regions.add(id);
|
||||
//
|
||||
// ProtectedRegion parent = region.getParent();
|
||||
//
|
||||
// while(parent != null) {
|
||||
// parentNames.add(parent.getId());
|
||||
// parent = parent.getParent();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// for(String name : parentNames) {
|
||||
// regions.remove(name);
|
||||
// }
|
||||
//
|
||||
// return regions;
|
||||
List<String> regions = new ArrayList<>();
|
||||
List<String> parentNames = new ArrayList<>();
|
||||
World world = BukkitAdapter.adapt(loc.getWorld());
|
||||
RegionManager regionManager = this.worldGuard.getPlatform().getRegionContainer().get(world);
|
||||
|
||||
if (regionManager == null) return null;
|
||||
|
||||
ApplicableRegionSet set = regionManager.getApplicableRegions(BukkitAdapter.asVector(loc));
|
||||
|
||||
for (ProtectedRegion region : set) {
|
||||
String id = region.getId();
|
||||
|
||||
regions.add(id);
|
||||
|
||||
ProtectedRegion parent = region.getParent();
|
||||
|
||||
while (parent != null) {
|
||||
parentNames.add(parent.getId());
|
||||
parent = parent.getParent();
|
||||
}
|
||||
}
|
||||
|
||||
for (String name : parentNames) {
|
||||
regions.remove(name);
|
||||
}
|
||||
|
||||
return regions;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
4
pom.xml
4
pom.xml
@ -20,7 +20,7 @@
|
||||
|
||||
<properties>
|
||||
<!--<plugin.version>maven-version-number-SNAPSHOT-U90</plugin.version>-->
|
||||
<plugin.version>1.0.0-U93</plugin.version>
|
||||
<plugin.version>1.0.0-U94</plugin.version>
|
||||
<plugin.name>EpicBosses</plugin.name>
|
||||
<plugin.main>com.songoda.epicbosses.CustomBosses</plugin.main>
|
||||
<plugin.author>AMinecraftDev</plugin.author>
|
||||
@ -74,7 +74,7 @@
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>private</id>
|
||||
<url>http://repo.songoda.com/repository/private</url>
|
||||
<url>http://repo.songoda.com/repository/private/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>vault-repo</id>
|
||||
|
Loading…
Reference in New Issue
Block a user