Advertisement
Guest User

Reload command

a guest
Mar 1st, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.67 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Text;
  4. using System.Collections.Generic;
  5.  
  6. using Plus.HabboHotel.Rooms;
  7. using Plus.Communication.Packets.Outgoing.Rooms.Session;
  8.  
  9. namespace Plus.HabboHotel.Rooms.Chat.Commands.User
  10. {
  11.     class ReloadCommand : IChatCommand
  12.     {
  13.         public string PermissionRequired
  14.         {
  15.             get { return "command_unload"; }
  16.         }
  17.  
  18.         public string Parameters
  19.         {
  20.             get { return "%id%"; }
  21.         }
  22.  
  23.         public string Description
  24.         {
  25.             get { return "Recarga la habitaciĆ³n."; }
  26.         }
  27.  
  28.         public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
  29.         {
  30.             if (Session.GetHabbo().GetPermissions().HasRight("room_unload_any"))
  31.             {
  32.                 Room R = null;
  33.                 if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Room.Id, out R))
  34.                     return;
  35.  
  36.                 PlusEnvironment.GetGame().GetRoomManager().UnloadRoom(R, true);
  37.             }
  38.             else
  39.             {
  40.                 if (Room.CheckRights(Session, true))
  41.                 {
  42.                     List<RoomUser> UsersToReturn = Room.GetRoomUserManager().GetRoomUsers().ToList();
  43.                     PlusEnvironment.GetGame().GetRoomManager().UnloadRoom(Room);
  44.                     foreach (RoomUser User in UsersToReturn)
  45.                     {
  46.                         if (User == null || User.GetClient() == null)
  47.                             continue;
  48.  
  49.                         User.GetClient().SendMessage(new RoomForwardComposer(Room.Id));
  50.                     }
  51.                 }
  52.             }
  53.         }
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement