Пример #1
0
		static void
		_handle_no_args (player *pl, world *w)
		{
			std::ostringstream ss;
			
			world_security& sec = w->security ();
			
			// header
			ss << "§6Displaying world information for " << w->get_colored_name () << "§e:";
			pl->message (ss.str ());
			ss.str (std::string ());
			
			// type
			ss << "§e  World type§f: §9" << ((w->get_type () == WT_NORMAL) ? "normal" : "light");
			pl->message (ss.str ());
			ss.str (std::string ());
			
			// dimensions
			ss << "§e  Dimensions§f: §a";
			if (w->get_width () <= 0)
				ss << "infinite";
			else
				ss << w->get_width ();
			ss << " §7x §a";
			if (w->get_depth () <= 0)
				ss << "infinite";
			else
				ss << w->get_depth ();
			pl->message (ss.str ());
			ss.str (std::string ());
			
			// time
			pl->message ("§e  Time§f: §9" + _get_time_str (w->get_time ()) + (w->is_time_frozen () ? " [Frozen]" : ""));
			
			// owners
			const auto& owner_pids = sec.get_owners ();
			if (owner_pids.empty ())
				pl->message ("§e  Owners§f: §8none");
			else
				{
					pl->message ("§e  Owners§f:");
					_print_names_from_pids (pl, owner_pids);
				}
			
			// members
			const auto& member_pids = sec.get_members ();
			if (member_pids.empty ())
				pl->message ("§e  Members§f: §8none");
			else
				{
					pl->message ("§e  Members§f:");
					_print_names_from_pids (pl, member_pids);
				}
		}
Пример #2
0
  void Transceiver::_new_log_entry(const timeval& t, const byte1_t* buf, size_t len, int entry_type)
  {
    if(entry_type == LOG_RX)
      _fs_packet_log << "RX : ";
    
    if(entry_type == LOG_SS)
      _fs_packet_log << "SS : ";

    if(entry_type == LOG_SF)
      _fs_packet_log << "SF : ";
    
    _fs_packet_log << _get_time_str(t);
    _fs_packet_log << "\t";
    for(size_t index = 0; index < len; ++index)
      _fs_packet_log << std::hex << int(buf[index]) << " ";
    _fs_packet_log << std::endl;
  }
Пример #3
0
    static void
    _handle_time (player *pl, world *w, command_reader& reader)
    {
    	std::ostringstream ss;
    	
    	if (!reader.has_next ())
    		{
    			pl->message ("§6Displaying world time for " + w->get_colored_name () + "§e:");
    			pl->message ("§7    " + _get_time_str (w->get_time ()) + (w->is_time_frozen () ? " [Frozen]" : ""));
    			return;
    		}
    	
    	std::string arg = reader.next ();
    	if (sutils::iequals (arg, "set"))
    		{
    			if (!pl->has ("command.world.world.time"))
    				{
    					pl->message (messages::not_allowed ());
    					return;
    				}
    			
    			if (!reader.has_next ())
    				{
    					pl->message ("§c * §7Usage§f: §e/world time set §ctime");
    					return;
    				}
    			
    			unsigned long long time = 0;
    			arg = reader.next ().as_str ();
    			if (!_parse_time (arg, time))
    				{
    					pl->message ("§c * §7Invalid time string§c.");
    					return;
    				}
    			
    			w->set_time (time);
					ss << "§eWorld time for " << w->get_colored_name () << " §ehas been set to§f: §9"
						<< _get_time_str (time) << " §f[§9" << (time % 24000) << " ticks§f]";
					pl->message (ss.str ());
    		}
    	else if (sutils::iequals (arg, "stop"))
    		{
    			if (!pl->has ("command.world.world.time"))
    				{
    					pl->message (messages::not_allowed ());
    					return;
    				}
    			
    			if (w->is_time_frozen ())
    				{
    					pl->message ("§c * §Time is already frozen in this world§c.");
    					return;
    				}
    			
    			w->stop_time ();
    			pl->message ("§eWorld time has been stopped in world " + w->get_colored_name ());
    		}
    	else if (sutils::iequals (arg, "resume"))
    		{
    			if (!pl->has ("command.world.world.time"))
    				{
    					pl->message (messages::not_allowed ());
    					return;
    				}
    			
    			if (!w->is_time_frozen ())
    				{
    					pl->message ("§c * §Time is not frozen in this world§c.");
    					return;
    				}
    			
    			w->resume_time ();
    			pl->message ("§eWorld time has been resumed in world " + w->get_colored_name ());
    		}
    	else
    		{
    			pl->message ("§c * §7Unknown sub-command§f: §ctime." + arg);
    		}
    }