1.0.0-SNAPSHOT-U119

+ Added the boss new command command
This commit is contained in:
Charles 2018-12-10 22:59:41 +08:00
parent a353f07c27
commit ebbfad3339
4 changed files with 56 additions and 6 deletions

1
TODO
View File

@ -1,5 +1,4 @@
-> Add the Custom Skill Editing GUIs
-> Add the new Command aspect (via command)
-> Add the new Message aspect (via command)
-> Add the new Skill aspect (via command)
-> Add the DropTable Main Editing GUI (Will have buttons for DropType and Rewards)

View File

@ -4,12 +4,17 @@ import com.songoda.epicbosses.CustomBosses;
import com.songoda.epicbosses.api.BossAPI;
import com.songoda.epicbosses.droptable.DropTable;
import com.songoda.epicbosses.managers.BossDropTableManager;
import com.songoda.epicbosses.managers.files.CommandsFileManager;
import com.songoda.epicbosses.managers.files.DropTableFileManager;
import com.songoda.epicbosses.managers.files.MessagesFileManager;
import com.songoda.epicbosses.utils.Message;
import com.songoda.epicbosses.utils.Permission;
import com.songoda.epicbosses.utils.command.SubCommand;
import org.bukkit.command.CommandSender;
import java.util.ArrayList;
import java.util.List;
/**
* @author Charles Cullen
* @version 1.0.0
@ -24,12 +29,16 @@ public class BossNewCmd extends SubCommand {
private DropTableFileManager dropTableFileManager;
private BossDropTableManager bossDropTableManager;
private MessagesFileManager messagesFileManager;
private CommandsFileManager commandsFileManager;
public BossNewCmd(CustomBosses plugin) {
super("new");
this.dropTableFileManager = plugin.getDropTableFileManager();
this.bossDropTableManager = plugin.getBossDropTableManager();
this.messagesFileManager = plugin.getBossMessagesFileManager();
this.commandsFileManager = plugin.getBossCommandFileManager();
}
@Override
@ -40,12 +49,53 @@ public class BossNewCmd extends SubCommand {
}
if(args.length >= 4 && args[1].equalsIgnoreCase("command")) {
String nameInput = args[2];
if(this.commandsFileManager.getCommands(nameInput) != null) {
Message.Boss_New_AlreadyExists.msg(sender, "Command");
return;
}
int length = args.length;
List<String> commands = new ArrayList<>();
StringBuilder current = new StringBuilder();
for(int i = 4; i < length; i++) {
String arg = args[i];
if(arg.contains("||")) {
String[] split = arg.split("||");
current.append(split[0]);
commands.add(current.toString());
if(split.length >= 2) {
current = new StringBuilder(split[1]);
} else {
current = new StringBuilder();
}
continue;
}
current.append(arg);
}
commands.add(current.toString());
this.commandsFileManager.addNewCommand(nameInput, commands);
this.commandsFileManager.save();
Message.Boss_New_Command.msg(sender, nameInput);
return;
}
if(args.length >= 4 && args[1].equalsIgnoreCase("message")) {
String nameInput = args[2];
if(this.commandsFileManager.getCommands(nameInput) != null) {
Message.Boss_New_AlreadyExists.msg(sender, "Message");
return;
}
}
if(args.length == 4 && args[1].equalsIgnoreCase("droptable")) {
@ -54,7 +104,7 @@ public class BossNewCmd extends SubCommand {
boolean validType = false;
if(this.dropTableFileManager.getDropTable(nameInput) != null) {
Message.Boss_New_DropTableAlreadyExists.msg(sender);
Message.Boss_New_AlreadyExists.msg(sender, "DropTable");
return;
}

View File

@ -81,8 +81,8 @@ public enum Message {
"&b/boss giveegg [name] [player] (amount) &8» &7Used to be given a " +
"spawn item of the boss.\n" +
"&b/boss list &8» &7Shows all the list of current boss entities.\n" +
"&b/boss new skill [name] [type] [mode] &8» &7Used to create a new skill section.\n" +
"&b/boss new droptable [name] [type] &8» &7Used to create a new drop table.\n" +
"&b/boss new skill [name] [type] [mode] &8» &7Create a new skill section.\n" +
"&b/boss new droptable [name] [type] &8» &7Create a new drop table section.\n" +
"&7\n" +
"&7Use /boss help 4 to view the next page.\n" +
"&8&m----*-----------------------------------*----"),
@ -140,9 +140,10 @@ public enum Message {
Boss_New_CreateArgumentsDropTable("&b&lEpicBosses &8» &7Create a new droptable with the command &f/boss new droptable [name] [type]&7."),
Boss_New_CreateArgumentsMessage("&b&lEpicBosses &8» &7Create a new message with the command &f/boss new message [name] [message(s)]. \n&7&oUse &f|| &7&oto reference a new line."),
Boss_New_CreateArgumentsCommand("&b&lEpicBosses &8» &7Create a new command with the command &f/boss new command [name] [command(s)]. \n&7&oUse &f|| &7&oto reference a new line."),
Boss_New_DropTableAlreadyExists("&c&l(!) &cThe specified DropTable name already exists. Please try another name."),
Boss_New_AlreadyExists("&c&l(!) &cThe specified {0} name already exists. Please try another name."),
Boss_New_InvalidDropTableType("&c&l(!) &cThe specified DropTable type is invalid. Please use &fGive, Drop, Spray&c."),
Boss_New_DropTable("&b&lEpicBosses &8» &7You have created a new drop table with the name &f{0}&7 and type &f{1}&7."),
Boss_New_Command("&b&lEpicBosses &8» &7You have created a new command with the name &f{0}&7."),
Boss_New_SomethingWentWrong("&c&l(!) &cSomething went wrong while trying to create a new &f{0}&c."),
Boss_Reload_NoPermission("&c&l(!) &cYou do not have access to this command."),

View File

@ -20,7 +20,7 @@
<properties>
<!--<plugin.version>maven-version-number-SNAPSHOT-U90</plugin.version>-->
<plugin.version>1.0.0-U118</plugin.version>
<plugin.version>1.0.0-U119</plugin.version>
<plugin.name>EpicBosses</plugin.name>
<plugin.main>com.songoda.epicbosses.CustomBosses</plugin.main>
<plugin.author>AMinecraftDev</plugin.author>