Minor legacy flag fixes and fix extra quotes in chat

This commit is contained in:
ShinyDialga 2018-07-27 17:34:00 -05:00
parent 3492e9a5b7
commit 33c269dd4d
6 changed files with 13 additions and 8 deletions

View File

@ -118,14 +118,14 @@ public class BroadcastSender implements Commands {
if(type == null) {
type = ChatDoc.Destination.SERVER;
destination = server._id();
message = args.getRemainingString(0);
message = args.getJoinedStrings(0);
} else if(args.argsLength() >= 2) {
if(type == ChatDoc.Destination.GLOBAL) {
destination = null;
message = args.getRemainingString(1);
message = args.getJoinedStrings(1);
} else if(args.argsLength() >= 3) {
destination = args.getString(1);
message = args.getRemainingString(2);
message = args.getJoinedStrings(2);
if(!destinations.contains(destination)) {
throw newCommandException(sender, new WarningComponent("command.error.invalidOption", destination, destinations));
}

View File

@ -75,7 +75,7 @@ public class ChannelCommands implements Commands, Listener {
audiences.get(player).sendMessage(new TranslatableComponent("channels.default.set", typeName));
}
} else {
channel.chat(sender, args.getRemainingString(0));
channel.chat(sender, args.getJoinedStrings(0));
}
} else {
throw new CommandPermissionsException();

View File

@ -212,7 +212,7 @@ public class MiscCommands implements Commands {
if(!sender.equals(other) && !sender.hasPermission("sudo.others")) {
throw new CommandPermissionsException();
}
String command = args.getRemainingString(index);
String command = args.getJoinedStrings(index);
List<String> commands = getPermutations(sender, command);
String explanation;
if(commands.size() == 1) {

View File

@ -87,7 +87,7 @@ public class PunishmentCommands implements Commands {
public void create(CommandContext args, CommandSender sender, @Nullable Type type, @Nullable Duration duration) throws CommandException {
final User punisher = userFinder.getLocalUser(sender);
final String reason = args.getRemainingString(duration == null ? 1 : 2);
final String reason = args.getJoinedStrings(duration == null ? 1 : 2);
final boolean auto = flag('a', args, sender);
final boolean silent = flag('s', args, sender);
final boolean offrecord = flag('o', args, sender);

View File

@ -53,6 +53,8 @@ public class LegacyFlagPlayerFacet implements MatchPlayerFacet, Listener {
protected void trackFlag(Flag flag) {
if(lessThan(MINECRAFT_1_8, bukkit.getProtocolVersion())) {
beams.put(flag, beams.getOrDefault(flag, new Beam(flag)));
// flag.getLocation().ifPresent(location -> bukkit.sendBlockChange(location, Material.AIR, (byte) 0));
}
}

View File

@ -19,6 +19,7 @@ import tc.oc.commons.bukkit.inventory.ArmorType;
import tc.oc.commons.core.IterableUtils;
import tc.oc.commons.core.chat.Component;
import tc.oc.commons.core.chat.Components;
import tc.oc.minecraft.protocol.MinecraftVersion;
import tc.oc.pgm.events.PlayerLeavePartyEvent;
import tc.oc.pgm.filters.query.PlayerQueryWithLocation;
import tc.oc.pgm.flag.Flag;
@ -167,9 +168,11 @@ public class Carried extends Spawned implements Missing {
@Override
public void tickRunning() {
super.tickRunning();
BaseComponent message = this.getMessage();
this.carrier.sendHotbarMessage(message);
if (MinecraftVersion.atLeast(MinecraftVersion.MINECRAFT_1_8, this.carrier.getBukkit().getProtocolVersion())) {
this.carrier.sendHotbarMessage(message);
}
if(!Components.equals(message, this.lastMessage)) {
this.lastMessage = message;