Skip to content

Commit

Permalink
tap complete games for setting locations
Browse files Browse the repository at this point in the history
fix armor stands not getting removed properly
  • Loading branch information
FireInstall committed Mar 22, 2023
1 parent 6a66d38 commit 0502b5b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/main/java/de/greensurvivors/findme/comands/SetCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,22 @@ public static List<String> handleTap(CommandSender cs, String[] args) {
return result.stream().filter(s -> s.toLowerCase().startsWith(args[1])).collect(Collectors.toList());
}
case 3 -> {
//heads
if (args[1].equalsIgnoreCase(HEADS)) {
if (PermissionUtils.hasPermission(cs, PermissionUtils.FINDME_ADMIN, PermissionUtils.FINDME_SET, PermissionUtils.FINDME_SET_HEADS)){
return GameManager.inst().getGameNames().stream().filter(s -> s.toLowerCase().startsWith(args[2])).collect(Collectors.toList());
}
//late join
} else if ((args[1].equalsIgnoreCase(LATE_JOIN_LONG) || args[1].equalsIgnoreCase(LATE_JOIN_SHORT)) &&
PermissionUtils.hasPermission(cs, PermissionUtils.FINDME_ADMIN, PermissionUtils.FINDME_SET, PermissionUtils.FINDME_SET_LATEJOIN)){
return Stream.of(String.valueOf(true), String.valueOf(false)).filter(s -> s.toLowerCase().startsWith(args[2])).collect(Collectors.toList());
//locations
} else if (args[1].equalsIgnoreCase(LOBBY) ||
args[1].equalsIgnoreCase(STARTPOINT_LONG) ||
args[1].equalsIgnoreCase(STARTPOINT_SHORT) || args[1].equalsIgnoreCase(ENDPOINT_LONG) || args[1].equalsIgnoreCase(ENDPOINT_SHORT) || args[1].equalsIgnoreCase(ENDPOINT_ALT)){
if (PermissionUtils.hasPermission(cs, PermissionUtils.FINDME_ADMIN, PermissionUtils.FINDME_SET_LOCATIONS)){
return GameManager.inst().getGameNames().stream().filter(s -> s.toLowerCase().startsWith(args[2])).collect(Collectors.toList());
}
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/de/greensurvivors/findme/dataObjects/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -502,12 +502,12 @@ public void removeHideaway(@NotNull UUID uuid){
if (hideaway != null){
Slime slime = hideaway.getSlime();
if (slime != null){
slime.setHealth(0);
slime.remove();;
}

ArmorStand armorStand = hideaway.getArmorStand();
if (armorStand != null){
armorStand.setHealth(0);
armorStand.remove();;
}
}

Expand All @@ -527,7 +527,7 @@ protected void removeAllHideaways() {

ArmorStand armorStand = hideaway.getArmorStand();
if (armorStand != null) {
armorStand.setHealth(0);
armorStand.remove();
}
}
}
Expand Down

0 comments on commit 0502b5b

Please sign in to comment.