show the property values for mvm list command.

This commit is contained in:
benwoo1110 2020-12-26 20:58:43 +08:00
parent 7198a5a421
commit ff5498313b

View File

@ -16,14 +16,21 @@ import co.aikar.commands.annotation.Description;
import co.aikar.commands.annotation.Flags;
import co.aikar.commands.annotation.Subcommand;
import co.aikar.commands.annotation.Syntax;
import com.dumptruckman.minecraft.util.Logging;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
import com.onarandombox.MultiverseCore.enums.EnglishChatColor;
import com.onarandombox.MultiverseCore.exceptions.PropertyDoesNotExistException;
import net.milkbowl.vault.chat.Chat;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
public class ModifyCommand extends MultiverseCommand {
public ModifyCommand(MultiverseCore plugin) {
@ -243,9 +250,26 @@ public class ModifyCommand extends MultiverseCommand {
private void doModifyList(@NotNull CommandSender sender,
@NotNull MultiverseWorld world) {
//TODO ACF: Should we show the properties as well?
sender.sendMessage("===[ Properties Values ]===");
sender.sendMessage(world.getAllPropertyNames());
Collection<String> properties = world.getAllPropertyTypes();
List<String> propValues = new ArrayList<>(properties.size());
for (String property : properties) {
String value = ChatColor.RED + "!!INAVLID!!";
try {
value = world.getPropertyValue(property);
}
catch (PropertyDoesNotExistException ignored) {
}
propValues.add(ChatColor.GREEN + property
+ ChatColor.WHITE + " = "
+ ChatColor.GOLD + value
+ ChatColor.WHITE);
}
sender.sendMessage("===[ Property Values for " + world.getColoredWorldString() + " ]===");
sender.sendMessage(String.join(", ", propValues));
}
private void saveWorldConfig(@NotNull CommandSender sender) {