mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
default tab completion + plot chat for merged plots
This commit is contained in:
parent
b6bdb02fa2
commit
dcd1a50a0c
@ -542,7 +542,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
if (area == null || (!area.PLOT_CHAT && !plr.getAttribute("chat"))) {
|
if (area == null || (!area.PLOT_CHAT && !plr.getAttribute("chat"))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Plot plot = area.getPlotAbs(loc);
|
Plot plot = area.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -559,8 +559,11 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
String spy = event.getFormat();
|
String spy = event.getFormat();
|
||||||
spy = String.format(spy, sender, message);
|
spy = String.format(spy, sender, message);
|
||||||
pp.sendMessage(spy);
|
pp.sendMessage(spy);
|
||||||
} else if (plot.equals(pp.getCurrentPlot())) {
|
} else {
|
||||||
recipients.add(((BukkitPlayer) pp).player);
|
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);
|
String full = format.replaceAll("%plot_id%", id.x + ";" + id.y).replaceAll("%sender%", sender).replaceAll("%msg%", message);
|
||||||
|
@ -71,6 +71,6 @@ public class BukkitCommand implements CommandExecutor, TabCompleter {
|
|||||||
for (Object o : objects) {
|
for (Object o : objects) {
|
||||||
result.add(o.toString());
|
result.add(o.toString());
|
||||||
}
|
}
|
||||||
return result;
|
return result.size() == 0 ? null : result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -394,6 +394,28 @@ public abstract class Command {
|
|||||||
return cmd;
|
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) {
|
public boolean canExecute(PlotPlayer player, boolean message) {
|
||||||
if (!required.allows(player)) {
|
if (!required.allows(player)) {
|
||||||
if (message) {
|
if (message) {
|
||||||
|
@ -55,7 +55,7 @@ public class SpongeCommand implements CommandCallable {
|
|||||||
for (Object o : objects) {
|
for (Object o : objects) {
|
||||||
result.add(o.toString());
|
result.add(o.toString());
|
||||||
}
|
}
|
||||||
return result;
|
return result.size() == 0 ? null : result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user