Skip to content

Commit

Permalink
Version 1.1.0 - Added illegal areas and reworked teleport option
Browse files Browse the repository at this point in the history
  • Loading branch information
x86-39 authored Nov 2, 2021
2 parents 7bc6ebd + 969079e commit 2ae4d7d
Show file tree
Hide file tree
Showing 12 changed files with 554 additions and 129 deletions.
156 changes: 88 additions & 68 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

group 'me.diademiemi.lineation'
version '1.0.3'
version '1.1.0'

repositories {
/*
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/me/diademiemi/lineation/Lineation.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ public void onEnable() {
pm.addPermission(new Permission("lineation.line.option.teleport"));
pm.addPermission(new Permission("lineation.line.option.laps"));
pm.addPermission(new Permission("lineation.line.option.link"));
pm.addPermission(new Permission("lineation.line.option.illegalarea"));
pm.addPermission(new Permission("lineation.line.option.illegalarea.add"));
pm.addPermission(new Permission("lineation.line.option.illegalarea.remove"));
pm.addPermission(new Permission("lineation.line.option.illegalarea.gamemodes"));

getCommand("lineation").setExecutor(new CommandExec());
getCommand("lineation").setTabCompleter(new CommandTabComplete());
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/me/diademiemi/lineation/Message.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class Message {
public static String ERROR_NOT_START;
public static String ERROR_NOT_FINISH;
public static String ERROR_NO_CHECKPOINT;
public static String ERROR_NO_ILLEGAL_AREA;
public static String ERROR_LINE_EXISTS;
public static String SUCCESS_RELOAD;
public static String SUCCESS_LINE_STARTED;
Expand All @@ -37,9 +38,11 @@ public class Message {
public static String SUCCESS_SET_AREA;
public static String SUCCESS_SET_BORDER;
public static String SUCCESS_SET_CHECKPOINT;
public static String SUCCESS_SET_ILLEGAL_AREA;
public static String SUCCESS_LINE_REMOVED;
public static String SUCCESS_BORDER_REMOVED;
public static String SUCCESS_CHECKPOINT_REMOVED;
public static String SUCCESS_ILLEGAL_AREA_REMOVED;
public static String SUCCESS_OPTION_SET;
public static String SUCCESS_PLAYER_FORGOTTEN;
public static String LINE_INFO_START;
Expand Down Expand Up @@ -76,6 +79,7 @@ public static void reloadMessages() {
ERROR_NOT_START = PREFIX + format(messageConfig.getConfig().getString("ERROR_NOT_START"));
ERROR_NOT_FINISH = PREFIX + format(messageConfig.getConfig().getString("ERROR_NOT_FINISH"));
ERROR_NO_CHECKPOINT = PREFIX + format(messageConfig.getConfig().getString("ERROR_NO_CHECKPOINT"));
ERROR_NO_ILLEGAL_AREA = PREFIX + format(messageConfig.getConfig().getString("ERROR_NO_ILLEGAL_AREA"));
ERROR_LINE_EXISTS = PREFIX + format(messageConfig.getConfig().getString("ERROR_LINE_EXISTS"));
SUCCESS_RELOAD = PREFIX + format(messageConfig.getConfig().getString("SUCCESS_RELOAD"));
SUCCESS_LINE_STARTED = PREFIX + format(messageConfig.getConfig().getString("SUCCESS_LINE_STARTED"));
Expand All @@ -84,9 +88,11 @@ public static void reloadMessages() {
SUCCESS_SET_AREA = PREFIX + format(messageConfig.getConfig().getString("SUCCESS_SET_AREA"));
SUCCESS_SET_BORDER = PREFIX + format(messageConfig.getConfig().getString("SUCCESS_SET_BORDER"));
SUCCESS_SET_CHECKPOINT = PREFIX + format(messageConfig.getConfig().getString("SUCCESS_SET_CHECKPOINT"));
SUCCESS_SET_ILLEGAL_AREA = PREFIX + format(messageConfig.getConfig().getString("SUCCESS_SET_ILLEGAL_AREA"));
SUCCESS_LINE_REMOVED = PREFIX + format(messageConfig.getConfig().getString("SUCCESS_LINE_REMOVED"));
SUCCESS_BORDER_REMOVED = PREFIX + format(messageConfig.getConfig().getString("SUCCESS_BORDER_REMOVED"));
SUCCESS_CHECKPOINT_REMOVED = PREFIX + format(messageConfig.getConfig().getString("SUCCESS_CHECKPOINT_REMOVED"));
SUCCESS_ILLEGAL_AREA_REMOVED = PREFIX + format(messageConfig.getConfig().getString("SUCCESS_ILLEGAL_AREA_REMOVED"));
SUCCESS_OPTION_SET = PREFIX + format(messageConfig.getConfig().getString("SUCCESS_OPTION_SET"));
SUCCESS_PLAYER_FORGOTTEN = PREFIX + format(messageConfig.getConfig().getString("SUCCESS_PLAYER_FORGOTTEN"));
LINE_INFO_START = PREFIX + format(messageConfig.getConfig().getString("LINE_INFO_START"));
Expand Down
132 changes: 113 additions & 19 deletions src/main/java/me/diademiemi/lineation/command/CommandExec.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ public List<String> onTabComplete(CommandSender sender, Command command, String
if ("teleport".startsWith(args[3]) && player.hasPermission("lineation.line.option.teleport")) tabList.add("teleport");
if ("laps".startsWith(args[3]) && player.hasPermission("lineation.line.option.laps") && Line.getLines().get(args[1]).getType().equalsIgnoreCase("finish")) tabList.add("laps");
if ("link".startsWith(args[3]) && player.hasPermission("lineation.line.option.link")) tabList.add("link");
if ("illegalarea".startsWith(args[3]) && player.hasPermission("lineation.line.option.illegalarea") && Line.getLines().get(args[1]).getType().equalsIgnoreCase("start")) tabList.add("illegalarea");

} else if (args[2].equalsIgnoreCase("info")) {

Expand Down Expand Up @@ -280,14 +281,22 @@ public List<String> onTabComplete(CommandSender sender, Command command, String
if (args[3].equalsIgnoreCase("teleport") && player.hasPermission("lineation.line.option.teleport")) {

if (args[4].equalsIgnoreCase("")) {

tabList.add("setlocation");

tabList.add("here");
tabList.add("disable");
if (Line.getLines().get(args[1]).getType().equalsIgnoreCase("start")) {
tabList.add("onstart");
tabList.add("illegalarea");
} else if (Line.getLines().get(args[1]).getType().equalsIgnoreCase("finish")) {
tabList.add("onfinish");
}

}
}

if ("here".startsWith(args[4])) tabList.add("here");
if ("disable".startsWith(args[4])) tabList.add("disable");
if ("setlocation".startsWith(args[4])) tabList.add("setlocation");
if ("onstart".startsWith(args[4]) && Line.getLines().get(args[1]).getType().equalsIgnoreCase("start")) tabList.add("onstart");
if ("illegalarea".startsWith(args[4]) && Line.getLines().get(args[1]).getType().equalsIgnoreCase("start")) tabList.add("illegalarea");
if ("onfinish".startsWith(args[4]) && Line.getLines().get(args[1]).getType().equalsIgnoreCase("finish")) tabList.add("onfinish");

} else if (args[3].equalsIgnoreCase("removecommand")) {

Expand Down Expand Up @@ -340,14 +349,67 @@ public List<String> onTabComplete(CommandSender sender, Command command, String

}

}
}
}
}
} else if (args[3].equalsIgnoreCase("illegalarea") && player.hasPermission("lineation.line.option.illegalarea") && Line.getLines().get(args[1]).getType().equalsIgnoreCase("start")) {

if (args[4].equalsIgnoreCase("")) {
if (player.hasPermission("lineation.line.option.illegalarea.add")) tabList.add("add");
if (player.hasPermission("lineation.line.option.illegalarea.remove")) tabList.add("remove");
if (player.hasPermission("lineation.line.option.illegalarea.gamemodes")) tabList.add("gamemodes");
}

if ("add".startsWith(args[4]) && player.hasPermission("lineation.line.option.illegalarea.add")) tabList.add("add");
if ("remove".startsWith(args[4]) && player.hasPermission("lineation.line.option.illegalarea.remove")) tabList.add("remove");
if ("gamemodes".startsWith(args[4]) && player.hasPermission("lineation.line.option.illegalarea.add")) tabList.add("gamemodes");

}

}

}

} else if (args.length == 6) {

if (lines.contains(args[1])) {

if (args[2].equalsIgnoreCase("option")) {

if (args[3].equalsIgnoreCase("teleport") && player.hasPermission("lineation.line.option.teleport")) {

switch (args[4].toLowerCase()) {
case "illegalarea":
case "onstart":
case "onfinish":
tabList.add("true");
tabList.add("false");
break;
default:
break;

}

} else if (args[3].equalsIgnoreCase("illegalarea") && Line.getLines().get(args[1]).getType().equalsIgnoreCase("start")) {

if (args[4].equalsIgnoreCase("remove") && player.hasPermission("lineation.line.option.illegalarea.remove")) {

int i = 1;
int c = Line.getLines().get(args[1]).getIllegalAreas().size();

while (i <= c) {
tabList.add(String.valueOf(i));
i++;
}

}
}

}
}

}

return tabList;

}
}

return null;

Expand Down
Loading

0 comments on commit 2ae4d7d

Please sign in to comment.