Skip to content

Commit

Permalink
Bug fixes to rows and descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonTG committed Apr 28, 2017
1 parent e209a25 commit 0861709
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 22 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

**Description:**

Throughout the game, you and your teammates can access an inventory that is shared among your team using /ti. There is no physical inventory, so any teammate can access it from anywhere. The items in the inventory is dropped when the last player on that team dies.
Using /ti, people can open a inventory shared between their team.

___

Expand Down
25 changes: 6 additions & 19 deletions src/main/java/com/leontg77/teaminv/commands/TeamInvCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
import org.bukkit.event.HandlerList;
import org.bukkit.scoreboard.Scoreboard;
import org.bukkit.scoreboard.Team;
import org.bukkit.util.StringUtil;

import java.util.List;
import java.util.stream.Collectors;

/**
* TeamInv command class.
Expand Down Expand Up @@ -72,12 +72,7 @@ public TeamInvCommand(Main plugin, Settings settings, DeathListener listener) {
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (args.length == 0) {
if (sender instanceof Player) {
if (!enabled) {
sender.sendMessage(Main.PREFIX + "Usage: /teaminv <info|enable|disable>");
return true;
}

if (sender instanceof Player && enabled) {
Player player = (Player) sender;
Team team = board.getPlayerTeam(player);

Expand All @@ -87,7 +82,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
}

if (!plugin.getTeamInvs().containsKey(team)) {
plugin.getTeamInvs().put(team, Bukkit.createInventory(player, settings.getConfig().getInt("rows", 4), "§4Team Inventory - " + team.getName()));
plugin.getTeamInvs().put(team, Bukkit.createInventory(player, settings.getConfig().getInt("rows", 4) * 9, "§4Team Inventory - " + team.getName()));
}

player.openInventory(plugin.getTeamInvs().get(team));
Expand All @@ -98,7 +93,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
}

if (args[0].equalsIgnoreCase("info")) {
sender.sendMessage(Main.PREFIX + "Plugin creator: §aLeonTG77");
sender.sendMessage(Main.PREFIX + "Plugin creator: §aLeonTG");
sender.sendMessage(Main.PREFIX + "Version: §a" + plugin.getDescription().getVersion());
sender.sendMessage(Main.PREFIX + "Description:");
sender.sendMessage("§8» §f" + plugin.getDescription().getDescription());
Expand Down Expand Up @@ -148,11 +143,10 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String

@Override
public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) {
List<String> toReturn = Lists.newArrayList();
List<String> list = Lists.newArrayList();

if (args.length != 1) {
return toReturn;
return Lists.newArrayList();
}

list.add("info");
Expand All @@ -162,13 +156,6 @@ public List<String> onTabComplete(CommandSender sender, Command cmd, String labe
list.add("disable");
}

// make sure to only tab complete what starts with what they
// typed or everything if they didn't type anything
toReturn.addAll(list
.stream()
.filter(str -> args[args.length - 1].isEmpty() || str.startsWith(args[args.length - 1].toLowerCase()))
.collect(Collectors.toList()));

return toReturn;
return StringUtil.copyPartialMatches(args[args.length - 1], list, Lists.newArrayList());
}
}
4 changes: 2 additions & 2 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: ${project.name}
main: ${project.groupId}.${project.artifactId}.Main
version: ${project.version}
author: LeonTG77
description: Teams can open a inventory shared between the team using a command.
author: LeonTG
description: Using /ti, people can open a inventory shared between their team.

commands:
teaminv:
Expand Down

0 comments on commit 0861709

Please sign in to comment.