Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Vrabbers authored Mar 26, 2020
2 parents 0d08487 + 4920db3 commit fe3f8fa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.bukkit.entity.Player;

import java.util.ArrayList;
import java.util.Objects;
import java.util.UUID;

public class TPRequestDeclineCommand implements CommandExecutor {
Expand Down Expand Up @@ -35,10 +36,16 @@ public boolean onCommand(CommandSender commandSender, Command command, String s,
ArrayList<String> reqs = plugin.TeleportRequests.get(player.getUniqueId().toString());
if (reqs.size() > 1) {
if (args.length == 0) {

player.sendMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + "PROBLEM! " + ChatColor.YELLOW + "You have multiple teleport requests:");
player.sendMessage(ChatColor.YELLOW + String.join(", ", reqs));
ArrayList<String> reqNames = new ArrayList<>();
for(String r : reqs){
reqNames.add(Objects.requireNonNull(plugin.getServer().getPlayer(UUID.fromString(r))).getName());
}
player.sendMessage(ChatColor.YELLOW + String.join(", ", reqNames));
player.sendMessage(ChatColor.YELLOW + "Therefore, you must specify someone to decline.");
return true;

} else if (args.length > 1) return false;
else {
Player teleportingPlayer = plugin.getServer().getPlayer(args[0]);
Expand Down Expand Up @@ -77,7 +84,10 @@ public boolean onCommand(CommandSender commandSender, Command command, String s,

}
} else {

player.sendMessage(errors[new Random().nextInt(errors.length)] + "You don't have any pending teleport requests!");
return true;

}
}
return false;
Expand Down

0 comments on commit fe3f8fa

Please sign in to comment.