default tab completion + plot chat for merged plots

This commit is contained in:
Jesse Boyd 2016-03-28 22:52:22 +11:00
parent b6bdb02fa2
commit dcd1a50a0c
4 changed files with 30 additions and 5 deletions

View File

@ -542,7 +542,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
if (area == null || (!area.PLOT_CHAT && !plr.getAttribute("chat"))) {
return;
}
Plot plot = area.getPlotAbs(loc);
Plot plot = area.getPlot(loc);
if (plot == null) {
return;
}
@ -559,8 +559,11 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
String spy = event.getFormat();
spy = String.format(spy, sender, message);
pp.sendMessage(spy);
} else if (plot.equals(pp.getCurrentPlot())) {
recipients.add(((BukkitPlayer) pp).player);
} else {
Plot current = pp.getCurrentPlot();
if (current != null && current.getBasePlot(false).equals(plot)) {
recipients.add(((BukkitPlayer) pp).player);
}
}
}
String full = format.replaceAll("%plot_id%", id.x + ";" + id.y).replaceAll("%sender%", sender).replaceAll("%msg%", message);

View File

@ -71,6 +71,6 @@ public class BukkitCommand implements CommandExecutor, TabCompleter {
for (Object o : objects) {
result.add(o.toString());
}
return result;
return result.size() == 0 ? null : result;
}
}

View File

@ -394,6 +394,28 @@ public abstract class Command {
return cmd;
}
public Command getCommand(Class clazz) {
for (Command cmd : allCommands) {
if (cmd.getClass() == clazz) {
return cmd;
}
}
return null;
}
public Command getCommandById(String id) {
Command exact = staticCommands.get(id);
if (exact != null) {
return exact;
}
for (Command cmd : allCommands) {
if (cmd.getId().equals(id)) {
return cmd;
}
}
return null;
}
public boolean canExecute(PlotPlayer player, boolean message) {
if (!required.allows(player)) {
if (message) {

View File

@ -55,7 +55,7 @@ public class SpongeCommand implements CommandCallable {
for (Object o : objects) {
result.add(o.toString());
}
return result;
return result.size() == 0 ? null : result;
}
@Override