コード例 #1
0
 private void OnPermissionChanged(PermissionArgs e)
 {
     changed = true;
     if (PermissionChanged != null)
     {
         PermissionChanged(this, e);
     }
 }
コード例 #2
0
 void OnPermission(PermissionArgs args)
 {
     for (int x = 0; x < 3; x++)
     {
         for (int y = 0; y < 3; y++)
         {
             for (int z = 0; z < 3; z++)
             {
                 int cx = args.GetX() / Server.chunksize + x - 1;
                 int cy = args.GetY() / Server.chunksize + y - 1;
                 int cz = args.GetZ() / Server.chunksize + z - 1;
                 if (!MapUtil.IsValidChunkPos(server.d_Map, cx, cy, cz, Server.chunksize))
                 {
                     continue;
                 }
                 ServerChunk c = server.d_Map.GetChunk_(cx, cy, cz);
                 if (c == null)
                 {
                     return;
                 }
                 for (int i = 0; i < c.EntitiesCount; i++)
                 {
                     ServerEntity e = c.Entities[i];
                     if (e == null)
                     {
                         continue;
                     }
                     if (e.permissionSign == null)
                     {
                         continue;
                     }
                     if (e.drawArea == null)
                     {
                         continue;
                     }
                     if (!InArea(args.GetX(), args.GetY(), args.GetZ(),
                                 e.drawArea.x, e.drawArea.z, e.drawArea.y,
                                 e.drawArea.sizex, e.drawArea.sizez, e.drawArea.sizey))
                     {
                         continue;
                     }
                     if (e.permissionSign.type == PermissionSignType.Group)
                     {
                         if (e.permissionSign.name == server.clients[args.GetPlayer()].clientGroup.Name)
                         {
                             args.SetAllowed(true);
                             return;
                         }
                     }
                     if (e.permissionSign.type == PermissionSignType.Player)
                     {
                         if (e.permissionSign.name == server.clients[args.GetPlayer()].playername)
                         {
                             args.SetAllowed(true);
                             return;
                         }
                     }
                 }
             }
         }
     }
 }