@Override public void processCommand(final ICommandSender sender, final String[] parms) { try { final EntityPlayerMP player = getCommandSenderAsPlayer(sender); final World world = player.worldObj; final DimensionEffectData data = DimensionEffectData.get(world); if (parms.length == 1) { if ("status".compareToIgnoreCase(parms[0]) == 0) { // Dump out some diagnostics for the currentAurora dimension player.addChatMessage(new ChatComponentText(statusOutput(world, data))); } else if ("reset".compareToIgnoreCase(parms[0]) == 0) { world.provider.resetRainAndThunder(); player.addChatMessage( new ChatComponentText(StatCollector.translateToLocal("msg.RainReset"))); } else if ("reload".compareToIgnoreCase(parms[0]) == 0) { BiomeRegistry.initialize(); BlockRegistry.initialize(); player.addChatMessage( new ChatComponentText(StatCollector.translateToLocal("msg.BiomeReload"))); } else { final double d = parseDouble(parms[0], 0.0D, 100.0D) / 100.0D; data.setRainIntensity((float) d); player.addChatMessage( new ChatComponentText( StatCollector.translateToLocalFormatted( "msg.RainIntensitySet", FORMATTER.format(data.getRainIntensity() * 100)))); } } else if (parms.length == 2) { if ("setmin".compareToIgnoreCase(parms[0]) == 0) { final double d = parseDouble(parms[1], 0.0D, 100.0D) / 100.0D; data.setMinRainIntensity((float) d); player.addChatMessage( new ChatComponentText( StatCollector.translateToLocalFormatted( "msg.MinRainIntensitySet", FORMATTER.format(data.getMinRainIntensity() * 100)))); } else if ("setmax".compareToIgnoreCase(parms[0]) == 0) { final double d = parseDouble(parms[1], 0.0D, 100.0D) / 100.0D; data.setMaxRainIntensity((float) d); player.addChatMessage( new ChatComponentText( StatCollector.translateToLocalFormatted( "msg.MaxRainIntensitySet", FORMATTER.format(data.getMaxRainIntensity() * 100)))); } else { throw new CommandException(getCommandUsage(sender)); } } else { player.addChatMessage(new ChatComponentText(getCommandUsage(sender))); } } catch (final Exception ex) { ex.printStackTrace(); } }
public static String statusOutput(final World world, final DimensionEffectData data) { final StringBuilder builder = new StringBuilder(); final float minutes = (world.getWorldInfo().getRainTime() / 20.0F) / 60.0F; builder.append(data.toString()); builder.append("; isRaining: ").append(Boolean.toString(world.isRaining())); builder.append("; isSurface: ").append(Boolean.toString(world.provider.isSurfaceWorld())); builder.append("; strength: ").append(FORMATTER.format(world.getRainStrength(1.0F) * 100)); builder.append("; timer: ").append(FORMATTER.format(minutes)).append(" minutes"); return builder.toString(); }