1.0.0-SNAPSHOT-U68

+ Started working more on the DropEditor Panel
+ Started to work the creation of DropTables
+ Added more messages
+ Updated DropTable fields to be creatable from default values
This commit is contained in:
Charles 2018-11-19 20:15:47 +08:00
parent 97085b85e8
commit 2b352d0d3a
13 changed files with 149 additions and 17 deletions

View File

@ -82,6 +82,24 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>install</phase>
<configuration>
<target>
<copy file="target/${build.finalName}.jar" tofile="D:/Servers/1.13.2/plugins/${build.finalName}.jar"/>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -33,6 +33,12 @@ Hooks:
- 'blocked_region1'
- 'blocked_region2'
Display:
EditDrops:
lore:
- '&3Type: &7{type}'
- '&7'
- '&7Click here to select this drop'
- '&7table as the current one.'
AutoSpawns:
menuName: '&b&lEpicBosses &3&lAutoSpawns'
Bosses:

View File

@ -0,0 +1,73 @@
package com.songoda.epicbosses.commands.boss;
import com.songoda.epicbosses.CustomBosses;
import com.songoda.epicbosses.managers.BossDropTableManager;
import com.songoda.epicbosses.managers.files.DropTableFileManager;
import com.songoda.epicbosses.utils.Message;
import com.songoda.epicbosses.utils.Permission;
import com.songoda.epicbosses.utils.command.SubCommand;
import org.bukkit.command.CommandSender;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 19-Nov-18
*
* boss new droptable [name] [type]
* boss new skill [name]
*/
public class BossNewCmd extends SubCommand {
private DropTableFileManager dropTableFileManager;
private BossDropTableManager bossDropTableManager;
public BossNewCmd(CustomBosses plugin) {
super("new");
this.dropTableFileManager = plugin.getDropTableFileManager();
this.bossDropTableManager = plugin.getBossDropTableManager();
}
@Override
public void execute(CommandSender sender, String[] args) {
if(!Permission.admin.hasPermission(sender)) {
Message.Boss_New_NoPermission.msg(sender);
return;
}
if(args.length == 4 && args[1].equalsIgnoreCase("droptable")) {
String nameInput = args[2];
String typeInput = args[3];
boolean validType = false;
if(this.dropTableFileManager.getDropTable(nameInput) != null) {
Message.Boss_New_DropTableAlreadyExists.msg(sender);
return;
}
for(String s : this.bossDropTableManager.getValidDropTableTypes()) {
if(s.equalsIgnoreCase(typeInput)) {
validType = true;
break;
}
}
if(!validType) {
Message.Boss_New_InvalidType.msg(sender);
return;
}
return;
}
if(args.length == 3 && args[1].equalsIgnoreCase("skill")) {
return;
}
Message.Boss_New_InvalidArgs.msg(sender);
return;
}
}

View File

@ -15,4 +15,9 @@ public class DropTable {
@Expose @Getter @Setter private String dropType;
@Expose @Getter @Setter private JsonObject rewards;
public DropTable(String dropType, JsonObject rewards) {
this.dropType = dropType;
this.rewards = rewards;
}
}

View File

@ -3,7 +3,6 @@ package com.songoda.epicbosses.droptable.elements;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import com.songoda.epicbosses.droptable.elements.RewardsTableElement;
import java.util.Map;
@ -12,10 +11,16 @@ import java.util.Map;
* @version 1.0.0
* @since 25-Oct-18
*/
public class DropTableElement extends RewardsTableElement {
public class DropTableElement {
@Expose @Getter @Setter private Map<String, Double> dropRewards;
@Expose @Getter @Setter private Boolean randomDrops;
@Expose @Getter @Setter private Integer dropMaxDrops;
public DropTableElement(Map<String, Double> dropRewards, Boolean randomDrops, Integer dropMaxDrops) {
this.dropRewards = dropRewards;
this.randomDrops = randomDrops;
this.dropMaxDrops = dropMaxDrops;
}
}

View File

@ -3,8 +3,6 @@ package com.songoda.epicbosses.droptable.elements;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import com.songoda.epicbosses.droptable.elements.GiveTableSubElement;
import com.songoda.epicbosses.droptable.elements.RewardsTableElement;
import java.util.Map;
@ -13,8 +11,12 @@ import java.util.Map;
* @version 1.0.0
* @since 25-Oct-18
*/
public class GiveTableElement extends RewardsTableElement {
public class GiveTableElement {
@Expose @Getter @Setter private Map<String, Map<String, GiveTableSubElement>> giveRewards;
public GiveTableElement(Map<String, Map<String, GiveTableSubElement>> giveRewards) {
this.giveRewards = giveRewards;
}
}

View File

@ -18,4 +18,14 @@ public class GiveTableSubElement {
@Expose @Getter @Setter private Boolean randomDrops, randomCommands;
@Expose @Getter @Setter private Double requiredPercentage;
public GiveTableSubElement(Map<String, Double> items, Map<String, Double> commands, Integer maxDrops, Integer maxCommands, Boolean randomDrops, Boolean randomCommands, Double requiredPercentage) {
this.items = items;
this.commands = commands;
this.maxDrops = maxDrops;
this.maxCommands = maxCommands;
this.randomDrops = randomDrops;
this.randomCommands = randomCommands;
this.requiredPercentage = requiredPercentage;
}
}

View File

@ -1,9 +0,0 @@
package com.songoda.epicbosses.droptable.elements;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 25-Oct-18
*/
public class RewardsTableElement {
}

View File

@ -11,10 +11,17 @@ import java.util.Map;
* @version 1.0.0
* @since 25-Oct-18
*/
public class SprayTableElement extends RewardsTableElement {
public class SprayTableElement {
@Expose @Getter @Setter private Map<String, Double> sprayRewards;
@Expose @Getter @Setter private Boolean randomSprayDrops;
@Expose @Getter @Setter private Integer sprayMaxDistance, sprayMaxDrops;
public SprayTableElement(Map<String, Double> sprayRewards, Boolean randomSprayDrops, Integer sprayMaxDistance, Integer sprayMaxDrops) {
this.sprayRewards = sprayRewards;
this.randomSprayDrops = randomSprayDrops;
this.sprayMaxDistance = sprayMaxDistance;
this.sprayMaxDrops = sprayMaxDrops;
}
}

View File

@ -16,6 +16,7 @@ import com.songoda.epicbosses.utils.NumberUtils;
import com.songoda.epicbosses.utils.RandomUtils;
import com.songoda.epicbosses.utils.ServerUtils;
import com.songoda.epicbosses.utils.itemstack.holder.ItemStackHolder;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
@ -30,6 +31,8 @@ import java.util.*;
*/
public class BossDropTableManager {
@Getter private final List<String> validDropTableTypes = Arrays.asList("SPRAY", "DROP", "GIVE");
private final IGetDropTableListItem<ItemStack> getDropTableItemStack;
private final IGetDropTableListItem<List<String>> getDropTableCommand;

View File

@ -35,12 +35,14 @@ public class DropsEditorPanel extends VariablePanelHandler<BossEntity> {
private DropTableFileManager dropTableFileManager;
private ItemStackConverter itemStackConverter;
private BossesFileManager bossesFileManager;
private CustomBosses plugin;
public DropsEditorPanel(BossPanelManager bossPanelManager, PanelBuilder panelBuilder, CustomBosses plugin) {
super(bossPanelManager, panelBuilder);
this.dropTableFileManager = plugin.getDropTableFileManager();
this.bossesFileManager = plugin.getBossesFileManager();
this.itemStackConverter = new ItemStackConverter();
this.plugin = plugin;
}
@ -88,6 +90,8 @@ public class DropsEditorPanel extends VariablePanelHandler<BossEntity> {
PanelBuilderCounter counter = panel.getPanelBuilderCounter();
fillPanel(panel, bossEntity);
counter.getSlotsWith("Selected").forEach(slot -> panel.setOnClick(slot, event -> {/* TODO: GO TO EDIT PANEL FOR DROP TABLE */}));
counter.getSlotsWith("CreateDropTable").forEach(slot -> panel.setOnClick(slot, event -> {/* TODO: CREATE NEW DROP TABLE COMMAND */}));
panel.openFor(player);
}
@ -121,10 +125,13 @@ public class DropsEditorPanel extends VariablePanelHandler<BossEntity> {
replaceMap.put("{type}", StringUtils.get().formatString(dropTable.getDropType()));
ItemStackUtils.applyDisplayName(itemStack, this.plugin.getConfig().getString("Display.DropTable.name"), replaceMap);
ItemStackUtils.applyDisplayLore(itemStack, this.plugin.getConfig().getStringList("Display.DropTable.lore"), replaceMap);
ItemStackUtils.applyDisplayLore(itemStack, this.plugin.getConfig().getStringList("Display.EditDrops.lore"), replaceMap);
panel.setItem(realisticSlot, itemStack, e -> {
bossEntity.getDrops().setDropTable(name);
this.bossesFileManager.save();
openFor((Player) e.getWhoClicked(), bossEntity);
});
}
});

View File

@ -110,6 +110,11 @@ public enum Message {
Boss_Nearby_NoneNearby("&b&lEpicBosses &8» &7There is currently no nearby bosses."),
Boss_Nearby_Near("&b&lEpicBosses &8» &7Nearby bosses: &f{0}."),
Boss_New_NoPermission("&c&l(!) &cYou do not have access to this command."),
Boss_New_InvalidArgs("&c&l(!) &cInvalid arguments! You must use &n/boss new droptable [name] (type)&c or &n/boss new skill [name]&c!"),
Boss_New_DropTableAlreadyExists("&c&l(!) &cThe specified DropTable name already exists. Please try another name."),
Boss_New_InvalidType("&c&l(!) &cThe specified DropTable type is invalid. Please use &fGive, Drop, Spray&c."),
Boss_Reload_NoPermission("&c&l(!) &cYou do not have access to this command."),
Boss_Reload_Successful("&b&lEpicBosses &8» &7All boss data has been reloaded. The process took &f{0}ms&7."),

View File

@ -19,7 +19,7 @@
</modules>
<properties>
<plugin.version>maven-version-number-SNAPSHOT-U67</plugin.version>
<plugin.version>maven-version-number-SNAPSHOT-U68</plugin.version>
<plugin.name>EpicBosses</plugin.name>
<plugin.main>com.songoda.epicbosses.CustomBosses</plugin.main>
<plugin.author>AMinecraftDev</plugin.author>