diff --git a/src/main/java/com/hbm/commands/CommandSatellites.java b/src/main/java/com/hbm/commands/CommandSatellites.java index 6f1a803cd..20ba47c0e 100644 --- a/src/main/java/com/hbm/commands/CommandSatellites.java +++ b/src/main/java/com/hbm/commands/CommandSatellites.java @@ -8,6 +8,7 @@ import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatStyle; import net.minecraft.util.EnumChatFormatting; @@ -25,8 +26,10 @@ public class CommandSatellites extends CommandBase { @Override public String getCommandUsage(ICommandSender iCommandSender) { return String.format(Locale.US, - "%s/%s orbit %s- Launch the held satellite\n" + - "%s/%s descend %s- Deletes satellite by frequency.", + "%s/%s orbit %s- Launch the held satellite.\n" + + "%s/%s descend %s- Deletes satellite by frequency.\n"+ + "%s/%s list %s- Lists all active satellites.", + EnumChatFormatting.GREEN, getCommandName(), EnumChatFormatting.LIGHT_PURPLE, EnumChatFormatting.GREEN, getCommandName(), EnumChatFormatting.LIGHT_PURPLE, EnumChatFormatting.GREEN, getCommandName(), EnumChatFormatting.LIGHT_PURPLE ); @@ -65,6 +68,22 @@ public class CommandSatellites extends CommandBase { sender.addChatMessage(new ChatComponentTranslation( "commands.satellite.no_satellite").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED))); } break; + case "list": + data = SatelliteSavedData.getData(sender.getEntityWorld()); + if (data.sats.isEmpty()) { + ChatComponentTranslation message = new ChatComponentTranslation("commands.satellite.no_active_satellites"); + message.getChatStyle().setColor(EnumChatFormatting.RED); + sender.addChatMessage(message); + } else { + data.sats.forEach((listFreq, sat) -> { + String messageText = String.valueOf(listFreq) + " - " + sat.getClass().getSimpleName(); + ChatComponentText message = new ChatComponentText(messageText); + message.getChatStyle().setColor(EnumChatFormatting.GREEN); + sender.addChatMessage(message); + }); + } + break; + } } @@ -78,7 +97,7 @@ public class CommandSatellites extends CommandBase { return Collections.emptyList(); } if(args.length == 1) { - return getListOfStringsMatchingLastWord(args, "orbit", "descend"); + return getListOfStringsMatchingLastWord(args, "orbit", "descend","list"); } if (args[0].equals("descend")) { return getListOfStringsFromIterableMatchingLastWord(args, SatelliteSavedData.getData(sender.getEntityWorld()).sats.keySet().stream().map(String::valueOf).collect(Collectors.toList())); diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index 2e7c34e4a..20995b335 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -675,6 +675,7 @@ chem.XENON=Linde Xenon Cycle chem.XENON_OXY=Boosted Linde Xenon Cycle chem.YELLOWCAKE=Yellowcake Production +commands.satellite.no_active_satellites=No active satellites found! commands.satellite.no_satellite=No satellite using this frequency found! commands.satellite.not_a_satellite=The held item is not a satellite! commands.satellite.satellite_descended=Satellite successfully descended.